[Identity] Refactor DB error logic
Summary:
Since this needs to be called for both the authenticated
and unauthenticated service, we should move to it's own module.
Done in support of: https://linear.app/comm/issue/ENG-4445
Depends on D8606
Test Plan:
cd identity && cargo build
Reviewers: varun, bartek
Reviewed By: bartek
Subscribers: ashoat, tomek
Differential Revision: https://phab.comm.dev/D8607