[Django]-Inner function raise in Django rest API

3👍

After lots of effort and I don’t know why,
If I specify the exception type of inner function, I will get 5XX series error.
so in dummy function I just wrote :

def dummy_function_1():
    try:
        validate_1(id)
    except Exception:    # just exception, Not ValidationError or other exception
        raise ValidationError()

I could get 4XX series error

👤Mahdi

1👍

Try this:

def dummy_function_1():
    try:
        validate_1(id)
    except Exception:  # just exception, Not ValidationError or other exceptions
        raise ValidationError()

Leave a comment