-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…dling Feature/#257 classic api error handling
- Loading branch information
Showing
40 changed files
with
1,103 additions
and
712 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,6 +101,9 @@ ENV/ | |
.vscode | ||
settings.json | ||
|
||
# PyCharm | ||
.idea | ||
|
||
# mypy | ||
.mypy_cache/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,30 +116,30 @@ def search(request_params: MultiDict) -> Response: | |
# template rendering, so they get added directly to the | ||
# response content. asdict( | ||
response_data.update(SearchSession.search(q)) # type: ignore | ||
except index.IndexConnectionError as e: | ||
except index.IndexConnectionError as ex: | ||
# There was a (hopefully transient) connection problem. Either | ||
# this will clear up relatively quickly (next request), or | ||
# there is a more serious outage. | ||
logger.error('IndexConnectionError: %s', e) | ||
logger.error('IndexConnectionError: %s', ex) | ||
raise InternalServerError( | ||
"There was a problem connecting to the search index. This " | ||
"is quite likely a transient issue, so please try your " | ||
"search again. If this problem persists, please report it " | ||
"to [email protected]." | ||
) from e | ||
except index.QueryError as e: | ||
) from ex | ||
except index.QueryError as ex: | ||
# Base exception routers should pick this up and show bug page. | ||
logger.error('QueryError: %s', e) | ||
logger.error('QueryError: %s', ex) | ||
raise InternalServerError( | ||
"There was a problem executing your query. Please try " | ||
"your search again. If this problem persists, please " | ||
"report it to [email protected]." | ||
) from e | ||
except index.OutsideAllowedRange as e: | ||
) from ex | ||
except index.OutsideAllowedRange as ex: | ||
raise BadRequest( | ||
"Hello clever friend. You can't get results in that range" | ||
" right now." | ||
) from e | ||
) from ex | ||
response_data['query'] = q | ||
else: | ||
logger.debug('form is invalid: %s', str(form.errors)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.