File tree Expand file tree Collapse file tree 3 files changed +7
-1
lines changed
Expand file tree Collapse file tree 3 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import 'package:model/oidc/response/oidc_response.dart';
1313import 'package:tmail_ui_user/features/login/data/extensions/service_path_extension.dart' ;
1414import 'package:tmail_ui_user/features/login/data/network/config/oidc_constant.dart' ;
1515import 'package:tmail_ui_user/features/login/data/network/endpoint.dart' ;
16+ import 'package:tmail_ui_user/features/login/domain/exceptions/login_exception.dart' ;
1617import 'package:tmail_ui_user/features/login/data/network/oidc_error.dart' ;
1718import 'package:tmail_ui_user/main/utils/app_config.dart' ;
1819import 'package:dio/dio.dart' show DioError;
@@ -40,6 +41,9 @@ class OIDCHttpClient {
4041 } else {
4142 return OIDCResponse .fromJson (jsonDecode (result));
4243 }
44+ } on FormatException catch (exception) {
45+ log ('checkOIDCIsAvailable(): error while parsing server response (JSON expected): ${exception .message }' );
46+ throw InvalidOIDCResponseException ();
4347 } on DioError catch (exception) {
4448 if (exception.error is HandshakeException ) {
4549 throw exception.error! ;
Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ class NotFoundDataResourceRecordException implements Exception {}
55
66class NotFoundUrlException implements Exception {}
77
8+ class InvalidOIDCResponseException implements Exception {}
9+
810class NoSuitableBrowserForOIDCException implements Exception {
911
1012 static const noBrowserAvailableCode = 'no_browser_available' ;
Original file line number Diff line number Diff line change @@ -274,7 +274,7 @@ class LoginController extends ReloadableController {
274274 }
275275
276276 void _handleCheckOIDCIsAvailableFailure (CheckOIDCIsAvailableFailure failure) {
277- if (failure.exception is CanNotFoundOIDCLinks ) {
277+ if (failure.exception is CanNotFoundOIDCLinks || failure.exception is InvalidOIDCResponseException ) {
278278 _handleCommonOIDCFailure ();
279279 } else {
280280 loginFormType.value = LoginFormType .retry;
You can’t perform that action at this time.
0 commit comments