Skip to content

Commit af438d4

Browse files
authored
fix: Use consistent user not found error (#192)
1 parent d36dfdf commit af438d4

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/classes/User/User.spec.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ describe('User class', () => {
6161
it('should throw an error if get user by identifier returns an empty array', async () => {
6262
usersApiMock.listPaginatedUsers.mockResolvedValue({ users: [] } as unknown as ListPaginatedUsersResponse);
6363
await expect(user.getByIdentifier('[email protected]')).rejects.toThrow(PassageError);
64-
await expect(user.getByIdentifier('[email protected]')).rejects.toThrow(
65-
'Could not find user with that identifier.',
66-
);
64+
await expect(user.getByIdentifier('[email protected]')).rejects.toThrow('User not found.');
6765
});
6866
});

src/classes/User/User.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class User extends PassageBase {
5555

5656
const users = response.users;
5757
if (!users.length) {
58-
throw new PassageError('Could not find user with that identifier.');
58+
throw new PassageError('User not found.');
5959
}
6060

6161
return this.get(users[0].id);

0 commit comments

Comments
 (0)