From b8c4bb3112c4d7ad7667f03dd70bf3a31669ad4b Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 27 May 2021 11:26:42 +0200 Subject: [PATCH] Improve command error reporting state.error is expected to be a String, not an Error. --- commands.js | 2 +- components/app.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/commands.js b/commands.js index ba6b4c6..bd61c4d 100644 --- a/commands.js +++ b/commands.js @@ -160,7 +160,7 @@ export default { try { msg = irc.parseMessage(args.join(" ")); } 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); }, diff --git a/components/app.js b/components/app.js index 6d3b706..7b30b95 100644 --- a/components/app.js +++ b/components/app.js @@ -945,8 +945,8 @@ export default class App extends Component { try { cmd.execute(this, args); } catch (error) { - console.error("Failed to execute command '" + name + "'", error); - this.setState({ error }); + console.error("Failed to execute command '" + name + "':", error); + this.setState({ error: error.message }); } }