0
0
Fork 0

Internationalize unexpected error message (#6887)

This commit is contained in:
Akihiko Odaki 2018-03-24 18:54:19 +09:00 committed by Eugen Rochko
parent 65c10c0bc8
commit 4e71b104e6
40 changed files with 109 additions and 5 deletions

View file

@ -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));
}
}
}