finalhandler icon indicating copy to clipboard operation
finalhandler copied to clipboard

fix: Error w/ `cause` stack

Open coltonehrman opened this issue 1 year ago • 4 comments

To replace: https://github.com/pillarjs/finalhandler/pull/49

The cause stack in the Error class was not included in the response text.

This uses the native util.format() API to log out the Error stack, which includes the cause. This is essentially the same as console.[error|log]() for an Error.

This PR closes https://github.com/expressjs/express/issues/5630 This PR closes https://github.com/pillarjs/finalhandler/issues/41

coltonehrman avatar Aug 11 '24 00:08 coltonehrman

It seems like an existing test case was already failing on master.

1 failing

  1) finalhandler(req, res)
       404 response
         should encode bad pathname characters:

      AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

400 !== 404

      + expected - actual

      -400
      +404
      
      at IncomingMessage.onend (test/support/utils.js:79:20)
      at IncomingMessage.emit (node:events:532:35)
      at endReadableNT (node:internal/streams/readable:1696:12)
      at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

coltonehrman avatar Aug 11 '24 00:08 coltonehrman

Error: Parse Error: Expected HTTP/

I have been seeing this error with supertest in a bunch of places. This is the first time it is consistent and happening in CI though. I dont think this is becaues of your changes, but I am going to push a change to make these run in serial which is the way I have fixed this in other libs. I assume superagent is broken, but I don't have time to debug that.

wesleytodd avatar Aug 31 '24 18:08 wesleytodd

Oh, weird, it is more than just that. This is breaking because of something in this pr. I think it is the underlying error I mentioned, but then causing tests to fail in a bad way because of it.

I think we are going to need to fix these. If you get a chance to look at them let me know. If not, then I might have to publish 2.0 before we can merge this. Ideally though we can land this as a minor.

wesleytodd avatar Aug 31 '24 18:08 wesleytodd

Oh, weird, it is more than just that. This is breaking because of something in this pr. I think it is the underlying error I mentioned, but then causing tests to fail in a bad way because of it.

I think we are going to need to fix these. If you get a chance to look at them let me know. If not, then I might have to publish 2.0 before we can merge this. Ideally though we can land this as a minor.

I'm fine with either way. I can wait for 2.0.

I'm not sure what the issues might be related to this PR. It is basically a 1 line change (not accounting for the changes you added).

coltonehrman avatar Sep 10 '24 19:09 coltonehrman

Hey! was deleting this intentional? I think we would like to have landed something like this so unless you didn't want us to take this PR I would love to see you re-open it.

wesleytodd avatar Jan 08 '25 16:01 wesleytodd