add toString to custom exception type

This commit is contained in:
Luke Freeman 2018-10-25 11:03:20 -07:00
parent 7ec4b2ed0a
commit 79e35c5768
5 changed files with 15 additions and 6 deletions

View File

@ -1,3 +1,6 @@
# 1.3.7
- Add `toString` for custom `RouteNotFoundException` type
# 1.3.6 # 1.3.6
- Small fix to error return type when no route match was made - Small fix to error return type when no route match was made

View File

@ -3,7 +3,7 @@
The brightest, hippest, coolest router for Flutter. The brightest, hippest, coolest router for Flutter.
[![Version](https://img.shields.io/badge/version-1.3.6-blue.svg)](https://pub.dartlang.org/packages/fluro) [![Version](https://img.shields.io/badge/version-1.3.7-blue.svg)](https://pub.dartlang.org/packages/fluro)
[![Build Status](https://travis-ci.org/theyakka/fluro.svg?branch=master)](https://travis-ci.org/theyakka/fluro) [![Build Status](https://travis-ci.org/theyakka/fluro.svg?branch=master)](https://travis-ci.org/theyakka/fluro)
[![Coverage](https://codecov.io/gh/theyakka/fluro/branch/master/graph/badge.svg)](https://codecov.io/gh/theyakka/fluro) [![Coverage](https://codecov.io/gh/theyakka/fluro/branch/master/graph/badge.svg)](https://codecov.io/gh/theyakka/fluro)
@ -25,7 +25,7 @@ See CHANGELOG for all breaking (and non-breaking) changes.
You should ensure that you add the router as a dependency in your flutter project. You should ensure that you add the router as a dependency in your flutter project.
```yaml ```yaml
dependencies: dependencies:
fluro: "^1.3.6" fluro: "^1.3.7"
``` ```
You can also reference the git repo directly if you want: You can also reference the git repo directly if you want:

View File

@ -55,6 +55,12 @@ class RouteMatch {
} }
class RouteNotFoundException implements Exception { class RouteNotFoundException implements Exception {
String message; final String message;
RouteNotFoundException(this.message); final String path;
RouteNotFoundException(this.message, this.path);
@override
String toString() {
return "No registered route was found to handle '$path'";
}
} }

View File

@ -79,7 +79,7 @@ class Router {
} else { } else {
String error = "No registered route was found to handle '$path'."; String error = "No registered route was found to handle '$path'.";
print(error); print(error);
completer.completeError(RouteNotFoundException(error)); completer.completeError(RouteNotFoundException(error, path));
} }
} }

View File

@ -2,7 +2,7 @@ name: fluro
description: > description: >
Fluro is a Flutter routing library that adds flexible routing options like wildcards, named Fluro is a Flutter routing library that adds flexible routing options like wildcards, named
parameters and clear route definitions. parameters and clear route definitions.
version: 1.3.6 version: 1.3.7
author: Yakka, LLC <flutter@theyakka.com> author: Yakka, LLC <flutter@theyakka.com>
homepage: https://github.com/theyakka/fluro homepage: https://github.com/theyakka/fluro