Skip to content

Commit

Permalink
Adding more descriptive namespace error
Browse files Browse the repository at this point in the history
(cherry picked from commit a601ae0)
  • Loading branch information
cah-brian-gantzler committed Jun 1, 2022
1 parent bc2dc2a commit 2a8c301
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/pretender-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,15 @@ export default class PretenderConfig {

this.unhandledRequest = function (verb, path) {
path = decodeURI(path);
let namespaceError = "";
if (this.namespace === "") {
namespaceError =
"There is no existing namespace defined. Please define one";
} else {
namespaceError = `The existing namespace is ${this.namespace}`;
}
assert(
`Your app tried to ${verb} '${path}', but there was no route defined to handle this request. Define a route for this endpoint in your routes() config. Did you forget to define a namespace?`
`Your app tried to ${verb} '${path}', but there was no route defined to handle this request. Define a route for this endpoint in your routes() config. Did you forget to define a namespace? ${namespaceError}`
);
};
},
Expand Down

0 comments on commit 2a8c301

Please sign in to comment.