fastapi-crudrouter icon indicating copy to clipboard operation
fastapi-crudrouter copied to clipboard

modified tortoise _get_one route

Open Gabriel2409 opened this issue 3 years ago • 4 comments

  • Simplification of the _get_one route: use of the get method provided by tortoise instead of using filter. The 404 is still raised if the item does not exist Note that it changes the error message

Gabriel2409 avatar Apr 01 '22 09:04 Gabriel2409

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/flortz/fastapi-crudrouter/HGPPRrQ1qyUAZhgGVYciMPgDvbiM
✅ Preview: https://fastapi-crudrouter-git-fork-gabriel2409-feature-t-b5e00f-flortz.vercel.app

vercel[bot] avatar Apr 01 '22 09:04 vercel[bot]

Hi @Gabriel2409! Sorry for the delay in review! Thanks for this 🚀

awtkns avatar Jun 03 '22 05:06 awtkns

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
fastapi-crudrouter ✅ Ready (Inspect) Visit Preview Jun 3, 2022 at 6:59AM (UTC)

vercel[bot] avatar Jun 03 '22 06:06 vercel[bot]

I added a commit to catch the tortoise DoesNotExist exception. However, I think this solution is not entirely satisfactory as the exception is caught even if add_exception_handler was set to True when registering tortoise. That means your custom error message will always be displayed, which might conflict with custom routes not created with fastapi crudrouter.

Gabriel2409 avatar Jun 03 '22 07:06 Gabriel2409