package win-error

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

manipulate Windows system errors

If your application is likely to run on Windows, simply replace uses of Unix.error_message with Win_error.error_message. When the application runs on Windows, Windows system errors will be decoded; when the application runs elsewhere then the existing Unix.error_message function is called transparently.

Errors are typically first thrown by the OCaml standard library as Unix.Unix_error exceptions. In some cases these are mapped onto their Unix equivalents on such as Unix.error.ENOENT, but when the code isn't recognised OCaml will raise Unix.error.EUNKNOWNERR (-code). This library is able to convert these codes back into human-readable strings.

type t =
  1. | Success
  2. | Invalid_function
  3. | File_not_found
  4. | Path_not_found
  5. | Too_many_open_files
  6. | Access_denied
  7. | Invalid_handle
  8. | Arena_trashed
  9. | Not_enough_memory
  10. | Invalid_block
  11. | Bad_environment
  12. | Bad_format
  13. | Invalid_access
  14. | Invalid_data
  15. | Outofmemory
  16. | Invalid_drive
  17. | Current_directory
  18. | Not_same_device
  19. | No_more_files
  20. | Write_protect
  21. | Bad_unit
  22. | Not_ready
  23. | Bad_command
  24. | Crc
  25. | Bad_length
  26. | Seek
  27. | Not_dos_disk
  28. | Sector_not_found
  29. | Out_of_paper
  30. | Write_fault
  31. | Read_fault
  32. | Gen_failure
  33. | Sharing_violation
  34. | Lock_violation
  35. | Wrong_disk
  36. | Sharing_buffer_exceeded
  37. | Handle_eof
  38. | Handle_disk_full
  39. | Not_supported
  40. | Rem_not_list
  41. | Dup_name
  42. | Bad_netpath
  43. | Network_busy
  44. | Dev_not_exist
  45. | Too_many_cmds
  46. | Adap_hdw_err
  47. | Bad_net_resp
  48. | Unexp_net_err
  49. | Bad_rem_adap
  50. | Printq_full
  51. | No_spool_space
  52. | Print_cancelled
  53. | Netname_deleted
  54. | Network_access_denied
  55. | Bad_dev_type
  56. | Bad_net_name
  57. | Too_many_names
  58. | Too_many_sess
  59. | Sharing_paused
  60. | Req_not_accep
  61. | Redir_paused
  62. | File_exists
  63. | Cannot_make
  64. | Fail_I24
  65. | Out_of_structures
  66. | Already_assigned
  67. | Invalid_password
  68. | Invalid_parameter
  69. | Net_write_fault
  70. | No_proc_slots
  71. | Too_many_semaphores
  72. | Excl_sem_already_owned
  73. | Sem_is_set
  74. | Too_many_sem_requests
  75. | Invalid_at_interrupt_time
  76. | Sem_owner_died
  77. | Sem_user_limit
  78. | Disk_change
  79. | Drive_locked
  80. | Broken_pipe
  81. | Open_failed
  82. | Buffer_overflow
  83. | Disk_full
  84. | No_more_search_handles
  85. | Invalid_target_handle
  86. | Invalid_category
  87. | Invalid_verify_switch
  88. | Bad_driver_level
  89. | Call_not_implemented
  90. | Sem_timeout
  91. | Insufficient_buffer
  92. | Invalid_name
  93. | Invalid_level
  94. | No_volume_label
  95. | Mod_not_found
  96. | Proc_not_found
  97. | Wait_no_children
  98. | Child_not_complete
  99. | Direct_access_handle
  100. | Negative_seek
  101. | Seek_on_device
  102. | Is_join_target
  103. | Is_joined
  104. | Is_substed
  105. | Not_joined
  106. | Not_substed
  107. | Join_to_join
  108. | Subst_to_subst
  109. | Join_to_subst
  110. | Subst_to_join
  111. | Busy_drive
  112. | Same_drive
  113. | Dir_not_root
  114. | Dir_not_empty
  115. | Is_subst_path
  116. | Is_join_path
  117. | Path_busy
  118. | Is_subst_target
  119. | System_trace
  120. | Invalid_event_count
  121. | Too_many_muxwaiters
  122. | Invalid_list_format
  123. | Label_too_long
  124. | Too_many_tcps
  125. | Signal_refused
  126. | Discarded
  127. | Not_locked
  128. | Bad_threadid_addr
  129. | Bad_arguments
  130. | Bad_pathname
  131. | Signal_pending
  132. | Max_thrds_reached
  133. | Lock_failed
  134. | Busy
  135. | Device_support_in_progress
  136. | Cancel_violation
  137. | Atomic_locks_not_supported
  138. | Invalid_segment_number
  139. | Invalid_ordinal
  140. | Already_exists
  141. | Invalid_flag_number
  142. | Sem_not_found
  143. | Error_invalid_starting_codeseg
  144. | Invalid_stackseg
  145. | Invalid_moduletype
  146. | Invalid_exe_signature
  147. | Exe_marked_invalid
  148. | Bad_exe_format
  149. | Iterated_data_exceeds_64k
  150. | Invalid_minallocsize
  151. | Iopl_not_enabled
  152. | Invalid_segdpl
  153. | Autodataseg_exceeds_64k
  154. | Ring2seg_must_be_movable
  155. | Reloc_chain_xeeds_seglim
  156. | Infloop_in_reloc_chain
  157. | Envvar_not_found
  158. | No_signal_sent
  159. | Filename_exced_range
  160. | Ring2_stack_in_use
  161. | Meta_expansion_too_long
  162. | Invalid_signal_number
  163. | Thread_1_inactive
  164. | Locked
  165. | Too_many_modules
  166. | Nesting_not_allowed
  167. | Exe_machine_type_mismatch
  168. | Exe_cannot_modify_signed_binary
  169. | Exe_cannot_modify_strong_signed_binary
  170. | File_checked_out
  171. | Checkout_required
  172. | Bad_file_type
  173. | File_too_large
  174. | Forms_auth_required
  175. | Virus_infected
  176. | Virus_deleted
  177. | Pipe_local
  178. | Bad_pipe
  179. | Pipe_busy
  180. | No_data
  181. | Pipe_not_connected
  182. | More_data
  183. | Vc_disconnected
  184. | Invalid_ea_name
  185. | Ea_list_inconsistent
  186. | Wait_timeout
  187. | No_more_items
  188. | Cannot_copy
  189. | Directory
  190. | Eas_didnt_fit
  191. | Ea_file_corrupt
  192. | Ea_table_full
  193. | Invalid_ea_handle
  194. | Eas_not_supported
  195. | Not_owner
  196. | Too_many_posts
  197. | Partial_copy
  198. | Oplock_not_granted
  199. | Invalid_oplock_protocol
  200. | Disk_too_fragmented
  201. | Delete_pending
  202. | Incompatible_with_global_short_name_registry_setting
  203. | Short_names_not_enabled_on_volume
  204. | Security_stream_is_inconsistent
  205. | Invalid_lock_range
  206. | Image_subsystem_not_present
  207. | Notification_guid_already_defined
  208. | Invalid_exception_handler
  209. | Duplicate_privileges
  210. | No_ranges_processed
  211. | Not_allowed_on_system_file
  212. | Disk_resources_exhausted
  213. | Invalid_token
  214. | Device_feature_not_supported
  215. | Mr_mid_not_found
  216. | Scope_not_found
  217. | Undefined_scope
  218. | Invalid_cap
  219. | Device_unreachable
  220. | Device_no_resources
  221. | Data_checksum_error
  222. | Intermixed_kernel_ea_operation
  223. | File_level_trim_not_supported
  224. | Offset_alignment_violation
  225. | Invalid_field_in_parameter_list
  226. | Operation_in_progress
  227. | Bad_device_path
  228. | Too_many_descriptors
  229. | Scrub_data_disabled
  230. | Not_redundant_storage
  231. | Resident_file_not_supported
  232. | Compressed_file_not_supported
  233. | Directory_not_supported
  234. | Not_read_from_copy
  235. | Fail_noaction_reboot
  236. | Fail_shutdown
  237. | Fail_restart
  238. | Max_sessions_reached
  239. | Thread_mode_already_background
  240. | Thread_mode_not_background
  241. | Process_mode_already_background
  242. | Process_mode_not_background
  243. | Invalid_address
    (*

    A subset of the Windows system errors from GetLastError

    *)
val of_unix_error : Unix.error -> t option

Convert a unix error into a specific Windows system error, or return None if we don't recognise it. None means that the error list should be expanded. @see https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382(v=vs.85).aspx full error code list

val to_string : t -> string

to_string t will convert the error t into a short printable string

val pp : Format.formatter -> t -> unit

pp fmt t will output a printable string representation of t to formatter fmt

val error_message : Unix.error -> string

A wrapper of Unix.error_message which also understands Windows system errors.

If called on a Win32 system, this will decode Unix.EUNKNOWNERR values as Windows system errors. If called on other systems, it simply calls Unix.error_message.