Error Handling

When calling a function, you can check if an error occurred by checking the error property in the returned object:

const document = await ctx.document("document_path");
if(document.success === false){
  console.error(document.error.error); // Error message
  console.error(document.error.message); // Detailed error message
  console.error(document.error.statusCode); // HTTP status code
}

Last updated