Trying to catch integrity error with SQLAlchemy

后端 未结 5 866
深忆病人
深忆病人 2021-01-01 20:30

I\'m having problems with trying to catch an error. I\'m using Pyramid/SQLAlchemy and made a sign up form with email as the primary key. The problem is when a duplicate ema

5条回答
  •  醉酒成梦
    2021-01-01 20:51

    What you need to do is catch a general exception and output its class; then you can make the exception more specific.

    except Exception as ex:
        print ex.__class__
    

提交回复
热议问题