Skip to content

Better error handling for sendFile - #3582

Merged
dougwilson merged 1 commit into
expressjs:4.17from
thevoidf:better
Oct 27, 2018
Merged

Better error handling for sendFile#3582
dougwilson merged 1 commit into
expressjs:4.17from
thevoidf:better

Conversation

@thevoidf

Copy link
Copy Markdown
Contributor

so you don't get confusing errors like: function substring not found or something

@dougwilsondougwilson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Can you add a test that tests the condition in which you were encountering? That way we don't accidentally regress.

Comment threadlib/response.js Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, can you add back res.sendFile to the message? Helps people know what function the issue was to.

@thevoidf

Copy link
Copy Markdown
ContributorAuthor

if you pass something other than valid string like sendFile({}) you get: TypeError: path.substring is not a function. which is kind of confusing, so instead now you getting: path must be string

@dougwilson

Copy link
Copy Markdown
Contributor

Makes sense. Just add a test for that so we have it there to not regress from a refactor 👍

@thevoidf

Copy link
Copy Markdown
ContributorAuthor

@dougwilson all test are passing on my system

@LinusU

Copy link
Copy Markdown
Member

The build failures seemed unrelated, I restarted the two failed builds...

@dougwilsondougwilson added this to the 4.17 milestone Mar 12, 2018
@dougwilsondougwilson mentioned this pull request Oct 27, 2018
23 tasks
@dougwilson
dougwilson changed the base branch from master to 4.17October 27, 2018 06:17
@dougwilson
dougwilson merged commit 6bcdfef into expressjs:4.17Oct 27, 2018
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@thevoidf@dougwilson@LinusU