Skip to content

fix: Remove 500 error if file not found#56

Open
virus2016 wants to merge 1 commit intothgh:masterfrom
virus2016:master
Open

fix: Remove 500 error if file not found#56
virus2016 wants to merge 1 commit intothgh:masterfrom
virus2016:master

Conversation

@virus2016
Copy link
Copy Markdown

@virus2016 virus2016 commented Mar 11, 2020

Tested that fallback works as expected.

@virus2016
Copy link
Copy Markdown
Author

#43 This should fix this one ;-)

Comment on lines -38 to -45
if (error.code !== 'ENOENT') {
response.writeHead(500)
response.end('500 Internal Server Error' +
'\n\n' + filePath +
'\n\n' + Object.values(error).join('\n') +
'\n\n(rollup-plugin-serve)', 'utf-8')
return
}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This code was originally added to make a difference between 404 and other errors. By removing it, there are only 404s. How about changing the order instead:

if (!error) ...
-if (error.code !== 'ENOENT') ...
if (options.historyApiFallback) ...
+if (error.code !== 'ENOENT') ...
notFound()

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.

2 participants