-
Notifications
You must be signed in to change notification settings - Fork 2
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
Make DB timeout message more explicit #284
Make DB timeout message more explicit #284
Conversation
in order to avoid duplicate and redundant code
in order to print custom error message (retrieve `statement_timeout` from _config.json_ in tdp_publicdb)
* move require statement into function * use `===` * add missing semicolon * avoid object literal by using variable
and generalize error message
…db_timeout_message_explicit
otherwise html tags are printed out
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.
looks good to me. how could I reproduce this issue?
The steps to reproduce this issue are documented here |
Oh, sorry. didn't see the linked issue |
No problem. Sorry for documenting it in an unclear way! |
it was clearly documented, however I didn't check the connected issue ;) but I cannot reproduce the issue as described, because the query doesn't take 1 second to execute for me. however if it works for you, it also works for me. @thinkh , if you can reproduce the issue and the fix, we can merge |
@lehnerchristian You could also set the statement timeout to |
src/notifications.ts
Outdated
@@ -48,6 +48,9 @@ let errorAlertHandler = (error: any) => { | |||
if (error instanceof Response || error.response instanceof Response) { | |||
const xhr: Response = error instanceof Response ? error : error.response; | |||
return xhr.text().then((body: string) => { | |||
if (xhr.status === 408) { | |||
body = i18n.t('ordino_public:core.timeoutMessage'); |
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.
@dvvanessastoiber Using ordino_public
in tdp_core does not work.
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.
Fixes #258
Summary
sqlalchemy.exc.OperationalError
abort(408, error)
errorAlertHandler
in notifications.ts is extended to print custom error message:Since
i18n
is used, the error message can be further customized.