From 06537307706c4effe53985b453a8e533d6f57a4d Mon Sep 17 00:00:00 2001 From: Peter Zotov Date: Fri, 11 Apr 2014 22:12:40 +0400 Subject: [PATCH] Synchronize exception list with zmq.h. --- src/ZMQ.ml | 40 ++++++++++++++++++++++++---------------- src/ZMQ.mli | 38 +++++++++++++++++++++++--------------- src/fail.c | 34 +++++++++++++++++++++------------- 3 files changed, 68 insertions(+), 44 deletions(-) diff --git a/src/ZMQ.ml b/src/ZMQ.ml index 824dc1b..9a7a412 100644 --- a/src/ZMQ.ml +++ b/src/ZMQ.ml @@ -3,26 +3,34 @@ (** Module Exceptions *) type error = - EINVAL - | EFAULT - | EMTHREAD - | ETERM - | ENODEV - | EADDRNOTAVAIL - | EADDRINUSE - | ENOCOMPATPROTO - | EPROTONOSUPPORT - | EAGAIN - | ENOTSUP - | EFSM - | ENOMEM - | EINTR - | EUNKNOWN +| ENOTSUP +| EPROTONOSUPPORT +| ENOBUFS +| ENETDOWN +| EADDRINUSE +| EADDRNOTAVAIL +| ECONNREFUSED +| EINPROGRESS +| ENOTSOCK +| EMSGSIZE +| EAFNOSUPPORT +| ENETUNREACH +| ECONNABORTED +| ECONNRESET +| ENOTCONN +| ETIMEDOUT +| EHOSTUNREACH +| ENETRESET +| EFSM +| ENOCOMPATPROTO +| ETERM +| EMTHREAD +| EUNKNOWN exception ZMQ_exception of error * string let _ = - Callback.register_exception "zmq exception" (ZMQ_exception(EUNKNOWN,"Unkown error")) + Callback.register_exception "ZMQ.ZMQ_exception" (ZMQ_exception(EUNKNOWN, "Unknown error")) external version : unit -> int * int * int = "caml_zmq_version" diff --git a/src/ZMQ.mli b/src/ZMQ.mli index f3870f8..cb16b1b 100644 --- a/src/ZMQ.mli +++ b/src/ZMQ.mli @@ -2,21 +2,29 @@ (** Module Exceptions *) type error = - EINVAL - | EFAULT - | EMTHREAD - | ETERM - | ENODEV - | EADDRNOTAVAIL - | EADDRINUSE - | ENOCOMPATPROTO - | EPROTONOSUPPORT - | EAGAIN - | ENOTSUP - | EFSM - | ENOMEM - | EINTR - | EUNKNOWN +| ENOTSUP +| EPROTONOSUPPORT +| ENOBUFS +| ENETDOWN +| EADDRINUSE +| EADDRNOTAVAIL +| ECONNREFUSED +| EINPROGRESS +| ENOTSOCK +| EMSGSIZE +| EAFNOSUPPORT +| ENETUNREACH +| ECONNABORTED +| ECONNRESET +| ENOTCONN +| ETIMEDOUT +| EHOSTUNREACH +| ENETRESET +| EFSM +| ENOCOMPATPROTO +| ETERM +| EMTHREAD +| EUNKNOWN exception ZMQ_exception of error * string diff --git a/src/fail.c b/src/fail.c index 9ce5008..7c004ff 100644 --- a/src/fail.c +++ b/src/fail.c @@ -13,20 +13,28 @@ /* This table must be synchronized with the variant definition. */ static int const caml_zmq_error_table[] = { - EINVAL, - EFAULT, - EMTHREAD, - ETERM, - ENODEV, - EADDRNOTAVAIL, - EADDRINUSE, - ENOCOMPATPROTO, - EPROTONOSUPPORT, - EAGAIN, ENOTSUP, + EPROTONOSUPPORT, + ENOBUFS, + ENETDOWN, + EADDRINUSE, + EADDRNOTAVAIL, + ECONNREFUSED, + EINPROGRESS, + ENOTSOCK, + EMSGSIZE, + EAFNOSUPPORT, + ENETUNREACH, + ECONNABORTED, + ECONNRESET, + ENOTCONN, + ETIMEDOUT, + EHOSTUNREACH, + ENETRESET, EFSM, - ENOMEM, - EINTR + ENOCOMPATPROTO, + ETERM, + EMTHREAD, }; /* This must be the last value of the variant. */ @@ -48,7 +56,7 @@ void caml_zmq_raise(int err_no, const char *err_str) { error_parameters[0] = Val_int(error_to_raise); error_parameters[1] = caml_copy_string(err_str); - caml_raise_with_args(*caml_named_value("zmq exception"), + caml_raise_with_args(*caml_named_value("ZMQ.ZMQ_exception"), 2, error_parameters); CAMLreturn0;