File tree Expand file tree Collapse file tree 9 files changed +12
-94
lines changed
Expand file tree Collapse file tree 9 files changed +12
-94
lines changed Original file line number Diff line number Diff line change @@ -21,8 +21,4 @@ export { HttpContext } from './src/http_context/main.js'
2121export { HttpException } from './src/exceptions/http_exception.js'
2222export { AbortException } from './src/exceptions/abort_exception.js'
2323export { RouteNotFoundException } from './src/exceptions/route_not_found.js'
24- export { CannotMakeURLException } from './src/exceptions/cannot_make_url.js'
25- export { DuplicateRouteException } from './src/exceptions/duplicate_route.js'
2624export { CannotLookupRouteException } from './src/exceptions/cannot_lookup_route.js'
27- export { DuplicateRouteNameException } from './src/exceptions/duplicate_route_name.js'
28- export { DuplicateRouteParamException } from './src/exceptions/duplicate_route_param.js'
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 99
1010import { stringify } from 'qs'
1111import encodeUrl from 'encodeurl'
12+ import { RuntimeException } from '@poppinss/utils'
1213import type Encryption from '@adonisjs/encryption'
1314import type { RouteFinder } from './route_finder.js'
14- import { CannotMakeURLException } from '../../exceptions/cannot_make_url.js'
1515
1616/**
1717 * URL builder class is used to create URIs for pre-registered
@@ -69,7 +69,7 @@ export class UrlBuilder {
6969 */
7070 #ensureHasWildCardValues( pattern : string , values ?: string [ ] ) {
7171 if ( ! values || ! Array . isArray ( values ) || ! values . length ) {
72- throw new CannotMakeURLException (
72+ throw new RuntimeException (
7373 `Cannot make URL for "${ pattern } " route. Invalid value provided for wildcard param`
7474 )
7575 }
@@ -80,7 +80,7 @@ export class UrlBuilder {
8080 */
8181 #ensureHasParamValue( pattern : string , param : string , value : string ) {
8282 if ( value === undefined || value === null ) {
83- throw new CannotMakeURLException (
83+ throw new RuntimeException (
8484 `Cannot make URL for "${ pattern } " route. Missing value for "${ param } " param`
8585 )
8686 }
Original file line number Diff line number Diff line change 88 */
99
1010import is from '@sindresorhus/is'
11+ import type Encryption from '@adonisjs/encryption'
12+ import { RuntimeException } from '@poppinss/utils'
13+ import type { Application } from '@adonisjs/application'
14+
1115import { Route } from './route.js'
1216import { RouteGroup } from './group.js'
1317import { BriskRoute } from './brisk.js'
@@ -16,10 +20,6 @@ import { toRoutesJSON } from '../helpers.js'
1620import { RouteResource } from './resource.js'
1721import { LookupStore } from './lookup_store/main.js'
1822import { RouteMatchers as Matchers } from './matchers.js'
19- import { DuplicateRouteNameException } from '../exceptions/duplicate_route_name.js'
20-
21- import type Encryption from '@adonisjs/encryption'
22- import type { Application } from '@adonisjs/application'
2323
2424import type { LazyImport } from '../types/base.js'
2525import { MiddlewareStore } from '../middleware/store.js'
@@ -300,7 +300,7 @@ export class Router<
300300 * to ensure that only one route is returned during lookup.
301301 */
302302 if ( route . name && routeNames . has ( route . name ) ) {
303- throw new DuplicateRouteNameException (
303+ throw new RuntimeException (
304304 `Route with duplicate name found. A route with name "${ route . name } " already exists`
305305 )
306306 }
Original file line number Diff line number Diff line change 1010// @ts -expect-error
1111import matchit from '@poppinss/matchit'
1212import lodash from '@poppinss/utils/lodash'
13- import { DuplicateRouteException } from '../exceptions/duplicate_route.js'
14- import { DuplicateRouteParamException } from '../exceptions/duplicate_route_param.js'
13+ import { RuntimeException } from '@poppinss/utils'
1514import type {
1615 RouteJSON ,
1716 MatchedRoute ,
@@ -88,9 +87,7 @@ export class RoutesStore {
8887 for ( let token of tokens ) {
8988 if ( [ 1 , 3 ] . includes ( token . type ) ) {
9089 if ( collectedParams . has ( token . val ) ) {
91- throw new DuplicateRouteParamException (
92- `Duplicate param "${ token . val } " found in "${ route . pattern } "`
93- )
90+ throw new RuntimeException ( `Duplicate param "${ token . val } " found in "${ route . pattern } "` )
9491 } else {
9592 collectedParams . add ( token . val )
9693 }
@@ -118,7 +115,7 @@ export class RoutesStore {
118115 * Check for duplicate route for the same domain and method
119116 */
120117 if ( methodRoutes . routes [ route . pattern ] ) {
121- throw new DuplicateRouteException (
118+ throw new RuntimeException (
122119 `Duplicate route found. "${ method } : ${ route . pattern } " route already exists`
123120 )
124121 }
Original file line number Diff line number Diff line change @@ -29,8 +29,8 @@ import { HttpContext } from '../http_context/main.js'
2929import { MiddlewareStore } from '../middleware/store.js'
3030import { finalHandler } from './factories/final_handler.js'
3131import { writeResponse } from './factories/write_response.js'
32- import { middlewareHandler } from './factories/middleware_handler.js'
3332import { asyncLocalStorage } from '../http_context/local_storage.js'
33+ import { middlewareHandler } from './factories/middleware_handler.js'
3434
3535/**
3636 * The HTTP server implementation to handle incoming requests and respond using the
You can’t perform that action at this time.
0 commit comments