Handling Errors
Nexus simplifies error handling by attaching a response
object to the error, providing detailed context.
const client = nexus.create({...});
try{
const response = await client.get('/invalid-endpoint');
console.log(response.data) //your response data
console.log(response) // all the http response object
}catch(error){
console.error(error.message); // Error message
console.error(error.response); // Full response object
}
Last updated