Skip to content

Emit request errors after aborted requests#4580

Open
puneetdixit200 wants to merge 1 commit into
hapijs:masterfrom
puneetdixit200:fix-aborted-error-events
Open

Emit request errors after aborted requests#4580
puneetdixit200 wants to merge 1 commit into
hapijs:masterfrom
puneetdixit200:fix-aborted-error-events

Conversation

@puneetdixit200
Copy link
Copy Markdown

Summary:

  • emit the public request error event when a late 500 error is produced after an aborted request has already finalized
  • reuse the same error-response logging helper for normal finalize and completed-response paths
  • add a regression test for a handler that throws after the client disconnects

Tests:

  • npm_config_cache=/tmp/hapi-npm-cache npx lab -a @hapi/code -m 5000 test/request.js -g "emits request-error when handler fails after abort|does not fail on abort|emits request-error once"
  • source ~/.nvm/nvm.sh && nvm use 18.20.8 >/dev/null && npm_config_cache=/tmp/hapi-npm-cache npx lab -a @hapi/code -m 5000 test/request.js -g "emits request-error when handler fails after abort|does not fail on abort|emits request-error once"
  • git diff --check

Fixes #4567

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.

Error-tracking software doesn't catch hapi application errors if an incoming request gets prematurely closed

1 participant