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 27fa705
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/browser/components/MattermostView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,26 +198,26 @@ 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:
console.log(message);
break;
Expand Down

0 comments on commit 27fa705

Please sign in to comment.