starlette icon indicating copy to clipboard operation
starlette copied to clipboard

Do not process FileNotFoundError in FileResponse, resolves #979

Open toxadx opened this issue 11 months ago • 0 comments

FileNotFoundError can be processed in exception_handlers

Summary

Avoid handling FileNotFoundError in FileResponse. This allows FileNotFoundError to be properly handled using exception_handlers, for example, by returning a 404 error when a file is not found.

Checklist

  • [x] I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • [x] I've updated the documentation accordingly.

toxadx avatar Jan 29 '25 15:01 toxadx