-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
917b5b3
commit ed19858
Showing
16 changed files
with
581 additions
and
529 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
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 |
---|---|---|
|
@@ -2,30 +2,49 @@ | |
import React from 'react'; | ||
import Alert from 'react-bootstrap/lib/Alert'; | ||
|
||
import type { APIErrorInfo } from '../flow/profileTypes'; | ||
|
||
export default class ErrorMessage extends React.Component { | ||
static propTypes = { | ||
errorInfo: React.PropTypes.object.isRequired, | ||
props: { | ||
errorInfo: APIErrorInfo, | ||
}; | ||
|
||
render() { | ||
const { errorInfo: {error_code: errorCode, user_message: userMessage} } = this.props; | ||
const { | ||
errorInfo: { | ||
error_code: errorCode, | ||
user_message: userMessage, | ||
detail, | ||
errorStatusCode, | ||
} | ||
} = this.props; | ||
|
||
let errorCodeStr = ''; | ||
let userMessageStr = ''; | ||
if (errorCode !== undefined) { | ||
errorCodeStr = `${errorCode}: `; | ||
} | ||
if (userMessage !== undefined) { | ||
userMessageStr = `Additional info: ${userMessage}`; | ||
} | ||
let errorCodeStr = () => { | ||
if ( errorCode !== undefined ) { | ||
return `${errorCode} `; | ||
} | ||
if ( errorStatusCode !== undefined ) { | ||
return `${errorStatusCode} `; | ||
} | ||
return ''; | ||
}; | ||
|
||
let userMessageStr = () => { | ||
if ( userMessage !== undefined ) { | ||
return `Additional info: ${userMessage}`; | ||
} | ||
if ( detail !== undefined ) { | ||
return `Additional info: ${detail}`; | ||
} | ||
return ''; | ||
}; | ||
|
||
return ( | ||
<div className="alert-message"> | ||
<Alert bsStyle="danger"> | ||
<p>{ errorCodeStr }Sorry, we were unable to load the data necessary to | ||
<p>{ errorCodeStr() }Sorry, we were unable to load the data necessary to | ||
process your request. Please reload the page.</p> | ||
<p>{ userMessageStr }</p> | ||
<p>{ userMessageStr() }</p> | ||
<p> | ||
If the error persists, please contact <a href="mailto:[email protected]"> | ||
[email protected]</a> specifying | ||
|
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
Oops, something went wrong.