Skip to content

Commit 4aa8ba3

Browse files
Merge #1607
1607: Update error inheritance to extend `MeiliSearchError` r=brunoocasali a=amit-ksh # Pull Request ## Related issue Fixes #1565 ## What does this PR do? - Ensure that the base error class(MeiliSearchError) inherits the standard error. - All other error classes inherit the MeiliSearchError. ## PR checklist Please check if your PR fulfills the following requirements: - [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)? - [x] Have you read the contributing guidelines? - [x] Have you made sure that the title is accurate and descriptive of the changes? Thank you so much for contributing to Meilisearch! Co-authored-by: amit-ksh <[email protected]>
2 parents 802c3c3 + 5028d7e commit 4aa8ba3

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

src/errors/meilisearch-api-error.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { MeiliSearchErrorInfo } from '../types'
2+
import { MeiliSearchError } from './meilisearch-error'
23

3-
const MeiliSearchApiError = class extends Error {
4+
const MeiliSearchApiError = class extends MeiliSearchError {
45
httpStatus: number
56
code: string
67
link: string

src/errors/meilisearch-communication-error.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { FetchError } from '../types'
2+
import { MeiliSearchError } from './meilisearch-error'
23

3-
class MeiliSearchCommunicationError extends Error {
4+
class MeiliSearchCommunicationError extends MeiliSearchError {
45
statusCode?: number
56
errno?: string
67
code?: string

src/errors/meilisearch-timeout-error.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
class MeiliSearchTimeOutError extends Error {
1+
import { MeiliSearchError } from './meilisearch-error'
2+
3+
class MeiliSearchTimeOutError extends MeiliSearchError {
24
constructor(message: string) {
35
super(message)
46

0 commit comments

Comments
 (0)