Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nullability of tracking id #6

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 1.2.1
- Fix nullability of trackingId in error handler

## 1.2.0
- Use `trackable` package
- UnexpectedError is now implementing GeneralTrackableError.
Expand Down
2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class CounterBloc extends SafeBloc<CounterEvent, CounterState> {
CounterState Function(UnexpectedError error) get errorState => CounterBlocError.new;

@override
Future<void> onUnexpectedError(Object? error, StackTrace stackTrace, String? trackingId) async {
Future<void> onUnexpectedError(Object? error, StackTrace stackTrace, String trackingId) async {
if (kDebugMode) {
print('Exception: $error, $stackTrace');
}
Expand Down
6 changes: 3 additions & 3 deletions lib/src/safe_bloc_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ abstract class SafeBlocBase<STATE, EFFECT> extends BlocBase<STATE>

/// A method that is called each time the exception in the inherited Bloc or Cubit is thrown.
@protected
Future<void> onUnexpectedError(Object? error, StackTrace stackTrace, String? trackingId) {
Future<void> onUnexpectedError(Object? error, StackTrace stackTrace, String trackingId) {
return Future.value();
}
}
Expand All @@ -34,9 +34,9 @@ typedef SyncCallback = void Function(String trackingId);

typedef OnIgnoreError = Future<void> Function(Object? error, StackTrace stackTrace);

typedef OnError = Future<void> Function(Object? error, StackTrace stackTrace, String? trackingId);
typedef OnError = Future<void> Function(Object? error, StackTrace stackTrace, String trackingId);

typedef OnErrorSync = void Function(Object? error, StackTrace stackTrace, String? trackingId);
typedef OnErrorSync = void Function(Object? error, StackTrace stackTrace, String trackingId);

typedef ErrorMapper<STATE> = STATE? Function(Object error);

Expand Down
2 changes: 1 addition & 1 deletion lib/src/safe_bloc_with_presentation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,5 @@ abstract class SafeBlocWithPresentation<EVENT, STATE, EFFECT> extends Bloc<EVENT
}

@override
Future<void> onUnexpectedError(Object? error, StackTrace stackTrace, String? trackingId) => Future.value();
Future<void> onUnexpectedError(Object? error, StackTrace stackTrace, String trackingId) => Future.value();
}
2 changes: 1 addition & 1 deletion lib/src/safe_cubit_with_presentation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ abstract class SafeCubitWithPresentation<STATE, EFFECT> extends Cubit<STATE>
);

@override
Future<void> onUnexpectedError(Object? error, StackTrace stackTrace, String? trackingId) => Future.value();
Future<void> onUnexpectedError(Object? error, StackTrace stackTrace, String trackingId) => Future.value();
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: safe_bloc
description: An extension to bloc state management library that manages unexpected exceptions.
version: 1.2.0
version: 1.2.1
repository: https://github.com/netglade/safe_bloc
issue_tracker: https://github.com/netglade/safe_bloc/issues
screenshots:
Expand Down
Loading