Internationalize unexpected error message (#6887)
This commit is contained in:
parent
65c10c0bc8
commit
4e71b104e6
40 changed files with 109 additions and 5 deletions
|
@ -1,7 +1,13 @@
|
|||
import { defineMessages } from 'react-intl';
|
||||
import { showAlert } from '../actions/alerts';
|
||||
|
||||
const defaultFailSuffix = 'FAIL';
|
||||
|
||||
const messages = defineMessages({
|
||||
unexpectedTitle: { id: 'alert.unexpected.title', defaultMessage: 'Oops!' },
|
||||
unexpectedMessage: { id: 'alert.unexpected.message', defaultMessage: 'An unexpected error occurred.' },
|
||||
});
|
||||
|
||||
export default function errorsMiddleware() {
|
||||
return ({ dispatch }) => next => action => {
|
||||
if (action.type && !action.skipAlert) {
|
||||
|
@ -21,7 +27,7 @@ export default function errorsMiddleware() {
|
|||
dispatch(showAlert(title, message));
|
||||
} else {
|
||||
console.error(action.error);
|
||||
dispatch(showAlert('Oops!', 'An unexpected error occurred.'));
|
||||
dispatch(showAlert(messages.unexpectedTitle, messages.unexpectedMessage));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue