Error logging is called even when handled in custom handler.
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- javascript, nodejs
調査の方向性
Issue にはファイルもテストも指定されていません。カスタムエラーハンドラーとデフォルトエラーハンドラーのエントリーポイントをたどり、処理されたエラーではデフォルトのエラーログが出力されず、引き継がれたエラーでは引き続き出力されること、そしてアクセスログに最終ステータスコードが保持されることを確認してください。
索引モデルが issue の本文から書いたものです。
説明
When the error logging is enabled, it is called even when the error is handled in a custom error handler middleware.
This is unintuitive for several reasons. Consider the following case.
//Validation middleware
api.use((req, _, next) => {
//Assume a function that validates the body and returns a boolean
if (!validate(req.body)) {
throw new CustomValidationError();
}
next();
});
/*Some routes registered here*/
//Error handling middleware
api.use((err, _, res, next) => {
//Handle validation errors and send the response
if (err.name === 'CustomValidationError') {
return res.status(422).json({reason: 'Some validation reason'});
}
next();
});
In this case, the first thing we see in the logs is something like INFO {"level":"fatal",..."statusCode":500}.
Clearly the error is not something that we would consider to be fatal, as we handle it and return a 4XX. Also, the status code says 500, because that's the default in the handling logic and we haven't overridden it at the point at which the log is written, but it's confusing to see these things for a request which is neither fatal nor a 500.
The access log will then be printed with the correct status code, which adds further confusion.
Finally, the readme states that we can "short-circuit" the default error handler by registering a custom one, which I would expect to mean that we only get the logging if we don't register a custom handler, or we call next(), because it seems intuitive that the logging is part of the default handler.
Thank you for taking time to read.
- 主要言語
- JavaScript
- スター
- 1.5k
- フォーク
- 127
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
jeremydaly/lambda-api のほかの issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
jeremydaly/lambda-api#356 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
jeremydaly/lambda-api#270 ·
-
Logger Output再び着手できるかも @naorpeled が 906 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
jeremydaly/lambda-api#259 · コメント 1 件 · 担当者 1 名 ·
-
Is it possible to disable versioning?対応中かも @naorpeled が 101 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 52/100
jeremydaly/lambda-api#257 · コメント 5 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 38/100
jeremydaly/lambda-api#251 · コメント 1 件 ·
jeremydaly/lambda-api の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 60/100
quarto-dev/quarto-cli#15042 ·
メンテナーはふだん 1 日以内に返信
-
OpenCode install copies the Pi harness directory (`.pi/`) into the OpenCode config root対応中かも @gaurav0107 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 3 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
NaturalIntelligence/fast-xml-parser#890 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
Docs viewer: inverted grey colormap, Phantom CT window -20 to 35 HU, smoothing up to 40 mm対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンarea: docs enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
PyTomography/PyTomography#331 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
pnpm/get.pnpm.io#68 ·