projects
/
squeep-api-dingus
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
minor refactor of router to use explicit exceptions
[squeep-api-dingus]
/
lib
/
router
/
index.js
diff --git
a/lib/router/index.js
b/lib/router/index.js
index 1585065e14ce79b804cd6de967965951ab0d535a..fd19bdf5192cfd9efd7b4c00023f1ae92265cbd1 100644
(file)
--- a/
lib/router/index.js
+++ b/
lib/router/index.js
@@
-7,7
+7,7
@@
const { METHODS: httpMethods } = require('http');
const common = require('../common');
const { METHODS: httpMethods } = require('http');
const common = require('../common');
-const { DingusError } = require('../errors');
+const { DingusError
, RouterNoPathError, RouterNoMethodError
} = require('../errors');
const PathParameter = require('./path-parameter');
// Internal identifiers for route entries.
const PathParameter = require('./path-parameter');
// Internal identifiers for route entries.
@@
-266,10
+266,10
@@
class Router {
if ('*' in matchedPath[kPathMethods]) {
return matchedPath[kPathMethods]['*'];
}
if ('*' in matchedPath[kPathMethods]) {
return matchedPath[kPathMethods]['*'];
}
- throw new
DingusError('NoMethod'
);
+ throw new
RouterNoMethodError(
);
}
ctx.unmatchedPath = pathParts;
}
ctx.unmatchedPath = pathParts;
- throw new
DingusError('NoPath'
);
+ throw new
RouterNoPathError(
);
}
}