savonet/ocaml-ssl

Bindings for more ERR_* functions

Closed this issue · 2 comments

I suggest adding bindings for, at least, ERR_get_error, ERR_lib_error_string and ERR_reason_error_string (not necessarily as separate functions). ocaml-ssl currently binds ERR_error_string_n(ERR_get_error(), ...) as get_error_string and uses it for its registered exception printer. However, the default format has proven hard to read in Dream logs. We'd like to print these errors with a custom format.

These may need to be returned in a single call if using ERR_get_error, since it pops the error from the stack. (Is it documented that get_error_string and Printexc.to_string only work once as well? Maybe these functions should use ERR_peek_error instead.)

Sounds like a good idea to me. Would you like to propose an initial patch?

Addressed by #119