Skip to content

Commit

Permalink
Merge #1607
Browse files Browse the repository at this point in the history
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 <ksamit1110@gmail.com>
  • Loading branch information
meili-bors[bot] and amit-ksh authored Dec 11, 2023
2 parents 802c3c3 + 5028d7e commit 4aa8ba3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/errors/meilisearch-api-error.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { MeiliSearchErrorInfo } from '../types'
import { MeiliSearchError } from './meilisearch-error'

const MeiliSearchApiError = class extends Error {
const MeiliSearchApiError = class extends MeiliSearchError {
httpStatus: number
code: string
link: string
Expand Down
3 changes: 2 additions & 1 deletion src/errors/meilisearch-communication-error.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { FetchError } from '../types'
import { MeiliSearchError } from './meilisearch-error'

class MeiliSearchCommunicationError extends Error {
class MeiliSearchCommunicationError extends MeiliSearchError {
statusCode?: number
errno?: string
code?: string
Expand Down
4 changes: 3 additions & 1 deletion src/errors/meilisearch-timeout-error.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
class MeiliSearchTimeOutError extends Error {
import { MeiliSearchError } from './meilisearch-error'

class MeiliSearchTimeOutError extends MeiliSearchError {
constructor(message: string) {
super(message)

Expand Down

0 comments on commit 4aa8ba3

Please sign in to comment.