Skip to content

Commit

Permalink
fix: improve test on tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SkyHuss committed Nov 7, 2023
1 parent 9598b8f commit f2e774a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/datasource-sequelize/src/utils/error-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ export default async function handleErrors<T>(
throw new ValidationError(message);
}

throw new ValidationError(e.original);
throw new ValidationError(e);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@ describe('Utils > handleErrors', () => {
});

it('should rethrow other errors with details', async () => {
const error = new Error('');
const error = new Error('SequelizeDatabase error: expect a string instead of int');
const fn = () =>
handleErrors('delete', () => {
throw error;
});

await expect(fn).rejects.toThrow(ValidationError);
await expect(fn).rejects.toThrow('SequelizeDatabase error: expect a string instead of int');
});
});

0 comments on commit f2e774a

Please sign in to comment.