-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Fix for unhandled undefined config #4334
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
Changes from 1 commit
a877c85
94eb920
6db01b7
e62b88a
d245d0f
b64beae
9ce201c
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 |
---|---|---|
|
@@ -15,7 +15,7 @@ export class PublicAPIRouter extends PromiseRouter { | |
const appId = req.params.appId; | ||
const config = Config.get(appId); | ||
|
||
if (!config.publicServerURL) { | ||
if (!config || !config.publicServerURL) { | ||
return this.missingPublicServerURL(); | ||
} | ||
|
||
|
@@ -40,7 +40,7 @@ export class PublicAPIRouter extends PromiseRouter { | |
const appId = req.params.appId; | ||
const config = Config.get(appId); | ||
|
||
if (!config.publicServerURL) { | ||
if (!config || !config.publicServerURL) { | ||
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. Same here |
||
return this.missingPublicServerURL(); | ||
} | ||
|
||
|
@@ -66,7 +66,7 @@ export class PublicAPIRouter extends PromiseRouter { | |
changePassword(req) { | ||
return new Promise((resolve, reject) => { | ||
const config = Config.get(req.query.id); | ||
if (!config.publicServerURL) { | ||
if (!config || !config.publicServerURL) { | ||
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. and here |
||
return resolve({ | ||
status: 404, | ||
text: 'Not found.' | ||
|
@@ -89,7 +89,7 @@ export class PublicAPIRouter extends PromiseRouter { | |
|
||
const config = req.config; | ||
|
||
if (!config.publicServerURL) { | ||
if (!config || !config.publicServerURL) { | ||
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. same |
||
return this.missingPublicServerURL(); | ||
} | ||
|
||
|
@@ -114,7 +114,7 @@ export class PublicAPIRouter extends PromiseRouter { | |
|
||
const config = req.config; | ||
|
||
if (!config.publicServerURL) { | ||
if (!config || !config.publicServerURL) { | ||
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. same |
||
return this.missingPublicServerURL(); | ||
} | ||
|
||
|
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.
Would you be willing to update this to handle
!config
separately? We would like to throw an exception rather than return a standard 404. Something like this should doUh oh!
There was an error while loading. Please reload this page.
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.
following in middleware.js if appId can't be found, this should be
The error will be handled by the PromiseRouter and transformed in to the proper response.
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.
Ahh, didn't see that initially. @bryandel take flovilmart's suggestion for the proper error to report.