فهرست منبع

add toString to custom exception type

Luke Freeman 7 سال پیش
والد
کامیت
79e35c5768
5فایلهای تغییر یافته به همراه15 افزوده شده و 6 حذف شده
  1. 3 0
      CHANGELOG.md
  2. 2 2
      README.md
  3. 8 2
      lib/src/common.dart
  4. 1 1
      lib/src/router.dart
  5. 1 1
      pubspec.yaml

+ 3 - 0
CHANGELOG.md

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

+ 2 - 2
README.md

@@ -3,7 +3,7 @@
 
 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)
 [![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.
 ```yaml
 dependencies:
- fluro: "^1.3.6"
+ fluro: "^1.3.7"
 ```
 
 You can also reference the git repo directly if you want:

+ 8 - 2
lib/src/common.dart

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

+ 1 - 1
lib/src/router.dart

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

+ 1 - 1
pubspec.yaml

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