Skip to content

Commit

Permalink
Capture login exceptions in sentry (#337)
Browse files Browse the repository at this point in the history
  • Loading branch information
JElgar authored Oct 13, 2024
1 parent d18b1ef commit f3293bb
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/services/auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:nowu/locator.dart';
import 'package:nowu/services/analytics.dart';
import 'package:nowu/services/storage.dart';
import 'package:nowu/utils/let.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:sign_in_with_apple/sign_in_with_apple.dart';
import 'package:supabase_flutter/supabase_flutter.dart' hide User;
import 'package:supabase_flutter/supabase_flutter.dart';
Expand Down Expand Up @@ -105,8 +106,14 @@ class AuthenticationService {
}

Future<OAuthLoginResult?> signInWithOAuth(AuthProvider provider) async {
final response = await _signInWithOAuth(provider);
return response?.let(OAuthLoginResult.fromAuthResponse);
try {
final response = await _signInWithOAuth(provider);
return response?.let(OAuthLoginResult.fromAuthResponse);
} catch (exception, stackTrace) {
_logger.warning('Login with oauth failed provider=$provider', exception);
await Sentry.captureException(exception, stackTrace: stackTrace);
throw exception;
}
}

Future<AuthResponse?> _signInWithOAuth(AuthProvider provider) {
Expand Down

0 comments on commit f3293bb

Please sign in to comment.