Skip to content

Commit

Permalink
fix(rpc): Exception are transformed to rpc Failures.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chralu committed Jun 20, 2024
1 parent 37a2d45 commit 70c7625
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/domain/rpc/command_dispatcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class CommandDispatcher {
.handle(command.command)
.then(
command.completer.complete,
onError: (error) => command.completer.complete(Result.failure(error)),
onError: command.completer.completeError,
)
.whenComplete(_process);
}
Expand Down
3 changes: 3 additions & 0 deletions lib/infrastructure/rpc/dto/rpc_command_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ abstract class RPCCommandHandler<C, R> {
} on TypeError catch (e, stack) {
_logger.severe('Invalid data', e, stack);
return const Result.failure(awc.Failure.invalidParams);
} catch (e, stack) {
_logger.severe('Command failed', e, stack);
return const Result.failure(awc.Failure.other);
}
}
}
Expand Down

0 comments on commit 70c7625

Please sign in to comment.