Update for backwards compatibility
This commit is contained in:
parent
a30ad98ee0
commit
d60bc4faf2
3 changed files with 12 additions and 5 deletions
|
@ -1,2 +1,5 @@
|
||||||
|
# 1.0.0+2
|
||||||
|
* Added a backwards-compatible way to cast the `errors` List.
|
||||||
|
|
||||||
# 1.0.0+1
|
# 1.0.0+1
|
||||||
* Dart 2 updates.
|
* Dart 2 updates.
|
|
@ -46,10 +46,14 @@ class AngelHttpException implements Exception {
|
||||||
}
|
}
|
||||||
|
|
||||||
factory AngelHttpException.fromMap(Map data) {
|
factory AngelHttpException.fromMap(Map data) {
|
||||||
return new AngelHttpException(null,
|
return new AngelHttpException(
|
||||||
|
null,
|
||||||
statusCode: (data['status_code'] ?? data['statusCode']) as int,
|
statusCode: (data['status_code'] ?? data['statusCode']) as int,
|
||||||
message: data['message']?.toString(),
|
message: data['message']?.toString(),
|
||||||
errors: (data['errors'] as Iterable)?.cast<String>()?.toList());
|
errors: data['errors'] is Iterable<String>
|
||||||
|
? ((data['errors'] as Iterable<String>).toList())
|
||||||
|
: <String>[],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
factory AngelHttpException.fromJson(String str) =>
|
factory AngelHttpException.fromJson(String str) =>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: angel_http_exception
|
name: angel_http_exception
|
||||||
version: 1.0.0+1
|
version: 1.0.0+2
|
||||||
description: Angel's HTTP exception class.
|
description: Angel's HTTP exception class.
|
||||||
author: Tobe O <thosakwe@gmail.com>
|
author: Tobe O <thosakwe@gmail.com>
|
||||||
homepage: https://github.com/angel-dart/http_exception
|
homepage: https://github.com/angel-dart/http_exception
|
||||||
|
|
Loading…
Reference in a new issue