Skip to content

Commit 5c21683

Browse files
ISSUE-351: Replaced isTypeOfException with Exception (parse-community#355)
Great work! Thank you
1 parent 5b80fef commit 5c21683

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

example/lib/data/base/api_error.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
class ApiError {
2-
ApiError(this.code, this.message, this.isTypeOfException, this.type);
2+
ApiError(this.code, this.message, this.exception, this.type);
33

44
final int code;
55
final String message;
6-
final bool isTypeOfException;
6+
final Exception exception;
77
final String type;
88
}

example/lib/data/base/api_response.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ ApiError getApiError(ParseError response) {
2525
return null;
2626
}
2727

28-
return ApiError(response.code, response.message, response.isTypeOfException,
28+
return ApiError(response.code, response.message, response.exception,
2929
response.type);
3030
}

example/lib/data/repositories/diet_plan/provider_db_diet_plan.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,6 @@ class DietPlanProviderDB implements DietPlanProviderContract {
169169
}
170170
}
171171

172-
static ApiError error = ApiError(1, 'No records found', false, '');
172+
static ApiError error = ApiError(1, 'No records found', null, '');
173173
ApiResponse errorResponse = ApiResponse(false, 1, null, error);
174174
}

example/lib/data/repositories/user/provider_db_user.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,6 @@ class UserProviderDB implements UserProviderContract {
102102
}
103103
}
104104

105-
static ApiError error = ApiError(1, 'No records found', false, '');
105+
static ApiError error = ApiError(1, 'No records found', null, '');
106106
ApiResponse errorResponse = ApiResponse(false, 1, null, error);
107107
}

lib/src/objects/parse_error.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class ParseError {
55
ParseError(
66
{this.code = -1,
77
this.message = 'Unknown error',
8-
this.isTypeOfException = false,
8+
this.exception,
99
bool debug = false}) {
1010
type = exceptions[code];
1111
if (debug) {
@@ -70,7 +70,7 @@ class ParseError {
7070

7171
final int code;
7272
final String message;
73-
final bool isTypeOfException;
73+
final Exception exception;
7474
String type;
7575

7676
@override

lib/src/objects/response/parse_exception_response.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ part of flutter_parse_sdk;
44
ParseResponse buildParseResponseWithException(Exception exception) {
55
final ParseResponse response = ParseResponse();
66
response.error =
7-
ParseError(message: exception.toString(), isTypeOfException: true);
7+
ParseError(message: exception.toString(), exception: exception);
88
return response;
99
}

lib/src/utils/parse_logger.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ void logAPIResponse(String className, String type,
2121
responseString += '\nType: ${parseResponse.error.type}';
2222

2323
final String errorOrException =
24-
parseResponse.error.isTypeOfException ? 'Exception' : 'Error';
24+
parseResponse.error.exception != null ? 'Exception' : 'Error';
2525

2626
responseString += '\n$errorOrException: ${parseResponse.error.message}';
2727
}

0 commit comments

Comments
 (0)