2016-10-19 22:04:06 +00:00
|
|
|
/// Represents an error in route configuration or navigation.
|
2016-10-12 17:58:32 +00:00
|
|
|
abstract class RoutingException extends Exception {
|
2018-08-20 19:34:00 +00:00
|
|
|
factory RoutingException(String message) =>
|
|
|
|
new _RoutingExceptionImpl(message);
|
2016-10-19 22:04:06 +00:00
|
|
|
|
|
|
|
/// Occurs when trying to resolve the parent of a [Route] without a parent.
|
2018-08-20 19:34:00 +00:00
|
|
|
factory RoutingException.orphan() => new _RoutingExceptionImpl(
|
|
|
|
"Tried to resolve path '..' on a route that has no parent.");
|
2016-10-19 22:04:06 +00:00
|
|
|
|
|
|
|
/// Occurs when the user attempts to navigate to a non-existent route.
|
2018-08-20 19:34:00 +00:00
|
|
|
factory RoutingException.noSuchRoute(String path) =>
|
|
|
|
new _RoutingExceptionImpl(
|
|
|
|
"Tried to navigate to non-existent route: '$path'.");
|
2016-10-12 17:58:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
class _RoutingExceptionImpl implements RoutingException {
|
|
|
|
final String message;
|
|
|
|
|
|
|
|
_RoutingExceptionImpl(this.message);
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => message;
|
2018-08-20 19:34:00 +00:00
|
|
|
}
|