Skip to content

Commit

Permalink
Release/2.0.1 (#488)
Browse files Browse the repository at this point in the history
* Dio error response (#482)

* potential fix #481
* cloud function add catch
   Fix #484
   Mightfix: #481

Co-authored-by: Chralu <[email protected]>

* prepare release 2.0.1

* Fix catching timeout exception

Should be inclunded into #488.

Co-authored-by: Chralu <[email protected]>
  • Loading branch information
fischerscode and Chralu authored Oct 24, 2020
1 parent fe32351 commit 540190b
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 19 deletions.
3 changes: 3 additions & 0 deletions packages/dart/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 2.0.1
Fixed network exceptions. [#482](https://github.com/parse-community/Parse-SDK-Flutter/pull/482)

## 2.0.0
##### Warning: This release contains breaking changes. If you are using flutter you should migrate using *[this](https://github.com/parse-community/Parse-SDK-Flutter/blob/release/2.0.0/docs/migrate-2-0-0.md)* guide.

Expand Down
2 changes: 1 addition & 1 deletion packages/dart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This is a work in progress and we are consistently updating it. Please let us kn
To install, either add to your pubspec.yaml
```yml
dependencies:
parse_server_sdk: ^2.0.0
parse_server_sdk: ^2.0.1
```
or clone this repository and add to your project. As this is an early development with multiple contributors, it is probably best to download/clone and keep updating as an when a new feature is added.
Expand Down
2 changes: 1 addition & 1 deletion packages/dart/lib/src/base/parse_constants.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
part of flutter_parse_sdk;

// Library
const String keySdkVersion = '2.0.0';
const String keySdkVersion = '2.0.1';
const String keyLibraryName = 'Flutter Parse SDK';

// End Points
Expand Down
30 changes: 19 additions & 11 deletions packages/dart/lib/src/objects/parse_function.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,15 @@ class ParseCloudFunction extends ParseObject {
if (parameters != null) {
_setObjectData(parameters);
}

final Response<String> result = await _client.post<String>(uri,
options: Options(headers: headers),
data: json.encode(_getObjectData()));
return handleResponse<ParseCloudFunction>(
this, result, ParseApiRQ.execute, _debug, parseClassName);
try {
final Response<String> result = await _client.post<String>(uri,
options: Options(headers: headers),
data: json.encode(_getObjectData()));
return handleResponse<ParseCloudFunction>(
this, result, ParseApiRQ.execute, _debug, parseClassName);
} on Exception catch (e) {
return handleException(e, ParseApiRQ.execute, _debug, parseClassName);
}
}

/// Executes a cloud function that returns a ParseObject type
Expand All @@ -49,10 +52,15 @@ class ParseCloudFunction extends ParseObject {
if (parameters != null) {
_setObjectData(parameters);
}
final Response<String> result = await _client.post<String>(uri,
options: Options(headers: headers),
data: json.encode(_getObjectData()));
return handleResponse<T>(this, result, ParseApiRQ.executeObjectionFunction,
_debug, parseClassName);
try {
final Response<String> result = await _client.post<String>(uri,
options: Options(headers: headers),
data: json.encode(_getObjectData()));
return handleResponse<T>(this, result,
ParseApiRQ.executeObjectionFunction, _debug, parseClassName);
} on Exception catch (e) {
return handleException(
e, ParseApiRQ.executeObjectionFunction, _debug, parseClassName);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,31 @@ part of flutter_parse_sdk;
/// Handles exception instead of throwing an exception
ParseResponse buildParseResponseWithException(Exception exception) {
final ParseResponse response = ParseResponse();
response.error =
ParseError(message: exception.toString(), exception: exception);
if (exception is DioError) {
try {
Map<String, dynamic> errorResponse;

try {
errorResponse =
json.decode(exception.response?.data?.toString() ?? '{}');
} catch (_) {}

errorResponse ??= <String, dynamic>{};

response.error = ParseError(
message: errorResponse['error']?.toString() ??
exception.response?.statusMessage,
exception: exception,
code: errorResponse['code'] ?? exception.response?.statusCode,
);
} catch (error) {
response.error = ParseError(
message: "Failed to build ParseResponse with exception",
exception: error);
}
} else {
response.error =
ParseError(message: exception.toString(), exception: exception);
}
return response;
}
2 changes: 1 addition & 1 deletion packages/dart/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: parse_server_sdk
description: Dart plugin for Parse Server, (https://parseplatform.org), (https://back4app.com)
version: 2.0.0
version: 2.0.1
homepage: https://github.com/phillwiggins/flutter_parse_sdk

environment:
Expand Down
3 changes: 3 additions & 0 deletions packages/flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 2.0.1
Fixed network exceptions. [#482](https://github.com/parse-community/Parse-SDK-Flutter/pull/482)

## 2.0.0
First release.

Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This is a work in progress and we are consistently updating it. Please let us kn
To install, either add to your pubspec.yaml
```yml
dependencies:
parse_server_sdk: ^2.0.0
parse_server_sdk: ^2.0.1
```
or clone this repository and add to your project. As this is an early development with multiple contributors, it is probably best to download/clone and keep updating as an when a new feature is added.
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: parse_server_sdk_flutter
description: Flutter plugin for Parse Server, (https://parseplatform.org), (https://back4app.com)
version: 2.0.0
version: 2.0.1
homepage: https://github.com/phillwiggins/flutter_parse_sdk

environment:
Expand All @@ -10,7 +10,7 @@ dependencies:
flutter:
sdk: flutter

parse_server_sdk: ^2.0.0
parse_server_sdk: ^2.0.1

# Networking
dio: ^3.0.10
Expand Down

0 comments on commit 540190b

Please sign in to comment.