Improve error message on misplaced async modifiers
[hiphop-php.git] / hphp / hack / src / utils / exit_status.ml
blobdc718aa0b35d758e384857609b1da073f0f89a9b
1 (**
2 * Copyright (c) 2015, Facebook, Inc.
3 * All rights reserved.
5 * This source code is licensed under the MIT license found in the
6 * LICENSE file in the "hack" directory of this source tree.
8 *)
10 type t =
11 | No_error
12 | Build_error
13 | Build_terminated
14 | Checkpoint_error
15 | Input_error
16 | Kill_error
17 | No_server_running_should_retry
18 | Server_hung_up_should_retry
19 | Server_hung_up_should_abort
20 | Out_of_time
21 | Out_of_retries
22 | Server_already_exists
23 | Type_error
24 | Build_id_mismatch
25 | Monitor_connection_failure
26 | Unused_server
27 | Lock_stolen
28 | Lost_parent_monitor
29 | Interrupted
30 | Worker_oomed
31 | Worker_busy
32 (** An uncaught Not_found exception in the worker. *)
33 | Worker_not_found_exception
34 | Worker_failed_to_send_job
35 | Socket_error
36 | Missing_hhi
37 | Dfind_died
38 | Dfind_unresponsive
39 | EventLogger_Timeout
40 | EventLogger_restart_out_of_retries
41 | EventLogger_broken_pipe
42 | CantRunAI
43 | Watchman_failed
44 (** It is faster to exit the server (and have the Monitor restart the server)
45 * on a Watchman fresh instance than to compute the files that have been
46 * deleted and do an incremental check.
48 | Watchman_fresh_instance
49 | Watchman_invalid_result
50 | File_provider_stale
51 | Hhconfig_deleted
52 | Hhconfig_changed
53 | Server_shutting_down
54 | IDE_malformed_request
55 | IDE_no_server
56 | IDE_out_of_retries
57 | Nfs_root
58 | IDE_init_failure
59 | IDE_typechecker_died
60 | Redecl_heap_overflow
61 | Out_of_shared_memory
62 | Shared_mem_assertion_failure
63 | Hash_table_full
64 | IDE_new_client_connected
65 | Lazy_decl_bug
66 | Decl_heap_elems_bug
67 | Parser_heap_build_error
68 | Heap_full
69 | Sql_assertion_failure
70 | Local_type_env_stale
71 | Sql_cantopen
72 | Sql_corrupt
73 | Sql_misuse
74 | Uncaught_exception
75 | Decl_not_found
76 | Big_rebase_detected
77 | Failed_to_load_should_retry
78 | Failed_to_load_should_abort
80 exception Exit_with of t
82 let exit_code = function
83 | Interrupted -> -6
84 | No_error -> 0
85 | Build_terminated -> 1 (* used in clientBuild *)
86 | Kill_error -> 1 (* used in clientStop/Start/Restart *)
87 | Server_shutting_down -> 1 (* used in server *)
88 | Build_error -> 2 (* used in clientBuild *)
89 | Type_error -> 2 (* used in clientCheck *)
90 | Uncaught_exception -> 2 (* used in server and clientIde *)
91 | Hhconfig_changed -> 4
92 | Unused_server -> 5
93 | No_server_running_should_retry -> 6 (* gen by clientConnect, read by find_hh.sh *)
94 | Server_hung_up_should_retry -> 6 (* gen by clientConnect, read by find_hh.sh *)
95 | Out_of_time -> 7
96 | Out_of_retries -> 7
97 | Checkpoint_error -> 8
98 | Build_id_mismatch -> 9
99 | Monitor_connection_failure -> 9
100 | Input_error -> 10
101 | Lock_stolen -> 11
102 | Lost_parent_monitor -> 12
103 | Shared_mem_assertion_failure -> 14
104 | Out_of_shared_memory -> 15
105 | Hash_table_full -> 16
106 | Heap_full -> 17
107 | Worker_oomed -> 30
108 | Worker_busy -> 31
109 | Worker_not_found_exception -> 32
110 | Worker_failed_to_send_job -> 33
111 | Server_already_exists -> 77
112 | Missing_hhi -> 97
113 | Socket_error -> 98
114 | Dfind_died -> 99
115 | Dfind_unresponsive -> 100
116 | EventLogger_Timeout -> 101
117 | CantRunAI -> 102
118 | Watchman_failed -> 103
119 | Hhconfig_deleted -> 104
120 | EventLogger_broken_pipe -> 106
121 | Redecl_heap_overflow -> 107
122 | EventLogger_restart_out_of_retries -> 108
123 | Watchman_fresh_instance -> 109
124 | Watchman_invalid_result -> 110
125 | Big_rebase_detected -> 111
126 | IDE_malformed_request -> 201
127 | IDE_no_server -> 202
128 | IDE_out_of_retries -> 203
129 | Nfs_root -> 204
130 | IDE_init_failure -> 205
131 | IDE_typechecker_died -> 206
132 | IDE_new_client_connected -> 207
133 | Lazy_decl_bug -> 208
134 | Decl_heap_elems_bug -> 209
135 | Parser_heap_build_error -> 210
136 | File_provider_stale -> 211
137 | Sql_assertion_failure -> 212
138 | Local_type_env_stale -> 213
139 | Sql_cantopen -> 214
140 | Sql_corrupt -> 215
141 | Sql_misuse -> 216
142 | Decl_not_found -> 217
143 | Failed_to_load_should_retry -> 218 (* gen by serverInit, read by serverMonitor+clientConnect *)
144 | Failed_to_load_should_abort -> 219 (* gen by serverInit, read by serverMonitor+clientConnect *)
145 | Server_hung_up_should_abort -> 220 (* generated by clientConnect, read by find_hh.sh *)
148 let exit t =
149 let ec = exit_code t in
150 Pervasives.exit ec
152 let to_string = function
153 | No_error -> "Ok"
154 | Build_error -> "Build_error"
155 | Build_terminated -> "Build_terminated"
156 | Checkpoint_error -> "Checkpoint_error"
157 | Input_error -> "Input_error"
158 | Kill_error -> "Kill_error"
159 | No_server_running_should_retry -> "No_server_running_should_retry"
160 | Server_hung_up_should_retry -> "Server_hung_up_should_retry"
161 | Server_hung_up_should_abort -> "Server_hung_up_should_abort"
162 | Out_of_time -> "Out_of_time"
163 | Out_of_retries -> "Out_of_retries"
164 | Server_already_exists -> "Server_already_exists"
165 | Server_shutting_down -> "Server_shutting_down"
166 | Type_error -> "Type_error"
167 | Build_id_mismatch -> "Build_id_mismatch"
168 | Monitor_connection_failure -> "Monitor_connection_failure"
169 | Unused_server -> "Unused_server"
170 | Lock_stolen -> "Lock_stolen"
171 | Lost_parent_monitor -> "Lost_parent_monitor"
172 | Interrupted -> "Interrupted"
173 | Worker_oomed -> "Worker_oomed"
174 | Worker_busy -> "Worker_busy"
175 | Worker_not_found_exception -> "Worker_not_found_exception"
176 | Worker_failed_to_send_job -> "Worker_failed_to_send_job"
177 | Socket_error -> "Socket_error"
178 | Missing_hhi -> "Missing_hhi"
179 | Dfind_died -> "Dfind_died"
180 | Dfind_unresponsive -> "Dfind_unresponsive"
181 | EventLogger_Timeout -> "EventLogger_Timeout"
182 | EventLogger_restart_out_of_retries -> "EventLogger_restart_out_of_retries"
183 | EventLogger_broken_pipe -> "EventLogger_broken_pipe"
184 | CantRunAI -> "CantRunAI"
185 | Watchman_failed -> "Watchman_failed"
186 | Watchman_fresh_instance -> "Watchman_fresh_instance"
187 | Watchman_invalid_result -> "Watchman_invalid_result"
188 | Hhconfig_deleted -> "Hhconfig_deleted"
189 | Hhconfig_changed -> "Hhconfig_changed"
190 | IDE_malformed_request -> "IDE_malformed_request"
191 | IDE_no_server -> "IDE_no_server"
192 | IDE_out_of_retries -> "IDE_out_of_retries"
193 | Nfs_root -> "Nfs_root"
194 | IDE_init_failure -> "IDE_init_failure"
195 | IDE_typechecker_died -> "IDE_typechecker_died"
196 | Redecl_heap_overflow -> "Redecl_heap_overflow"
197 | Shared_mem_assertion_failure -> "Shared_mem_assertion_failure"
198 | Out_of_shared_memory -> "Out_of_shared_memory"
199 | Hash_table_full -> "Hash_table_full"
200 | IDE_new_client_connected -> "IDE_new_client_connected"
201 | Lazy_decl_bug -> "Lazy_decl_bug"
202 | Decl_heap_elems_bug -> "Decl_heap_elems_bug"
203 | Parser_heap_build_error -> "Parser_heap_build_error"
204 | Heap_full -> "Heap_full"
205 | File_provider_stale -> "File_provider_stale"
206 | Sql_assertion_failure -> "Sql_assertion_failure"
207 | Local_type_env_stale -> "Local_type_env_stale"
208 | Sql_cantopen -> "Sql_cantopen"
209 | Sql_corrupt -> "Sql_corrupt"
210 | Sql_misuse -> "Sql_misuse"
211 | Uncaught_exception -> "Uncaught_exception"
212 | Decl_not_found -> "Decl_not_found"
213 | Big_rebase_detected -> "Big_rebase_detected"
214 | Failed_to_load_should_retry -> "Failed_to_load_should_retry"
215 | Failed_to_load_should_abort -> "Failed_to_load_should_abort"
219 let unpack = function
220 | Unix.WEXITED n -> "exit", n
221 | Unix.WSIGNALED n ->
223 * Ocaml signal numbers are mapped from System signal numbers.
224 * They are negative.
225 * See caml_convert_signal_number byterun/signals.c in Ocaml system source code
226 * to convert from Ocaml number to System number
228 "signaled", n
229 | Unix.WSTOPPED n -> "stopped", n