-
Notifications
You must be signed in to change notification settings - Fork 25
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
fix: add a link to a github issue when themes are missing #37
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -54,7 +54,7 @@ export default async function handler(req, res) { | |||||||||||||
const formatter = FORMATTERS[fileType]; | ||||||||||||||
|
||||||||||||||
if (!formatter) { | ||||||||||||||
return res.status(200).send(failMessage('not supported formatted')); | ||||||||||||||
return res.status(200).send(failMessage('not supported formatter')); | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
if ( | ||||||||||||||
|
@@ -172,7 +172,17 @@ ${JSON.stringify(validation.errors, null, 2)} | |||||||||||||
try { | ||||||||||||||
formatted = await formatter.format(selectedResume, options); | ||||||||||||||
} catch (e) { | ||||||||||||||
console.log(e); | ||||||||||||||
// @todo - do this better | ||||||||||||||
if (e.message === 'theme-missing') { | ||||||||||||||
return res | ||||||||||||||
.status(200) | ||||||||||||||
.send( | ||||||||||||||
failMessage( | ||||||||||||||
'This theme is currently unsupported. Please visit this Github issue to request it https://github.com/jsonresume/jsonresume.org/issues/36 (unfortunately we have recently (11/2023) disabled a bunch of legacy themes due to critical flaws in them, please request if you would like them back.)' | ||||||||||||||
) | ||||||||||||||
); | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
return res | ||||||||||||||
.status(200) | ||||||||||||||
.send( | ||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The HTTP status code for the generic error message should also reflect an error condition. Consider using a 4xx or 5xx status code to indicate client or server errors, respectively. - .status(200)
+ .status(500) // or another appropriate error code Committable suggestion
Suggested change
|
||||||||||||||
|
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.
The addition of a custom error message for the "theme-missing" error is a good enhancement for user feedback. However, the HTTP status code 200 is not appropriate for an error condition. Consider using a 4xx status code to indicate client-side errors.
Committable suggestion