Skip to content

Commit

Permalink
feat: add MXIK unknown exception
Browse files Browse the repository at this point in the history
  • Loading branch information
azabroflovski committed May 13, 2022
1 parent caafb90 commit b1b8465
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/exceptions/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* Handle MXIK unknown exceptions
*/
export class MXIKUnknownException extends Error {
constructor(message: any) {
super(message)
this.name = 'NotFoundException'
}
}
3 changes: 2 additions & 1 deletion src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { MXIKSearchSymbol } from '../api'
import { MXIKSearchOptionsObj, MXIKSearchResponseObj } from '../typings'
import { MXIKUnknownException } from '../exceptions'

/**
* Search items by keyword
Expand All @@ -22,6 +23,6 @@ export async function MXIKSearch(keyword: string, { limit }: MXIKSearchOptionsOb
}
}
} catch (error) {
throw error
throw new MXIKUnknownException('Something wrong')
}
}

0 comments on commit b1b8465

Please sign in to comment.