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:
|
try:
|
||||||
user.set_otp()
|
user.set_otp()
|
||||||
except Exception as e:
|
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()
|
user.send_otp()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise UnprocessableEntity(_('otp expire time not reached yet'))
|
raise UnprocessableEntity(_('otp expire time not reached yet'), code='opt_not_expired')
|
||||||
|
|
||||||
self.instance = user
|
self.instance = user
|
||||||
return user
|
return user
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue