-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved error handling #178
base: main
Are you sure you want to change the base?
Conversation
@@ -8,6 +8,9 @@ | |||
<div class="tagline"> | |||
<h1><%- template('error.500.heading') %></h1> | |||
<p><%- template('error.500.message') %></p> | |||
<% if (locals.isDev && locals.err && locals.err.message) { %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Should we include the full trace here, too?
server/routes/errors.js
Outdated
@@ -65,6 +65,7 @@ module.exports = async (err, req, res, next) => { | |||
const inlined = await loadInlineAssets() | |||
res.status(code).render(`errors/${code}`, { | |||
inlineCSS: inlined.css, | |||
isDev: process.env.NODE_ENV === 'development', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -57,6 +59,12 @@ async function handlePage(req, res) { | |||
|
|||
if (page === 'categories' || page === 'index') { | |||
const tree = await getTree() | |||
if (!tree.children) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 This signal is great. It also seems like we could easily make this nonfatal (log, but have the library site be empty) if we wanted.
server/utils.js
Outdated
const level = fs.existsSync(customPath) ? 'warn' : 'debug' | ||
log[level](`Failed pulling in custom file ${attemptPath} @ ${customPath}. Error was:`, err) | ||
// with no stacktrace. | ||
const fileExists = fs.existsSync(customPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 This also seems like a useful signal. Let's make sure it merges cleanly with the other open PR for this case, https://github.com/nytimes/library/pull/202/files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These all seem like great usability improvements, thanks for tackling @afischer!
It looks like we have some merge conflicts, once we resolve those I think these will be great additions 👏
Still in progress, but feel free to comment!
Description of Change
clientSecret
andclientId
in dev mode to avoid having to set them in your .envTodo:
Related Issue
Closes #62, closes #63
Checklist
npm run lint
and updated code style accordinglynpm run test
passes