Update error handling for fetch
We can add an onError option in the future that will be called instead of throwing the error, but for now it's good to have at least some way to bubble up errors from fetch
- Refactor the return type for
fetch- fetch now returns an object with the response if no errors occurred, or an error if one occurred.
- the error will need to be handled by the method calling fetch. at the moment the methods will simply re-throw the error and log it to the console if debug is on - at the moment we are also logging in
fetchregardless of debug. This part I'm least sure about. Should we movedebugto the base class and only log infetchif debug is true. Either way seems ok to me but I would like a second opinion.
Edited by Coby Sher