Skip to content

Latest commit

 

History

History
38 lines (28 loc) · 879 Bytes

no-perform-without-catch.md

File metadata and controls

38 lines (28 loc) · 879 Bytes

no-perform-without-catch

Similar to catch-or-return, we want to make sure that any this.someTask.perform() calls have either a .catch(...) attached to it, they are returned from a function, or they are used with yield or await.

The reason for this is that without explicit error handling on the perform() calls you will up with "Unhandled promise error" issues if you use error reporting services like Sentry.

Examples

This rule forbids the following:

this.submitTask.perform();

This rule allows the following:

this.submitTask.perform().catch(error => { ... });
try {
  await this.submitTask.perform();
} catch (error) {
  ...
}
return this.submitTask.perform();