I am using AWS Lambda as An Authoriser to validate the users that use the application and it is necessary to raise an Exception("UnAuthorized") to return 401 code to the user. Now every time Exception("UnAuthorized") is raised, Stack trace and an error level log gets published.
I dont want to see this error log, since this is causing issue with log alerts.
ie Raise Exception("UnAuthorized") should do as expected but not show any logs.
You can simply
return401 code rather than raising anException: