Skip to content

Commit

Permalink
Add stack_trace
Browse files Browse the repository at this point in the history
  • Loading branch information
PlugFox committed Jul 23, 2023
1 parent f38b98f commit 9a113de
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
"centrifugo",
"gentoken",
"--user=dart",
"--ttl=604800000" // 604800
"--ttl=604800"
],
"group": {
"kind": "none",
Expand Down
2 changes: 1 addition & 1 deletion examples/console/bin/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void main([List<String>? args]) {
// e.g. `client.states.connected`
client.states.listen((state) => print('State changed to: $state'));

// Handle all centrifuge errors.
// Handle all centrifuge exceptions.
client.errors.listen(
(error) => print(
'Exception: ${error.exception}, '
Expand Down
8 changes: 7 additions & 1 deletion lib/src/client/centrifuge.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:centrifuge_dart/src/transport/transport_interface.dart';
import 'package:centrifuge_dart/src/transport/ws_protobuf_transport.dart';
import 'package:centrifuge_dart/src/util/logger.dart' as logger;
import 'package:meta/meta.dart';
import 'package:stack_trace/stack_trace.dart' as st;

/// {@template centrifuge}
/// Centrifuge client.
Expand Down Expand Up @@ -74,7 +75,12 @@ base mixin CentrifugeErrorsMixin on CentrifugeBase {
@protected
@nonVirtual
void _emitError(CentrifugeException exception, StackTrace stackTrace) =>
_errorsController.add((exception: exception, stackTrace: stackTrace));
_errorsController.add(
(
exception: exception,
stackTrace: st.Trace.from(stackTrace).terse,
),
);

late final StreamController<
({CentrifugeException exception, StackTrace stackTrace})>
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ dependencies:
# Utilities
crypto: ^3.0.3
fixnum: ^1.1.0
stack_trace: ^1.11.1

dev_dependencies:
build_runner: ^2.4.6
Expand Down

0 comments on commit 9a113de

Please sign in to comment.