better exception
This commit is contained in:
parent
c227fda538
commit
1f44f80a79
1 changed files with 2 additions and 2 deletions
|
|
@ -73,12 +73,12 @@ class RequestOTPSerializer(serializers.ModelSerializer):
|
|||
try:
|
||||
user.set_otp()
|
||||
except Exception as e:
|
||||
raise UnprocessableEntity(_('otp expire time not reached'))
|
||||
raise UnprocessableEntity(_('otp expire time not reached'), code='opt_not_expired')
|
||||
|
||||
user.send_otp()
|
||||
|
||||
else:
|
||||
raise UnprocessableEntity(_('otp expire time not reached yet'))
|
||||
raise UnprocessableEntity(_('otp expire time not reached yet'), code='opt_not_expired')
|
||||
|
||||
self.instance = user
|
||||
return user
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue