Skip to content

Commit

Permalink
error message is not alway 2
Browse files Browse the repository at this point in the history
  • Loading branch information
chadrik committed Jan 25, 2021
1 parent ff9418f commit b54c286
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/browser/components/MattermostView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,24 +198,25 @@ 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);
break;
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:
Expand Down

0 comments on commit b54c286

Please sign in to comment.