In my server app I want to return a \"forbidden\" value when the user has no permissions for the endpoint.
To this end I create a rejected promise for reuse:
I would give advice which deviates from the accepted answer. I wouldn't recommend using the return statement to provide an Error - this is ignoring the exact intention of throw!
I offer that your intuition and the accepted answer are over-engineered. Simply do this instead:
if (!isCollab) throw new Error('FORBIDDEN');
If you don't want a stack trace forget about all the overhead and simply do:
if (!isCollab) throw 'FORBIDDEN';