diff --git a/src/browser/components/MattermostView.jsx b/src/browser/components/MattermostView.jsx index 0e4ac2f8f23..1baa87e99aa 100644 --- a/src/browser/components/MattermostView.jsx +++ b/src/browser/components/MattermostView.jsx @@ -198,7 +198,16 @@ export default class MattermostView extends React.Component { webview.addEventListener('console-message', (e) => { const message = `[${this.props.name}] ${e.message}`; - console.log(`[${this.props.name}] got error: ${e.message} ${e.level}`); + + const retryUrl = extractURL(e.message); + console.log(`[${this.props.name}] url: ${retryUrl}`); + if (retryUrl) { + if (!shell.openExternal(decodeURI(retryUrl))) { + console.log(`[${this.props.name}] shell.openExternal failed: ${retryUrl}`); + } + return; + } + switch (e.level) { case 0: console.log(message); @@ -206,18 +215,9 @@ export default class MattermostView extends React.Component { case 1: console.warn(message); break; - case 2: { - const retryUrl = extractURL(e.message); - console.log(`[${this.props.name}] url: ${retryUrl}`); - if (retryUrl) { - if (!shell.openExternal(decodeURI(retryUrl))) { - console.log(`[${this.props.name}] shell.openExternal failed: ${retryUrl}`); - } - } else { - console.error(message); - } + case 2: + console.error(message); break; - } default: console.log(message); break;