Skip to content

Commit

Permalink
Fix error logging (#23)
Browse files Browse the repository at this point in the history
* Error logging was causing an unhandled exception

* Bump version

* Update actions versions
  • Loading branch information
cnsumner authored Mar 29, 2023
1 parent 9b3384d commit 2feab5b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v2.7.0
- name: Install dependencies
run: dart pub get
- name: Build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v2.7.0
- name: Install dependencies
run: dart pub get
- name: Build
Expand Down
10 changes: 5 additions & 5 deletions lib/huldra.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ class Huldra {
var channel = await e.message.channel.getOrDownload();

if (reply.compareTo(e.message.content) != 0) {
await channel
.sendMessage(MessageBuilder.content(reply))
.catchError((error) {
try {
await channel.sendMessage(MessageBuilder.content(reply));
} catch (error) {
print(
'[${DateTime.now().toUtc().toIso8601String()}]: Encountered error [$error] while sending response to message [${e.message.id.toString()} in channel [${channel.id.toString()}]');
});
'[${DateTime.now().toUtc().toIso8601String()}]: Encountered error [$error] while sending response to message [${e.message.id.toString()}] in channel [${channel.id.toString()}]');
}
} else {
reply = await Markov.generate([]);
await channel.sendMessage(MessageBuilder.content(reply));
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: huldra
description: A deranged discord bot.
version: 0.9.10
version: 0.9.11

environment:
sdk: ">=2.17.0 <3.0.0"
Expand Down

0 comments on commit 2feab5b

Please sign in to comment.