-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1008 from amazeeio/987-better-ui-api-error-handling
Better UI/API error handling
- Loading branch information
Showing
26 changed files
with
525 additions
and
452 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from 'react'; | ||
import ErrorPage from 'pages/_error'; | ||
|
||
export default ({ variables }) => ( | ||
<ErrorPage | ||
statusCode={404} | ||
errorMessage={`Deployment "${variables.deploymentName}" not found`} | ||
/> | ||
); |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from 'react'; | ||
import ErrorPage from 'pages/_error'; | ||
|
||
export default ({ variables }) => ( | ||
<ErrorPage | ||
statusCode={404} | ||
errorMessage={`Environment "${variables.openshiftProjectName}" not found`} | ||
/> | ||
); |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from 'react'; | ||
import ErrorPage from 'pages/_error'; | ||
|
||
export default ({ variables }) => ( | ||
<ErrorPage | ||
statusCode={404} | ||
errorMessage={`Project "${variables.name}" not found`} | ||
/> | ||
); |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import React from 'react'; | ||
import ErrorPage from 'pages/_error'; | ||
|
||
export default ({ error }) => ( | ||
<ErrorPage statusCode={500} errorMessage={error.toString()} /> | ||
); |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from 'react'; | ||
import ErrorPage from 'pages/_error'; | ||
|
||
export default ({ variables }) => ( | ||
<ErrorPage | ||
statusCode={404} | ||
errorMessage={`Task "${variables.taskId}" not found`} | ||
/> | ||
); |
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
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import * as R from 'ramda'; | ||
import branch from 'recompose/branch'; | ||
import renderComponent from 'recompose/renderComponent'; | ||
|
||
export default (predicate, component) => | ||
branch(props => predicate(props), renderComponent(component)); |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import * as R from 'ramda'; | ||
import EnvironmentNotFound from 'components/errors/EnvironmentNotFound'; | ||
import TaskNotFound from 'components/errors/TaskNotFound'; | ||
import DeploymentNotFound from 'components/errors/DeploymentNotFound'; | ||
import ProjectNotFound from 'components/errors/ProjectNotFound'; | ||
import renderWhile from 'lib/renderWhile'; | ||
|
||
const noProp = R.complement(R.prop); | ||
const noEnvironmentData = noProp('environment'); | ||
const noProjectData = noProp('project'); | ||
|
||
export const withEnvironmentRequired = renderWhile( | ||
({ data }) => noEnvironmentData(data), | ||
EnvironmentNotFound | ||
); | ||
|
||
export const withTaskRequired = renderWhile( | ||
({ data: { environment } }) => !environment.tasks.length, | ||
TaskNotFound | ||
); | ||
|
||
export const withDeploymentRequired = renderWhile( | ||
({ data: { environment } }) => !environment.deployments.length, | ||
DeploymentNotFound | ||
); | ||
|
||
export const withProjectRequired = renderWhile( | ||
({ data }) => noProjectData(data), | ||
ProjectNotFound | ||
); |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import QueryError from 'components/errors/QueryError'; | ||
import renderWhile from 'lib/renderWhile'; | ||
|
||
export default renderWhile( | ||
({ error }) => error, | ||
QueryError | ||
); |
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import LoadingPage from 'pages/_loading'; | ||
import renderWhile from 'lib/renderWhile'; | ||
|
||
export default renderWhile( | ||
({ loading }) => loading, | ||
LoadingPage | ||
); |
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.