HTTP error if code in error NaN
See original GitHub issueHTTP error if code in error NaN
After update to 20.. if server throw new Error()
with code: NaN
throws unhandled promise rejection. Logs:
(node:803571) UnhandledPromiseRejectionWarning: RangeError [ERR_HTTP_INVALID_STATUS_CODE]: Invalid status code: NaN
at ServerResponse.writeHead (_http_server.js:209:11)
at WebServer.sendWithCompression (/project/node_modules/actionhero/servers/web.js:259:38)
at WebServer.sendMessage (/project/node_modules/actionhero/servers/web.js:119:10)
at WebServer.completeResponse (/project/node_modules/actionhero/servers/web.js:394:10)
at process._tickCallback (internal/process/next_tick.js:68:7)
- ActionHero Version:
20.0.0
- Node.js Version:
10.15.1
- Operating System:
Arch Linux
Steps to reproduce your error
- Throw new Error with
code: NaN
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
JavaScript simple "error-handling" by replacing NaN with ...
I was wondering how I can detect false input type and instead of presenting the user with NaN, have a logical ...
Read more >NaN - JavaScript - MDN Web Docs
To tell if a value is NaN , use Number.isNaN() or isNaN() to most clearly determine whether a value is NaN — or,...
Read more >I am getting a NaN error. What does this mean? - Codecademy
Nan means “Not a number”, this is because inside your cube function, you're not calling the square function, but getting it's contents. Change...
Read more >HTTP Status Codes: All 63 explained - including FAQ & Video
HTTP status codes are three-digit responses from the server to the browser-side request. Everyone has probably gotten the classic 404 page-not-found error.
Read more >json.dumps allows NaN values in JSON by default, which is ...
... the API's parser can't process that, so the client will get back an HTTP 400 error if a NaN value is accidentally...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think I’m still confused about how you found this state. Can you please provide a sample action that reproduces this behavior?
If you were to make an error in an action with a non-intenger code, i.e.
it would still fail the numeric range check https://github.com/actionhero/actionhero/blob/master/servers/web.js#L347-L363 and
isValidCustomResponseCode
would be false, so we would just return a HTTP status code of 500 (line 358)@evantahler seems all work fine. I can’t reproduce this error. Sorry and thanks