clearer exception handling in OIDCHttpClient::checkOIDCIsAvailable()
This commit is contained in:
committed by
Dat H. Pham
parent
03819a7a9b
commit
35b90ba87a
@@ -1,9 +1,11 @@
|
||||
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:core/data/model/query/query_parameter.dart';
|
||||
import 'package:core/data/network/dio_client.dart';
|
||||
import 'package:core/utils/app_logger.dart';
|
||||
import 'package:get/get_connect/http/src/exceptions/exceptions.dart';
|
||||
import 'package:model/oidc/oidc_configuration.dart';
|
||||
import 'package:model/oidc/request/oidc_request.dart';
|
||||
import 'package:model/oidc/response/oidc_discovery_response.dart';
|
||||
@@ -39,7 +41,13 @@ class OIDCHttpClient {
|
||||
return OIDCResponse.fromJson(jsonDecode(result));
|
||||
}
|
||||
} on DioError catch (exception) {
|
||||
if (exception.response?.statusCode == 404) {
|
||||
if (exception.error is HandshakeException) {
|
||||
throw exception.error!;
|
||||
} else if (exception.error is SocketException) {
|
||||
throw exception.error!;
|
||||
} else if (exception.response?.statusCode == 401) {
|
||||
throw UnauthorizedException();
|
||||
} else if (exception.response?.statusCode == 404) {
|
||||
throw CanNotFoundOIDCLinks();
|
||||
}
|
||||
throw CanRetryOIDCException();
|
||||
|
||||
Reference in New Issue
Block a user