How to enforce awaiting return of async function in try catch block?

Must-share information (formatted with Markdown):

  • SonarQube
  • how is SonarQube deployed: Docker
  • add custom rule

As dicussed here "await" should not be used redundantly - #11 by victor.diez , it is required to await return of an async function inside a try catch block in order to properly handle error.
This is the way the return await in typescript-eslint is defined.

How to enforce this rule in SonarQube ?

It sounds like you want to adjust your Quality Profile to include S4326

1 Like

As I understand S4326 will generate an error for any awaited return while I’d like to accept awaited return inside a try/catch

Hello @fidgi,

thanks for the feedback. I’ve added a ticket to import this rule to our analyzer.