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

Refine exception detail with i18n #3042

Merged
merged 5 commits into from
Dec 26, 2022

Conversation

JohnNiang
Copy link
Member

@JohnNiang JohnNiang commented Dec 25, 2022

What type of PR is this?

/kind feature
/kind api-change
/area core
/milestone 2.1.x

What this PR does / why we need it:

  • Configuring message source location and name enables i18n message resolution.
  • Simple global error handler.
  • Refactor some exceptions with ResponseStatusException to control what HTTP status and problem detail need to be returned.

TODO

  • Add more UTs.

Which issue(s) this PR fixes:

Fixes #3020

Special notes for your reviewer:

Steps to test:

  1. Try to refine src/main/resources/config/i18n/messages_zh.properties and switch Browser language with Chinese.
  2. Delibrately make a mistake as you wish and see the error tips in console.
  3. Try to access one page which doesn't exist and see the rendered result.

Does this PR introduce a user-facing change?

完成系统异常的国际化

@f2c-ci-robot f2c-ci-robot bot added kind/feature Categorizes issue or PR as related to a new feature. release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Dec 25, 2022
@f2c-ci-robot f2c-ci-robot bot added this to the 2.1.x milestone Dec 25, 2022
@f2c-ci-robot f2c-ci-robot bot requested a review from guqing December 25, 2022 16:51
@f2c-ci-robot f2c-ci-robot bot added the kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API label Dec 25, 2022
@f2c-ci-robot f2c-ci-robot bot requested a review from ruibaby December 25, 2022 16:51
@f2c-ci-robot f2c-ci-robot bot added the area/core Issues or PRs related to the Halo Core label Dec 25, 2022
@JohnNiang JohnNiang changed the title WIP: Refine exception detail with i18n Refine exception detail with i18n Dec 26, 2022
@f2c-ci-robot f2c-ci-robot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 26, 2022
@JohnNiang
Copy link
Member Author

/assign @halo-dev/sig-halo

Copy link
Member

@ruibaby ruibaby left a comment

Choose a reason for hiding this comment

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

/lgtm

image

@f2c-ci-robot f2c-ci-robot bot added the lgtm Indicates that a PR is ready to be merged. label Dec 26, 2022
@f2c-ci-robot f2c-ci-robot bot removed the lgtm Indicates that a PR is ready to be merged. label Dec 26, 2022
Copy link
Member

@ruibaby ruibaby left a comment

Choose a reason for hiding this comment

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

/lgtm

@f2c-ci-robot f2c-ci-robot bot added the lgtm Indicates that a PR is ready to be merged. label Dec 26, 2022
@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Dec 26, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ruibaby

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@f2c-ci-robot f2c-ci-robot bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 26, 2022
@f2c-ci-robot f2c-ci-robot bot merged commit da55532 into halo-dev:main Dec 26, 2022
@guqing
Copy link
Member

guqing commented Dec 26, 2022

?? 就合并了

@guqing
Copy link
Member

guqing commented Dec 26, 2022

此 RP 将导致主题异常模板失效,始终只会渲染 Core 提供的默认异常模板

@JohnNiang JohnNiang deleted the feat/i18n-exception branch December 26, 2022 14:19
@ruibaby ruibaby modified the milestones: 2.1.x, 2.1.0 Dec 26, 2022
@longjuan longjuan mentioned this pull request Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/core Issues or PRs related to the Halo Core kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request to provide i18n error response
3 participants