<commit_before>(**
 * Copyright (c) 2015, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the "hack" directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 *
 *)

type t =
  | No_error
  | Build_error
  | Build_terminated
  | Checkpoint_error
  | Input_error
  | Kill_error
  | No_server_running
  | Out_of_time
  | Out_of_retries
  | Server_already_exists
  | Server_initializing
  | Type_error
  | Build_id_mismatch
  | Monitor_connection_failure
  | Unused_server
  | Lock_stolen
  | Lost_parent_monitor
  | Interrupted
  | Worker_oomed
  | Worker_busy
  | Socket_error
  | Missing_hhi
  | Dfind_died
  | Dfind_unresponsive
  | EventLogger_Timeout
  | EventLogger_restart_out_of_retries
  | EventLogger_broken_pipe
  | CantRunAI
  | Watchman_failed
  | Hhconfig_deleted
  | Hhconfig_changed
  | Server_shutting_down
  | Server_name_not_found
  | IDE_malformed_request
  | IDE_no_server
  | IDE_out_of_retries
  | Nfs_root
  | IDE_init_failure
  | IDE_typechecker_died
  | Redecl_heap_overflow
  | Out_of_shared_memory
  | Shared_mem_assertion_failure
  | Hash_table_full
  | IDE_persistent_client_already_exists
  | Lazy_decl_bug
  | Decl_heap_elems_bug
  | Parser_heap_build_error
  | Heap_full

exception Exit_with of t

let exit_code = function
  | No_error -> 0
  | Build_error -> 2
  | Build_terminated -> 1
  | Checkpoint_error -> 8
  | Input_error -> 10
  | Kill_error -> 1
  | No_server_running -> 6
  | Out_of_time -> 7
  | Out_of_retries -> 7
  | Server_already_exists -> 77
  | Server_initializing -> 1
  | Server_shutting_down -> 1
  | Type_error -> 2
  | Build_id_mismatch -> 9
  | Monitor_connection_failure -> 9
  | Unused_server -> 5
  | Lock_stolen -> 11
  | Lost_parent_monitor -> 12
  | Shared_mem_assertion_failure -> 14
  | Out_of_shared_memory -> 15
  | Hash_table_full -> 16
  | Heap_full -> 17
  | Interrupted -> -6
  | Worker_oomed -> 30
  | Worker_busy -> 31
  | Missing_hhi -> 97
  | Socket_error -> 98
  | Dfind_died -> 99
  | Dfind_unresponsive -> 100
  | EventLogger_Timeout -> 101
  | EventLogger_restart_out_of_retries -> 108
  | CantRunAI -> 102
  | Watchman_failed -> 103
  | Hhconfig_deleted -> 104
  | Hhconfig_changed -> 4
  | Server_name_not_found -> 105
  | EventLogger_broken_pipe -> 106
  | Redecl_heap_overflow -> 107
  | IDE_malformed_request -> 201
  | IDE_no_server -> 202
  | IDE_out_of_retries -> 203
  | Nfs_root -> 204
  | IDE_init_failure -> 205
  | IDE_typechecker_died -> 206
  | IDE_persistent_client_already_exists -> 207
  | Lazy_decl_bug -> 208
  | Decl_heap_elems_bug -> 209
  | Parser_heap_build_error -> 210


let exit t =
  let ec = exit_code t in
  Pervasives.exit ec

let to_string = function
  | No_error -> "Ok"
  | Build_error -> "Build_error"
  | Build_terminated -> "Build_terminated"
  | Checkpoint_error -> "Checkpoint_error"
  | Input_error -> "Input_error"
  | Kill_error -> "Kill_error"
  | No_server_running -> "No_server_running"
  | Out_of_time -> "Out_of_time"
  | Out_of_retries -> "Out_of_retries"
  | Server_already_exists -> "Server_already_exists"
  | Server_initializing -> "Server_initializing"
  | Server_shutting_down -> "Server_shutting_down"
  | Type_error -> "Type_error"
  | Build_id_mismatch -> "Build_id_mismatch"
  | Monitor_connection_failure -> "Monitor_connection_failure"
  | Unused_server -> "Unused_server"
  | Lock_stolen -> "Lock_stolen"
  | Lost_parent_monitor -> "Lost_parent_monitor"
  | Interrupted -> "Interrupted"
  | Worker_oomed -> "Worker_oomed"
  | Worker_busy -> "Worker_busy"
  | Socket_error -> "Socket_error"
  | Missing_hhi -> "Missing_hhi"
  | Dfind_died -> "Dfind_died"
  | Dfind_unresponsive -> "Dfind_unresponsive"
  | EventLogger_Timeout -> "EventLogger_Timeout"
  | EventLogger_restart_out_of_retries -> "EventLogger_restart_out_of_retries"
  | EventLogger_broken_pipe -> "EventLogger_broken_pipe"
  | CantRunAI -> "CantRunAI"
  | Watchman_failed -> "Watchman_failed"
  | Hhconfig_deleted -> "Hhconfig_deleted"
  | Hhconfig_changed -> "Hhconfig_changed"
  | Server_name_not_found -> "Server_name_not_found"
  | IDE_malformed_request -> "IDE_malformed_request"
  | IDE_no_server -> "IDE_no_server"
  | IDE_out_of_retries -> "IDE_out_of_retries"
  | Nfs_root -> "Nfs_root"
  | IDE_init_failure -> "IDE_init_failure"
  | IDE_typechecker_died -> "IDE_typechecker_died"<commit_msg>[hack] Main process exits with same code as child. Also classify Not_found exception<commit_after>(**
 * Copyright (c) 2015, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the "hack" directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 *
 *)

