Improve error display cross-browsers, and add translatable string

pull/4318/head
Thibaud Colas 2018-04-02 19:03:06 +03:00
rodzic 411895e450
commit 7238f22ebd
4 zmienionych plików z 7 dodań i 3 usunięć

Wyświetl plik

@ -83,7 +83,7 @@ class EditorFallback extends PureComponent {
className="Draftail-ToolbarButton"
onClick={this.toggleError}
>
{'Show error'}
{STRINGS.SHOW_ERROR}
</button>
{/* At first we propose reloading the editor. If it still crashes, reload the whole page. */}
@ -122,7 +122,7 @@ class EditorFallback extends PureComponent {
{showError && (
<pre className="help-block help-critical">
<code className="EditorFallback__error">
{`${error.stack}\n${info.componentStack}`}
{`${error.name}: ${error.message}\n\n${error.stack}\n${info.componentStack}`}
</code>
</pre>
)}

Wyświetl plik

@ -88,7 +88,9 @@ exports[`EditorFallback #error #showError 1`] = `
<code
className="EditorFallback__error"
>
test stack
Error: test
test stack
test
</code>
</pre>

Wyświetl plik

@ -39,6 +39,7 @@ global.wagtailConfig = {
RELOAD_PAGE: 'Reload the page',
RELOAD_EDITOR: 'Reload saved content',
SHOW_LATEST_CONTENT: 'Show latest content',
SHOW_ERROR: 'Show error',
EDITOR_CRASH: 'The editor just crashed. Content has been reset to the last saved version.',
},
};

Wyświetl plik

@ -47,6 +47,7 @@
RELOAD_PAGE: "{% trans 'Reload the page' %}",
RELOAD_EDITOR: "{% trans 'Reload saved content' %}",
SHOW_LATEST_CONTENT: "{% trans 'Show latest content' %}",
SHOW_ERROR: "{% trans 'Show error' %}",
EDITOR_CRASH: "{% trans 'The editor just crashed. Content has been reset to the last saved version.' %}",
};