Skip to content

Commit

Permalink
fix: make error messages more consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
kanedaaaa committed Mar 9, 2022
1 parent 31a0c7c commit 1caf48a
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion contracts/token/ERC1155/ERC1155.sol
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: caller is not owner nor approved"
"ERC1155: caller is not token owner nor approved"
);
_safeTransferFrom(from, to, id, amount, data);
}
Expand Down
4 changes: 2 additions & 2 deletions contracts/token/ERC1155/extensions/ERC1155Burnable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ abstract contract ERC1155Burnable is ERC1155 {
) public virtual {
require(
account == _msgSender() || isApprovedForAll(account, _msgSender()),
"ERC1155: caller is not owner nor approved"
"ERC1155: caller is not token owner nor approved"
);

_burn(account, id, value);
Expand All @@ -32,7 +32,7 @@ abstract contract ERC1155Burnable is ERC1155 {
) public virtual {
require(
account == _msgSender() || isApprovedForAll(account, _msgSender()),
"ERC1155: caller is not owner nor approved"
"ERC1155: caller is not token owner nor approved"
);

_burnBatch(account, ids, values);
Expand Down
2 changes: 1 addition & 1 deletion contracts/token/ERC721/ERC721.sol
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {

require(
_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
"ERC721: approve caller is not owner nor approved for all"
"ERC721: approve caller is not token owner nor approved for all"
);

_approve(to, tokenId);
Expand Down
2 changes: 1 addition & 1 deletion contracts/token/ERC721/extensions/ERC721Burnable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ abstract contract ERC721Burnable is Context, ERC721 {
*/
function burn(uint256 tokenId) public virtual {
//solhint-disable-next-line max-line-length
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved");
require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not token owner nor approved");
_burn(tokenId);
}
}
2 changes: 1 addition & 1 deletion test/token/ERC1155/ERC1155.behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ function shouldBehaveLikeERC1155 ([minter, firstTokenHolder, secondTokenHolder,
this.token.safeTransferFrom(multiTokenHolder, recipient, firstTokenId, firstAmount, '0x', {
from: proxy,
}),
'ERC1155: caller is not owner nor approved',
'ERC1155: caller is not token owner nor approved',
);
});
});
Expand Down
4 changes: 2 additions & 2 deletions test/token/ERC1155/extensions/ERC1155Burnable.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ contract('ERC1155Burnable', function (accounts) {
it('unapproved accounts cannot burn the holder\'s tokens', async function () {
await expectRevert(
this.token.burn(holder, tokenIds[0], amounts[0].subn(1), { from: other }),
'ERC1155: caller is not owner nor approved',
'ERC1155: caller is not token owner nor approved',
);
});
});
Expand All @@ -60,7 +60,7 @@ contract('ERC1155Burnable', function (accounts) {
it('unapproved accounts cannot burn the holder\'s tokens', async function () {
await expectRevert(
this.token.burnBatch(holder, tokenIds, [ amounts[0].subn(1), amounts[1].subn(2) ], { from: other }),
'ERC1155: caller is not owner nor approved',
'ERC1155: caller is not token owner nor approved',
);
});
});
Expand Down
4 changes: 2 additions & 2 deletions test/token/ERC721/ERC721.behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -509,15 +509,15 @@ function shouldBehaveLikeERC721 (errorPrefix, owner, newOwner, approved, another
context('when the sender does not own the given token ID', function () {
it('reverts', async function () {
await expectRevert(this.token.approve(approved, tokenId, { from: other }),
'ERC721: approve caller is not owner nor approved');
'ERC721: approve caller is not token owner nor approved');
});
});

context('when the sender is approved for the given token ID', function () {
it('reverts', async function () {
await this.token.approve(approved, tokenId, { from: owner });
await expectRevert(this.token.approve(anotherApproved, tokenId, { from: approved }),
'ERC721: approve caller is not owner nor approved for all');
'ERC721: approve caller is not token owner nor approved for all');
});
});

Expand Down

0 comments on commit 1caf48a

Please sign in to comment.