package win-error
All checked builds passInstall
dune-project
Dependency
Authors
Maintainers
Sources
sha256=c00aecc776b1cd6ac2d2aa442e2355ae6a44e4760f3ba1fc7117dc1e2231a400
md5=9a627ed19f23485d5889600986684758
Description
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.
Added to opam-repository:
README
ocaml-win-error: 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.
A simple example:
try
let fd = Unix.openfile "/tmp/foo" [ Unix.O_RDONLY ] 0 in
Unix.close fd
with
| Unix.Unix_error(e, _, _) ->
Printf.fprintf stderr "Caught: %s\n%!" (Win_error.error_message e)What's going on?
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.ENOENT, but when the code isn't recognised OCaml will raise Unix.EUNKNOWNERR (-code). This library is able to convert these codes back into human-readable strings.
Dependencies (4)
-
dune
>= "1.0" - base-unix
- base-bytes
-
ocaml
>= "3.12.1"
Dev Dependencies
None
Optional Dependencies
None
Used by (3)
Conflicts
None
Build status
Results of building win-error with each compiler on check.ci.ocaml.org, run of against opam-repository 7cdc698. All results for this package.
Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.
| Version | OCaml 4.11 | OCaml 4.14 | OCaml 5.2 | OCaml 5.4 | OCaml 5.5 |
|---|---|---|---|---|---|
| 1.0 (this version) | good | good | good | good | good |
- good Package successfully built
- partial One of the dependencies failed to build
- bad Package failed to build
- n/a Package is not available in this environment
- internal Internal failure