type t =
  | No_error
  | Build_error
  | Build_terminated
  | Checkpoint_error
  | Input_error
  | Kill_error
  | No_server_running
  | Out_of_time
  | Out_of_retries
  | Server_already_exists
  | Server_initializing
  | Type_error
  | Build_id_mismatch
  | Monitor_connection_failure
  | Unused_server
  | Lock_stolen
  | Lost_parent_monitor
  | Interrupted
  | Worker_oomed
  | Worker_busy
  (** An uncaught Not_found exception in the worker. *)
  | Worker_not_found_exception
  | Socket_error
  | Missing_hhi
  | Dfind_died
  | Dfind_unresponsive
  | EventLogger_Timeout
  | EventLogger_restart_out_of_retries
  | EventLogger_broken_pipe
  | CantRunAI
  | Watchman_failed
  | Hhconfig_deleted
  | Hhconfig_changed
  | Server_shutting_down
  | Server_name_not_found
  | IDE_malformed_request
  | IDE_no_server
  | IDE_out_of_retries
  | Nfs_root
  | IDE_init_failure
  | IDE_typechecker_died
  | Redecl_heap_overflow
  | Out_of_shared_memory
  | Shared_mem_assertion_failure
  | Hash_table_full
  | IDE_persistent_client_already_exists
  | Lazy_decl_bug
  | Decl_heap_elems_bug
  | Parser_heap_build_error
  | Heap_full

exception Exit_with of t

let exit_code = function
  | No_error -> 0
  | Build_error -> 2
  | Build_terminated -> 1
  | Checkpoint_error -> 8
  | Input_error -> 10
  | Kill_error -> 1
  | No_server_running -> 6
  | Out_of_time -> 7
  | Out_of_retries -> 7
  | Server_already_exists -> 77
  | Server_initializing -> 1
  | Server_shutting_down -> 1
  | Type_error -> 2
  | Build_id_mismatch -> 9
  | Monitor_connection_failure -> 9
  | Unused_server -> 5
  | Lock_stolen -> 11
  | Lost_parent_monitor -> 12
  | Shared_mem_assertion_failure -> 14
  | Out_of_shared_memory -> 15
  | Hash_table_full -> 16
  | Heap_full -> 17
  | Interrupted -> -6
  | Worker_oomed -> 30
  | Worker_busy -> 31
  | Worker_not_found_exception -> 32
  | Missing_hhi -> 97
  | Socket_error -> 98
  | Dfind_died -> 99
  | Dfind_unresponsive -> 100
  | EventLogger_Timeout -> 101
  | EventLogger_restart_out_of_retries -> 108
  | CantRunAI -> 102
  | Watchman_failed -> 103
  | Hhconfig_deleted -> 104
  | Hhconfig_changed -> 4
  | Server_name_not_found -> 105
  | EventLogger_broken_pipe -> 106
  | Redecl_heap_overflow -> 107
  | IDE_malformed_request -> 201
  | IDE_no_server -> 202
  | IDE_out_of_retries -> 203
  | Nfs_root -> 204
  | IDE_init_failure -> 205
  | IDE_typechecker_died -> 206
  | IDE_persistent_client_already_exists -> 207
  | Lazy_decl_bug -> 208
  | Decl_heap_elems_bug -> 209
  | Parser_heap_build_error -> 210


let exit t =
  let ec = exit_code t in
  Pervasives.exit ec

let to_string = function
  | No_error -> "Ok"
  | Build_error -> "Build_error"
  | Build_terminated -> "Build_terminated"
  | Checkpoint_error -> "Checkpoint_error"
  | Input_error -> "Input_error"
  | Kill_error -> "Kill_error"
  | No_server_running -> "No_server_running"
  | Out_of_time -> "Out_of_time"
  | Out_of_retries -> "Out_of_retries"
  | Server_already_exists -> "Server_already_exists"
  | Server_initializing -> "Server_initializing"
  | Server_shutting_down -> "Server_shutting_down"
  | Type_error -> "Type_error"
  | Build_id_mismatch -> "Build_id_mismatch"
  | Monitor_connection_failure -> "Monitor_connection_failure"
  | Unused_server -> "Unused_server"
  | Lock_stolen -> "Lock_stolen"
  | Lost_parent_monitor -> "Lost_parent_monitor"
  | Interrupted -> "Interrupted"
  | Worker_oomed -> "Worker_oomed"
  | Worker_busy -> "Worker_busy"
  | Worker_not_found_exception -> "Worker_not_found_exception"
  | Socket_error -> "Socket_error"
  | Missing_hhi -> "Missing_hhi"
  | Dfind_died -> "Dfind_died"
  | Dfind_unresponsive -> "Dfind_unresponsive"
  | EventLogger_Timeout -> "EventLogger_Timeout"
  | EventLogger_restart_out_of_retries -> "EventLogger_restart_out_of_retries"
  | EventLogger_broken_pipe -> "EventLogger_broken_pipe"
  | CantRunAI -> "CantRunAI"
  | Watchman_failed -> "Watchman_failed"
  | Hhconfig_deleted -> "Hhconfig_deleted"
  | Hhconfig_changed -> "Hhconfig_changed"
  | Server_name_not_found -> "Server_name_not_found"
  | IDE_malformed_request -> "IDE_malformed_request"
  | IDE_no_server -> "IDE_no_server"
  | IDE_out_of_retries -> "IDE_out_of_retries"
  | Nfs_root -> "Nfs_root"
  | IDE_init_failure -> "IDE_init_failure"
  | IDE_typechecker_died -> "IDE_typechecker_died"
{'fraction_non_alphanumeric': 0.09350479511769834, 'fraction_numerical': 0.022667829119442023, 'mean_word_length': 3.9338709677419357, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 179, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5416713', 'n_tokens_mistral': 3669, 'n_tokens_neox': 3357, 'n_words': 607}