Skip to content

Commit c290aaa

Browse files
committed
chore: improve error thorwn messages
1 parent 5c8367d commit c290aaa

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

packages/helpers/src/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ const listFiles = async (dir) => {
4545
*/
4646
const getInfo = (asyncapi) => {
4747
if (!asyncapi) {
48-
throw new Error('Provided AsyncAPI document is invaild.');
48+
throw new Error('Make sure you pass AsyncAPI document as an argument.');
4949
}
5050
if (!asyncapi.info) {
51-
throw new Error('Provided AsyncAPI document doesn\'t contain info.');
51+
throw new Error('Provided AsyncAPI document doesn\'t contain Info object.');
5252
}
5353
const info = asyncapi.info();
5454
if (!info) {

packages/helpers/test/utils.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ describe('getInfo integration test with AsyncAPI', () => {
7171
it('should throw error when info method is missing', () => {
7272
const invalidAsyncAPIDocument = {};
7373
expect(() => getInfo(invalidAsyncAPIDocument)).toThrowError(
74-
'Provided AsyncAPI document doesn\'t contain info.'
74+
'Provided AsyncAPI document doesn\'t contain Info object.'
7575
);
7676
});
7777

78-
it('should throw error when AsyncAPI document is invalid', () => {
78+
it('should throw error when AsyncAPI document is missing', () => {
7979
expect(() => {
8080
getInfo(null);
81-
}).toThrow('Provided AsyncAPI document is invaild.');
81+
}).toThrow('Make sure you pass AsyncAPI document as an argument.');
8282
});
8383
});

0 commit comments

Comments
 (0)