Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Handle error on detector detail pages #173

Merged

Conversation

ohltyler
Copy link
Contributor

@ohltyler ohltyler commented May 21, 2020

Issue #, if available: #172

Description of changes:

Handles errors when an invalid detector id is passed to the detector detail pages (results and configuration pages). This could be caused by changing the url directly, or refreshing a stale page if the detector has been deleted in another window.

Before (infinite loading state):
Screen Shot 2020-05-21 at 12 24 06 PM

After (redirects to detector list page, toast displaying error):
Screen Shot 2020-05-21 at 12 24 49 PM

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@@ -94,7 +94,7 @@ const reducer = handleActions<Detectors>(
FAILURE: (state: Detectors, action: APIErrorAction): Detectors => ({
...state,
requesting: false,
errorMessage: action.error.data.error,
errorMessage: action.error,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line here was causing an exception. data was undefined, which caused the error to be thrown. Because of this, the ad state never got out of requesting and was preventing the detector details pages from handling the error and redirecting to the detector list page.

@ohltyler ohltyler linked an issue May 21, 2020 that may be closed by this pull request
@ohltyler ohltyler merged commit 87482fd into opendistro-for-elasticsearch:master May 21, 2020
ohltyler added a commit that referenced this pull request May 22, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle infinite loading state on detector detail pages
3 participants