Treat raise warning as raise exception
I'm currently using `raise exception` to bail out of a function early and show an error to the client. However, this means anything done up to that point in the function is rolled back. This is annoying in cases where I want to modify the database before throwing the exception (i.e. incrementing a failed login count).

Is it possible to treat `raise warning '...'; return null;` as an exception? This would allow me to bail out and notify without rolling back the transaction.

I've tried wrapping the logic I want to not be rolled back in `begin ... end;` but this doesn't seem to work in all cases.