🐛(backend) Fix unreachable exception handler for URLValidator#2172
🐛(backend) Fix unreachable exception handler for URLValidator#2172maboukerfa wants to merge 1 commit intosuitenumerique:mainfrom
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
You are right, the exception is managed by the exception handler but not caught here. |
The exception block was never being executed because URLValidator raises django.core.exceptions.ValidationError, not drf.exceptions.ValidationError. Signed-off-by: Mohamed El Amine BOUKERFA <boukerfa.ma@gmail.com>
e1e9918 to
e6c0f30
Compare

Purpose
The exception block was never being executed because URLValidator raises django.core.exceptions.ValidationError, not drf.exceptions.ValidationError, so the except block was dead code.
Proposal
Replace the
drf.exceptions.ValidationErrorwith Django 'ValidationError'