Added error handler
This commit is contained in:
@@ -24,10 +24,7 @@ class Router
|
||||
$route = preg_replace('/\{([a-z]+):([^\}]+)\}/', '(?P<\1>\2)', $route);
|
||||
$route = '/^'.$route.'$/';
|
||||
|
||||
if ($this->routes[$route] = $params) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
$this->routes[$route] = $params;
|
||||
}
|
||||
|
||||
public function match($url)
|
||||
@@ -47,7 +44,6 @@ class Router
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -75,9 +71,7 @@ class Router
|
||||
$action = $var['_method'];
|
||||
} else {
|
||||
// Token invalid
|
||||
$flash = Session::flash('info', 'Token invalid, try again');
|
||||
$error = Session::flash('info');
|
||||
die($error);
|
||||
throw new \Exception("Token invalid", 498);
|
||||
}
|
||||
unset($var['_token']);
|
||||
unset($var['_method']);
|
||||
@@ -92,8 +86,9 @@ class Router
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new \Exception("Method not found", 400);
|
||||
}
|
||||
return false;
|
||||
throw new \Exception("Page not found", 404);
|
||||
}
|
||||
|
||||
private function removeQueryStringVariable($url)
|
||||
|
||||
Reference in New Issue
Block a user