0

Is there a way to get the SQLSTATE code from a django ProgrammingError or OperationalError? All I can find now is the "message", which is locale-dependent.

1
  • Did you try to inspect the exception object with e.g dir()? Commented Sep 22, 2015 at 14:03

1 Answer 1

2

After further research, it appears the only way to get the SQLSTATE is:

exception.__cause__.pgcode
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.