Skip to content

Commit e771ad0

Browse files
committed
fix(remote)
1 parent bccd1e5 commit e771ad0

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

android/app/build.gradle

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
2626
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2727

2828
android {
29-
compileSdkVersion flutter.compileSdkVersion
29+
compileSdkVersion 33
3030

3131
compileOptions {
3232
sourceCompatibility JavaVersion.VERSION_1_8
@@ -44,8 +44,8 @@ android {
4444
defaultConfig {
4545
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
4646
applicationId "com.hoc.node_auth"
47-
minSdkVersion flutter.minSdkVersion
48-
targetSdkVersion flutter.targetSdkVersion
47+
minSdkVersion 21
48+
targetSdkVersion 33
4949
versionCode flutterVersionCode.toInteger()
5050
versionName flutterVersionName
5151
multiDexEnabled true

lib/data/remote/api_service.dart

+10-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,16 @@ class ApiService implements RemoteDataSource {
2828
rethrow;
2929
} on SocketException catch (e, s) {
3030
throw RemoteDataSourceException('No internet connection', e, s);
31-
} on SimpleHttpClientException catch (e, s) {
32-
throw RemoteDataSourceException('Http error', e, s);
31+
} on SimpleTimeoutException catch (e, s) {
32+
throw RemoteDataSourceException('Timeout error', e, s);
33+
} on SimpleErrorResponseException catch (e, s) {
34+
String message;
35+
try {
36+
message = jsonDecode(e.errorResponseBody)['message'] as String;
37+
} catch (_) {
38+
message = 'Http error';
39+
}
40+
throw RemoteDataSourceException(message, e, s);
3341
} catch (e, s) {
3442
throw RemoteDataSourceException('Other error', e, s);
3543
}

0 commit comments

Comments
 (0)