I have a checkPermission function in which I pull session, reach database and confirm permission. If the action is not permitted, the function throws.
await checkPermission("USER_READ"); // This will throw if not permitted.
// Do permission specific stuff.
Problem is if I forget await, it will not wait and move to unpermitted code. Can I programatically check in checkPermission function if await is used so I can throw if await is not used? Or is there any other way I can enforce await for a given function and throw if not used.
Note: I know I can put it in an if and check if it returns Promise. But that is not what I am asking.