Skip to content

Conversation

@oliverbarnes
Copy link
Contributor

Fetch Error: Unable to Fetch resource(s)

Becomes

Fetch Error: Unable to Fetch resource(s): Pretender intercepted GET /supports but no handler was defined for this type of request

(or would this be better in a console warning?)

@pixelhandler
Copy link
Owner

@oliverbarnes It does seem reasonable - since the first argument to construct a FetchError instance is message. I should also add some error handling examples in the dummy app too.

I included the original error, as the error property of the FetchError so in some cases I do access the original error. I recall leaving the FetchError message short and static (more like a title). Perhaps looking over a working use case would help find some clarity on error handling with the FetchError.

@oliverbarnes
Copy link
Contributor Author

My case was trying to test a feature that was already working, a functional test driving the interface, and struggling to stub the api requests and model the payload mocks accordingly with Pretender.

Running the test on the browser, with ember test --server the generic Fetch Error: Unable to Fetch resource(s) error would come up again and again, and since there were 4 different requests being done from the route, it was hard to tell which request it was referring to.

i'd append .then((response) => { debugger }, .then(error) => { debugger } to get at the error on each of them, and then get at the actual error message pointing to which request or stub the error was coming from. But, once I had fixed each of the pretender stubs, the generic error would still show up, though the debugger in the error block was never hit.

I had to find where the error was caught in EJR and debug there to get at the error message, and finally I saw it was a request being made from a component :)

Debugging at that level I saw all this could be avoided by simply showing the specific error message on the browser (or on the command line, for that matter).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants