-
Notifications
You must be signed in to change notification settings - Fork 0
業務例外発生時にexceptionIdとexceptionValuesが返却されるようにする #2746
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
Open
fkoyama
wants to merge
12
commits into
main
Choose a base branch
from
feature/業務例外発生時にexceptionIdとexceptionValuesが返却されるようにする
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
The head ref may contain hidden characters: "feature/\u696D\u52D9\u4F8B\u5916\u767A\u751F\u6642\u306BexceptionId\u3068exceptionValues\u304C\u8FD4\u5374\u3055\u308C\u308B\u3088\u3046\u306B\u3059\u308B"
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
bc11cbd
ErrorCodeの値をMaiaに合わせて修正。
fkoyama 17829f3
暫定的にBusinessExceptionの先頭のBusinessErrorのexceptionIdとexceptionValuesをレス…
fkoyama 6879517
エラーメッセージ情報を保持するErrorMessageBuilderをBusinessErrorで管理する形に修正。
fkoyama eaf24c3
単体テストコードを修正。
fkoyama d9489f6
ErrorCodeプロパティをExceptionIdに修正。
fkoyama d88ecdc
ErrorMessageクラスでメッセージを組み立てるロジックに変更。
fkoyama 4671637
ErrorMessageクラスのテストを追加し、BusinessErrorTestから不要なテストを削除。
fkoyama bafd4b9
First()をFirstOrDefault()に修正。
fkoyama fde8dd5
Merge branch 'main' into feature/業務例外発生時にexceptionIdとexceptionValuesが…
fkoyama 9af5680
ErrorMessage.Messageの実装を修正。
fkoyama 563a2ea
誤った引数を渡している部分を修正。XMLコメントの追加。
fkoyama 1867883
不要なsetterを削除。
fkoyama File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 5 additions & 2 deletions
7
samples/Dressca/dressca-backend/src/Dressca.ApplicationCore/Assets/AssetNotFoundException.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
using Dressca.ApplicationCore.Resources; | ||
using Dressca.SystemCommon; | ||
|
||
namespace Dressca.ApplicationCore.Assets; | ||
|
||
/// <summary> | ||
/// アセットが存在しないことを表す例外クラスです。 | ||
/// </summary> | ||
public class AssetNotFoundException : Exception | ||
public class AssetNotFoundException : BusinessException | ||
{ | ||
private const string ExceptionId = "assetNotFound"; | ||
|
||
/// <summary> | ||
/// 見つからなかったアセットコードを指定して | ||
/// <see cref="AssetNotFoundException"/> クラスの新しいインスタンスを初期化します。 | ||
/// </summary> | ||
/// <param name="assetCode">見つからなかった買い物かご Id 。</param> | ||
public AssetNotFoundException(string assetCode) | ||
: base(string.Format(Messages.AssetNotFound, assetCode)) | ||
: base(new BusinessError(ExceptionId, new ErrorMessage(Messages.AssetNotFound, assetCode))) | ||
{ | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 5 additions & 2 deletions
7
...es/Dressca/dressca-backend/src/Dressca.ApplicationCore/Ordering/OrderNotFoundException.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,23 @@ | ||
using Dressca.ApplicationCore.Resources; | ||
using Dressca.SystemCommon; | ||
|
||
namespace Dressca.ApplicationCore.Ordering; | ||
|
||
/// <summary> | ||
/// 注文情報が存在しないことを表す例外クラスです。 | ||
/// </summary> | ||
public class OrderNotFoundException : Exception | ||
public class OrderNotFoundException : BusinessException | ||
{ | ||
private const string ExceptionId = "orderNotFound"; | ||
|
||
/// <summary> | ||
/// 見つからなかった注文 Id と購入者 Id を指定して | ||
/// <see cref="OrderNotFoundException"/> クラスの新しいインスタンスを初期化します。 | ||
/// </summary> | ||
/// <param name="orderId">見つからなかった注文 Id 。</param> | ||
/// <param name="buyerId">見つからなかった購入者 Id 。</param> | ||
public OrderNotFoundException(long orderId, string buyerId) | ||
: base(string.Format(Messages.OrderNotFound, orderId, buyerId)) | ||
: base(new BusinessError(ExceptionId, new ErrorMessage(Messages.OrderNotFound, orderId, buyerId))) | ||
{ | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
samples/Dressca/dressca-backend/src/Dressca.SystemCommon/ErrorMessage.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
namespace Dressca.SystemCommon; | ||
|
||
/// <summary> | ||
/// エラーメッセージの情報を保持するクラスです。 | ||
/// </summary> | ||
public class ErrorMessage | ||
{ | ||
/// <summary> | ||
/// <see cref="ErrorMessage"/> クラスの新しいインスタンスを初期化します。 | ||
/// </summary> | ||
/// <param name="errorMessage"> | ||
/// エラーメッセージ。<br /> | ||
/// このパラメーターにはメッセージ用の定数クラスで定義した値を指定します。 | ||
/// ユーザーやDB等の外部からの入力値は指定しないでください。 | ||
/// </param> | ||
/// <param name="errorMessageValues">エラーメッセージのプレースホルダーの値。</param> | ||
public ErrorMessage(string errorMessage, params object[] errorMessageValues) | ||
{ | ||
this.ErrorMessageValues = errorMessageValues; | ||
this.Message = errorMessage is null ? string.Empty : string.Format(errorMessage, this.ErrorMessageValues); | ||
} | ||
|
||
/// <summary> | ||
/// エラーメッセージを表す文字列を取得します。 | ||
/// </summary> | ||
public string Message { get; private set; } | ||
|
||
/// <summary> | ||
/// エラーメッセージのプレースホルダーの値を取得します。 | ||
/// </summary> | ||
public object[] ErrorMessageValues { get; } | ||
|
||
/// <inheritdoc/> | ||
public override string ToString() | ||
{ | ||
return this.Message; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.