Difference between Flask abort() or returning a status
abort
raises an error, which an error handler will convert to a response. return
returns a response, error handlers don't trigger. It's up to how you want your application to flow.
abort
is a wrapper that raises HTTPException
classes. Calling abort
is the same as raising an exception and Flask will handle both the same way. Returning is not the same as raising an exception and will be handled differently.