Improve command error reporting

state.error is expected to be a String, not an Error.
This commit is contained in:
Simon Ser 2021-05-27 11:26:42 +02:00
parent d5e21097f8
commit b8c4bb3112
2 changed files with 3 additions and 3 deletions

View file

@ -160,7 +160,7 @@ export default {
try { try {
msg = irc.parseMessage(args.join(" ")); msg = irc.parseMessage(args.join(" "));
} catch (err) { } catch (err) {
throw new Error("failed to parse IRC command: " + err.message); throw new Error("Failed to parse IRC command: " + err.message);
} }
getActiveClient(app).send(msg); getActiveClient(app).send(msg);
}, },

View file

@ -945,8 +945,8 @@ export default class App extends Component {
try { try {
cmd.execute(this, args); cmd.execute(this, args);
} catch (error) { } catch (error) {
console.error("Failed to execute command '" + name + "'", error); console.error("Failed to execute command '" + name + "':", error);
this.setState({ error }); this.setState({ error: error.message });
} }
} }