Skip to content
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

Merged
merged 3 commits into from
Jun 15, 2024

Conversation

tarepan
Copy link
Contributor

@tarepan tarepan commented May 31, 2024

内容

ライブラリの HTTPException を独自エラーで置き換えるリファクタリングを提案します。

また、他 PR にてエラーメッセージのテストは過剰(E2E のスナップショットが適切)との指摘があったため、ライブラリテストでもメッセージのテストを削除しました。

関連 Issue

無し

@tarepan tarepan requested a review from a team as a code owner May 31, 2024 06:20
@tarepan tarepan requested review from Hiroshiba and sevenc-nanashi and removed request for a team May 31, 2024 06:20
Copy link
Member

@Hiroshiba Hiroshiba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

@Hiroshiba
Copy link
Member

あっ すみません、ちょっと自信なさ気なコンフリクトが発生してしまったので解消をお願いできると・・・ 🙇

@tarepan
Copy link
Contributor Author

tarepan commented Jun 3, 2024

@Hiroshiba
コンフリクト解消しました。merge 可能です。

Copy link
Member

@Hiroshiba Hiroshiba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

おまたせしました、マージします!!

Comment on lines +65 to +74
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))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

このエラー変換は2箇所にあって、片方変えたときにもう片方変え忘れちゃうかもですね。
何かしらのエラー変換関数を作ってあげると良いかも・・・?

@Hiroshiba Hiroshiba merged commit b18e956 into VOICEVOX:master Jun 15, 2024
4 checks passed
@tarepan tarepan deleted the refactor/lib_httpexception branch June 16, 2024 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants