This commit is contained in:
Tobe O 2018-07-09 12:09:01 -04:00
parent d60bc4faf2
commit c025992f47
4 changed files with 10 additions and 3 deletions

View file

@ -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.

4
example/main.dart Normal file
View file

@ -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!");

View file

@ -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<String>
? ((data['errors'] as Iterable<String>).toList())
errors: data['errors'] is Iterable
? ((data['errors'] as Iterable).map((x) => x.toString()).toList())
: <String>[],
);
}

View file

@ -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 <thosakwe@gmail.com>
homepage: https://github.com/angel-dart/http_exception