Skip to content

Commit b1b8465

Browse files
committed
feat: add MXIK unknown exception
1 parent caafb90 commit b1b8465

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/exceptions/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* Handle MXIK unknown exceptions
3+
*/
4+
export class MXIKUnknownException extends Error {
5+
constructor(message: any) {
6+
super(message)
7+
this.name = 'NotFoundException'
8+
}
9+
}

src/lib/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { MXIKSearchSymbol } from '../api'
22
import { MXIKSearchOptionsObj, MXIKSearchResponseObj } from '../typings'
3+
import { MXIKUnknownException } from '../exceptions'
34

45
/**
56
* Search items by keyword
@@ -22,6 +23,6 @@ export async function MXIKSearch(keyword: string, { limit }: MXIKSearchOptionsOb
2223
}
2324
}
2425
} catch (error) {
25-
throw error
26+
throw new MXIKUnknownException('Something wrong')
2627
}
2728
}

0 commit comments

Comments
 (0)