@chevre/domain 24.0.0-alpha.76 → 24.0.0-alpha.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -66,7 +66,7 @@ export declare class ActionProcessRepo<TAction extends IAction<factory.actionTyp
|
|
|
66
66
|
giveUp(params: {
|
|
67
67
|
typeOf: TAction['typeOf'];
|
|
68
68
|
id: string;
|
|
69
|
-
error: Error | Error[];
|
|
69
|
+
error: Error | Error[] | unknown;
|
|
70
70
|
recipe?: IRecipeAsActionAttributes<TActionRecipe['recipeCategory']>;
|
|
71
71
|
}): Promise<void>;
|
|
72
72
|
/**
|
|
@@ -32,6 +32,18 @@ exports.AVAILABLE_PROJECT_FIELDS = [
|
|
|
32
32
|
'target',
|
|
33
33
|
'identifier'
|
|
34
34
|
];
|
|
35
|
+
// 内部で正規化関数を定義(または外部ヘルパーを呼び出す)
|
|
36
|
+
function unknown2actionError(e) {
|
|
37
|
+
if (e instanceof Error) {
|
|
38
|
+
// Errorオブジェクトの場合は、既存のロジック通り展開
|
|
39
|
+
return { ...e, name: e.name, message: e.message };
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
// Error以外(文字列など)が投げられた場合のハンドリング
|
|
43
|
+
return { name: 'UnknownError', message: String(e) };
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
;
|
|
35
47
|
/**
|
|
36
48
|
* アクション状態管理リポジトリ
|
|
37
49
|
*/
|
|
@@ -535,9 +547,12 @@ class ActionProcessRepo {
|
|
|
535
547
|
* アクション失敗
|
|
536
548
|
*/
|
|
537
549
|
async giveUp(params) {
|
|
538
|
-
const actionError = (Array.isArray(params.error))
|
|
539
|
-
|
|
540
|
-
|
|
550
|
+
// const actionError: IActionError | IActionError[] = (Array.isArray(params.error))
|
|
551
|
+
// ? params.error.map((e) => ({ ...e, message: e.message, name: e.name }))
|
|
552
|
+
// : { ...params.error, message: params.error.message, name: params.error.name };
|
|
553
|
+
const actionError = Array.isArray(params.error)
|
|
554
|
+
? params.error.map(unknown2actionError)
|
|
555
|
+
: unknown2actionError(params.error);
|
|
541
556
|
if (params.recipe?.typeOf === 'Recipe') {
|
|
542
557
|
await this.upsertRecipe({ ...params.recipe, recipeFor: { id: params.id, typeOf: params.typeOf } });
|
|
543
558
|
}
|
package/package.json
CHANGED