diff --git a/example/lib/data/base/api_error.dart b/example/lib/data/base/api_error.dart index ccb11e256..02f72f2b4 100644 --- a/example/lib/data/base/api_error.dart +++ b/example/lib/data/base/api_error.dart @@ -1,8 +1,8 @@ class ApiError { - ApiError(this.code, this.message, this.isTypeOfException, this.type); + ApiError(this.code, this.message, this.exception, this.type); final int code; final String message; - final bool isTypeOfException; + final Exception exception; final String type; } diff --git a/example/lib/data/base/api_response.dart b/example/lib/data/base/api_response.dart index 41e4067ab..5bb328dca 100644 --- a/example/lib/data/base/api_response.dart +++ b/example/lib/data/base/api_response.dart @@ -25,6 +25,6 @@ ApiError getApiError(ParseError response) { return null; } - return ApiError(response.code, response.message, response.isTypeOfException, + return ApiError(response.code, response.message, response.exception, response.type); } diff --git a/example/lib/data/repositories/diet_plan/provider_db_diet_plan.dart b/example/lib/data/repositories/diet_plan/provider_db_diet_plan.dart index 6915520c0..5a52599af 100644 --- a/example/lib/data/repositories/diet_plan/provider_db_diet_plan.dart +++ b/example/lib/data/repositories/diet_plan/provider_db_diet_plan.dart @@ -171,6 +171,6 @@ class DietPlanProviderDB implements DietPlanProviderContract { } } - static ApiError error = ApiError(1, 'No records found', false, ''); + static ApiError error = ApiError(1, 'No records found', null, ''); ApiResponse errorResponse = ApiResponse(false, 1, null, error); } diff --git a/example/lib/data/repositories/user/provider_db_user.dart b/example/lib/data/repositories/user/provider_db_user.dart index dff056796..be2a615bb 100644 --- a/example/lib/data/repositories/user/provider_db_user.dart +++ b/example/lib/data/repositories/user/provider_db_user.dart @@ -102,6 +102,6 @@ class UserProviderDB implements UserProviderContract { } } - static ApiError error = ApiError(1, 'No records found', false, ''); + static ApiError error = ApiError(1, 'No records found', null, ''); ApiResponse errorResponse = ApiResponse(false, 1, null, error); } diff --git a/lib/src/objects/parse_error.dart b/lib/src/objects/parse_error.dart index 39fd9ad19..c8b63dc4f 100644 --- a/lib/src/objects/parse_error.dart +++ b/lib/src/objects/parse_error.dart @@ -5,7 +5,7 @@ class ParseError { ParseError( {this.code = -1, this.message = 'Unknown error', - this.isTypeOfException = false, + this.exception, bool debug = false}) { type = exceptions[code]; if (debug) { @@ -70,7 +70,7 @@ class ParseError { final int code; final String message; - final bool isTypeOfException; + final Exception exception; String type; @override diff --git a/lib/src/objects/response/parse_exception_response.dart b/lib/src/objects/response/parse_exception_response.dart index 9a798c8b0..89f12e772 100644 --- a/lib/src/objects/response/parse_exception_response.dart +++ b/lib/src/objects/response/parse_exception_response.dart @@ -4,6 +4,6 @@ part of flutter_parse_sdk; ParseResponse buildParseResponseWithException(Exception exception) { final ParseResponse response = ParseResponse(); response.error = - ParseError(message: exception.toString(), isTypeOfException: true); + ParseError(message: exception.toString(), exception: exception); return response; } diff --git a/lib/src/utils/parse_logger.dart b/lib/src/utils/parse_logger.dart index 50fce8190..cb10ef8f5 100644 --- a/lib/src/utils/parse_logger.dart +++ b/lib/src/utils/parse_logger.dart @@ -21,7 +21,7 @@ void logAPIResponse(String className, String type, responseString += '\nType: ${parseResponse.error.type}'; final String errorOrException = - parseResponse.error.isTypeOfException ? 'Exception' : 'Error'; + parseResponse.error.exception != null ? 'Exception' : 'Error'; responseString += '\n$errorOrException: ${parseResponse.error.message}'; }