Skip to content

Commit

Permalink
Unify error (#332)
Browse files Browse the repository at this point in the history
* refactor: simplify error

* test: update error message

* chore: fix vulnerability
  • Loading branch information
Milena-Czierlinski authored Nov 18, 2024
1 parent 1e71a96 commit 42d9011
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 13 deletions.
5 changes: 3 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,9 @@ export class CreateAttributeRequestItemProcessor extends GenericRequestItemProce
return ValidationResult.success();
}

if (typeof recipient !== "undefined") {
return ValidationResult.error(
ConsumptionCoreErrors.requests.invalidRequestItem(
"The owner of the provided RelationshipAttribute for the `attribute` property can only be the Sender's Address, the Recipient's Address or an empty string. The latter will default to the Recipient's Address."
)
);
}

return ValidationResult.error(
ConsumptionCoreErrors.requests.invalidRequestItem(
"The owner of the provided RelationshipAttribute for the `attribute` property can only be the Sender's Address or an empty string. The latter will default to the Recipient's Address."
"The owner of the provided RelationshipAttribute for the `attribute` property can only be the address of the sender, recipient or an empty string. The latter will default to the address of the recipient."
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ describe("CreateAttributeRequestItemProcessor", function () {
await When.iCallCanCreateOutgoingRequestItemWith({ attribute: relationshipAttributeOfSomeoneElse });
await Then.theResultShouldBeAnErrorWith({
message:
"The owner of the provided RelationshipAttribute for the `attribute` property can only be the Sender's Address, the Recipient's Address or an empty string. The latter will default to the Recipient's Address."
"The owner of the provided RelationshipAttribute for the `attribute` property can only be the address of the sender, recipient or an empty string. The latter will default to the address of the recipient."
});
});

Expand All @@ -129,7 +129,7 @@ describe("CreateAttributeRequestItemProcessor", function () {
await When.iCallCanCreateOutgoingRequestItemWith({ attribute: relationshipAttributeOfSomeoneElse }, TestIdentity.UNDEFINED);
await Then.theResultShouldBeAnErrorWith({
message:
"The owner of the provided RelationshipAttribute for the `attribute` property can only be the Sender's Address or an empty string. The latter will default to the Recipient's Address."
"The owner of the provided RelationshipAttribute for the `attribute` property can only be the address of the sender, recipient or an empty string. The latter will default to the address of the recipient."
});
});
});
Expand Down

0 comments on commit 42d9011

Please sign in to comment.