From c025992f47a9ad0abb5bd6b1eedc39605991fbf5 Mon Sep 17 00:00:00 2001 From: Tobe O Date: Mon, 9 Jul 2018 12:09:01 -0400 Subject: [PATCH] Patch +3 --- CHANGELOG.md | 3 +++ example/main.dart | 4 ++++ lib/angel_http_exception.dart | 4 ++-- pubspec.yaml | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 example/main.dart diff --git a/CHANGELOG.md b/CHANGELOG.md index 59f19f72..0106511a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 1.0.0+3 +* Slightly relax the deserialization of `errors`. + # 1.0.0+2 * Added a backwards-compatible way to cast the `errors` List. diff --git a/example/main.dart b/example/main.dart new file mode 100644 index 00000000..35877072 --- /dev/null +++ b/example/main.dart @@ -0,0 +1,4 @@ +import 'package:angel_http_exception/angel_http_exception.dart'; + +void main() => + throw new AngelHttpException.notFound(message: "Can't find that page!"); diff --git a/lib/angel_http_exception.dart b/lib/angel_http_exception.dart index 1735936d..3900206f 100644 --- a/lib/angel_http_exception.dart +++ b/lib/angel_http_exception.dart @@ -50,8 +50,8 @@ class AngelHttpException implements Exception { null, statusCode: (data['status_code'] ?? data['statusCode']) as int, message: data['message']?.toString(), - errors: data['errors'] is Iterable - ? ((data['errors'] as Iterable).toList()) + errors: data['errors'] is Iterable + ? ((data['errors'] as Iterable).map((x) => x.toString()).toList()) : [], ); } diff --git a/pubspec.yaml b/pubspec.yaml index 939cf21b..a8a96bab 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: angel_http_exception -version: 1.0.0+2 +version: 1.0.0+3 description: Angel's HTTP exception class. author: Tobe O homepage: https://github.com/angel-dart/http_exception