- Sort Score
- Result 10 results
- Languages All
Results 1 - 6 of 6 for db (0.16 sec)
-
docs/ja/docs/tutorial/dependencies/dependencies-with-yield.md
つまり、`yield`の後に`HTTPException`を発生させた場合、`HTTTPException`をキャッチしてHTTP 400のレスポンスを返すデフォルトの(あるいは任意のカスタムの)例外ハンドラは、その例外をキャッチすることができなくなります。 これは、依存関係に設定されているもの(例えば、DBセッション)を、例えば、バックグラウンドタスクで使用できるようにするものです。 バックグラウンドタスクはレスポンスが送信された*後*に実行されます。そのため、*すでに送信されている*レスポンスを変更する方法すらないので、`HTTPException`を発生させる方法はありません。 しかし、バックグラウンドタスクがDBエラーを発生させた場合、少なくとも`yield`で依存関係のセッションをロールバックしたり、きれいに閉じたりすることができ、エラーをログに記録したり、リモートのトラッキングシステムに報告したりすることができます。
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 12.5K bytes - Viewed (0) -
docs/de/docs/tutorial/dependencies/dependencies-with-yield.md
opt Löst Exception aus dep -->> handler: Löst Exception aus handler -->> client: HTTP-Error-Response end dep ->> operation: Führt Abhängigkeit aus, z. B. DB-Session opt Löst aus operation -->> dep: Löst Exception aus (z. B. HTTPException) opt Handhabt dep -->> dep: Kann Exception abfangen, eine neue HTTPException auslösen, andere Exceptions auslösen
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Sat Mar 30 18:10:29 GMT 2024 - 13.5K bytes - Viewed (0) -
docs/em/docs/tutorial/dependencies/dependencies-with-yield.md
opt raise dep -->> handler: Raise HTTPException handler -->> client: HTTP error response dep -->> dep: Raise other exception end dep ->> operation: Run dependency, e.g. DB session opt raise operation -->> dep: Raise HTTPException dep -->> handler: Auto forward exception handler -->> client: HTTP error response operation -->> dep: Raise other exception
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 8.6K bytes - Viewed (0) -
docs/en/docs/tutorial/dependencies/dependencies-with-yield.md
Note over dep: Run code up to yield opt raise Exception dep -->> handler: Raise Exception handler -->> client: HTTP error response end dep ->> operation: Run dependency, e.g. DB session opt raise operation -->> dep: Raise Exception (e.g. HTTPException) opt handle dep -->> dep: Can catch exception, raise a new HTTPException, raise other exception end
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Sat Feb 24 23:06:37 GMT 2024 - 14.1K bytes - Viewed (0) -
docs/zh/docs/tutorial/dependencies/dependencies-with-yield.md
所以,如果在`yield`之后抛出`HTTPException`,默认(或任何自定义)异常处理程序捕获`HTTPException`并返回HTTP 400响应的机制将不再能够捕获该异常。 这就是允许在依赖中设置的任何东西(例如数据库会话(DB session))可以被后台任务使用的原因。 后台任务在响应发送之后运行。因此,无法触发`HTTPException`,因为甚至没有办法更改*已发送*的响应。 但如果后台任务产生了数据库错误,至少你可以在带有`yield`的依赖中回滚或清理关闭会话,并且可能记录错误或将其报告给远程跟踪系统。 如果你知道某些代码可能会引发异常,那就做最“Pythonic”的事情,就是在代码的那部分添加一个`try`块。
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Thu Apr 18 19:53:19 GMT 2024 - 10.3K bytes - Viewed (0) -
docs/ru/docs/tutorial/dependencies/dependencies-with-yield.md
opt raise dep -->> handler: Raise HTTPException handler -->> client: HTTP error response dep -->> dep: Raise other exception end dep ->> operation: Run dependency, e.g. DB session opt raise operation -->> dep: Raise HTTPException dep -->> handler: Auto forward exception handler -->> client: HTTP error response operation -->> dep: Raise other exception
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Tue Apr 02 04:21:06 GMT 2024 - 19.6K bytes - Viewed (0)