Skip to content

Make sure sendError sends ErrorResponse when serviceClient#28

Open
alt-romes wants to merge 1 commit intomasterfrom
wip/romes/27
Open

Make sure sendError sends ErrorResponse when serviceClient#28
alt-romes wants to merge 1 commit intomasterfrom
wip/romes/27

Conversation

@alt-romes
Copy link
Copy Markdown
Collaborator

sendError should throw an error which interrupts the request/response cycle with an ErrorResponse.

However, the deadlock fix in 813e665 introduced a bug where we no longer ever send an ErrorResponse when sendError, just crashing the client-connection thread with an error instead.

There are two main situations in which we want to run an Adaptor s r a:

  • When r == (), when unlifting Adaptor for the threads registered in registerNewDebugSession
  • When r == Request, which means we're responding to a Request.

In the former case, there's no well-defined meaning for the sendError thrown error, since we're not responding to any Request -- so we just error on those uncaught errors. OK.

In the latter case, there IS a well-defined meaning for the sendError errors: reply with an ErrorResponse to the client.

Fixes #27

`sendError` should throw an error which interrupts the request/response
cycle with an `ErrorResponse`.

However, the deadlock fix in 813e665
introduced a bug where we no longer ever send an ErrorResponse when
`sendError`, just crashing the client-connection thread with an `error`
instead.

There are two main situations in which we want to run an `Adaptor s r a`:

- When `r == ()`, when unlifting `Adaptor` for the threads registered in `registerNewDebugSession`
- When `r == Request`, which means we're responding to a `Request`.

In the former case, there's no well-defined meaning for the `sendError`
thrown error, since we're not responding to any `Request` -- so we just
`error` on those uncaught errors. OK.

In the latter case, there IS a well-defined meaning for the `sendError`
errors: reply with an `ErrorResponse` to the client.

Fixes #27
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.

sendError won't send ErrorResponse on error

2 participants