Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Commit

Permalink
Add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
abitofevrything committed May 3, 2022
1 parent 438a40c commit 953c7e1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/src/internal/interaction_endpoints.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:convert';

import 'package:logging/logging.dart';
import 'package:nyxx/nyxx.dart';
import 'package:nyxx/src/core/message/message.dart';
import 'package:nyxx_interactions/nyxx_interactions.dart';
Expand Down Expand Up @@ -93,6 +94,8 @@ class InteractionsEndpoints implements IInteractionsEndpoints {
final INyxx _client;
final Interactions _interactions;

final Logger _logger = Logger('Interactions');

InteractionsEndpoints(this._client, this._interactions);

@override
Expand Down Expand Up @@ -395,10 +398,12 @@ class InteractionsEndpoints implements IInteractionsEndpoints {
// 10066 = Unknown application command permissions
// Means there are no overrides for this command... why is this an error, Discord?
if (jsonDecode(response.errorMessage)['code'] == 10066) {
_logger.finest('Got error code 10066 on permissions for command $commandId in guild $guildId, returning empty permission overrides.');
return SlashCommandPermissionOverrides.empty(commandId, _client);
}
} on Exception {
// We got invalid JSON. The request is probably invalid, so we ignore it and return an error.
_logger.warning('Invalid JSON in response: ${response.errorMessage}');
}

return Future.error(response);
Expand Down

0 comments on commit 953c7e1

Please sign in to comment.