-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add async support to Bun.serve onError #8233
feat: Add async support to Bun.serve onError #8233
Conversation
) void { | ||
var vm = ctx.server.vm; | ||
|
||
switch (promise.status(vm.global.vm())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a copy of what RequestContext.onResponse
is doing. I'm not sure if this is the correct way of handling the promise.
{ | ||
ctx.flags.is_error_promise_pending = true; | ||
ctx.pending_promises_for_abort += 1; | ||
promise_js.then( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added new callbacks for the error resolve/reject but realized that using onResolve
/ onError
is working fine due to the deduplication check in runErrorHandlerWithStatusCodeDontCheckResponded
.
Many many thanks again @LukasKastern Vielen Dank 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Thank you
* WIP * Support not immediately fullfilled promises * Typo * Add tests * Fix test * Rename test * Remove file * [autofix.ci] apply automated fixes --------- Co-authored-by: Jarred Sumner <jarred@jarredsumner.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
What does this PR do?
Handle promise returned from onError.
Fixes: #8217
How did you verify your code works?
I wrote automated tests