Skip to content

serve: change error mgmt#181

Merged
rgrinberg merged 1 commit into
masterfrom
error-handler
Dec 18, 2016
Merged

serve: change error mgmt#181
rgrinberg merged 1 commit into
masterfrom
error-handler

Conversation

@vbmithr
Copy link
Copy Markdown
Member

@vbmithr vbmithr commented Dec 15, 2016

For Tezos, we need a way that server exception are not sent to async_exception_hook, because we want to filter them otherwise we could not differentiate them from similar exceptions coming from another part of the program.

@rgrinberg
Copy link
Copy Markdown
Member

Looks fine, but I think this hook should return a unit. This should signify to users that we are never waiting for its result.

Also I'd prefer a name like on_exn, but perhaps I'm bikeshedding that.

@rgrinberg
Copy link
Copy Markdown
Member

This looks good to me. I'll wait for a couple of days to give others a chance to review and unless there's feedback will merge.

Copy link
Copy Markdown
Contributor

@yomimono yomimono left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems fine to me once nits are picked (but I'm not an lwt expert).

Comment thread lib/conduit_lwt_unix.ml Outdated
Lwt.catch
(fun () -> callback flow ic oc)
(fun exn -> !Lwt.async_exception_hook exn; Lwt.return_unit)
(fun exn -> exn_hook exn; Lwt.return_unit)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this exn_hook needs to be on_exn.

Comment thread lib/conduit_lwt_unix.mli Outdated
client connection and the associated input {!ic} and output
{!oc} channels. If the callback raises an exception, it is
passed to [!Lwt.async_exception_hook]. *)
(** [serve ?backlog ?timeout ?stop ?exn_hook ~ctx ~mode fn]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If exn_hook is renamed in conduit_lwt_unix.ml, it should be here too.

Comment thread lib/conduit_lwt_unix.mli Outdated
[fn] callback is passed the {!flow} representing the client
connection and the associated input {!ic} and output {!oc}
channels. If the callback raises an exception, it is passed to
[exn_hook] (by default, to !Lwt.async_exception_hook). *)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another dangling exn_hook that should be on_exn.

@vbmithr
Copy link
Copy Markdown
Member Author

vbmithr commented Dec 16, 2016

Thanks Mindy :)

@rgrinberg rgrinberg merged commit caff61a into master Dec 18, 2016
@rgrinberg rgrinberg deleted the error-handler branch December 18, 2016 02:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants