-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
整理: ライブラリの HTTPException
を独自エラーで置き換え
#1371
整理: ライブラリの HTTPException
を独自エラーで置き換え
#1371
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!!
あっ すみません、ちょっと自信なさ気なコンフリクトが発生してしまったので解消をお願いできると・・・ 🙇 |
@Hiroshiba |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
おまたせしました、マージします!!
except LibraryNotFoundError as e: | ||
raise HTTPException(status_code=404, detail=str(e)) | ||
except LibraryFormatInvalidError as e: | ||
raise HTTPException(status_code=422, detail=str(e)) | ||
except LibraryUnsupportedError as e: | ||
raise HTTPException(status_code=422, detail=str(e)) | ||
except LibraryOperationUnauthorizedError as e: | ||
raise HTTPException(status_code=403, detail=str(e)) | ||
except LibraryInternalError as e: | ||
raise HTTPException(status_code=500, detail=str(e)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
このエラー変換は2箇所にあって、片方変えたときにもう片方変え忘れちゃうかもですね。
何かしらのエラー変換関数を作ってあげると良いかも・・・?
内容
ライブラリの
HTTPException
を独自エラーで置き換えるリファクタリングを提案します。また、他 PR にてエラーメッセージのテストは過剰(E2E のスナップショットが適切)との指摘があったため、ライブラリテストでもメッセージのテストを削除しました。
関連 Issue
無し