Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions example/lib/data/base/api_error.dart
Original file line number Diff line number Diff line change
@@ -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;
}
2 changes: 1 addition & 1 deletion example/lib/data/base/api_response.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
2 changes: 1 addition & 1 deletion example/lib/data/repositories/user/provider_db_user.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
4 changes: 2 additions & 2 deletions lib/src/objects/parse_error.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -70,7 +70,7 @@ class ParseError {

final int code;
final String message;
final bool isTypeOfException;
final Exception exception;
String type;

@override
Expand Down
2 changes: 1 addition & 1 deletion lib/src/objects/response/parse_exception_response.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion lib/src/utils/parse_logger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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}';
}
Expand Down