Sets the default method (text, json, …) used to parse the data contained in the response body in case of an HTTP error.
As with other static methods, it will affect wretch instances created after calling this function.
importwretchfrom"wretch"
wretch.errorType("json")
wretch("http://server/which/returns/an/error/with/a/json/body") .get() .res() .catch(error=> { // error[errorType] (here, json) contains the parsed body console.log(error.json) })
Sets the default method (text, json, …) used to parse the data contained in the response body in case of an HTTP error. As with other static methods, it will affect wretch instances created after calling this function.
If null, defaults to "text".