forked from open-feature/js-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: errorCode as enum, reason as string (open-feature#244)
- makes errorCode an enum - makes reason a string - adds errorMessage to resolution/evaluation details
- Loading branch information
Showing
19 changed files
with
196 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { ErrorCode } from '../types'; | ||
import { OpenFeatureError } from './open-feature-error-abstract'; | ||
|
||
export class GeneralError extends OpenFeatureError { | ||
code: ErrorCode; | ||
constructor(message?: string) { | ||
super(message); | ||
Object.setPrototypeOf(this, GeneralError.prototype); | ||
this.name = 'GeneralError'; | ||
this.code = ErrorCode.GENERAL; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
export * from './codes'; | ||
export * from './general-error'; | ||
export * from './flag-not-found-error'; | ||
export * from './parse-error'; | ||
export * from './type-mismatch-error'; | ||
export * from './error-abstract'; | ||
export * from './targeting-key-missing-error'; | ||
export * from './invalid-context-error'; | ||
export * from './open-feature-error-abstract'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { ErrorCode } from '../types'; | ||
import { OpenFeatureError } from './open-feature-error-abstract'; | ||
|
||
export class InvalidContextError extends OpenFeatureError { | ||
code: ErrorCode; | ||
constructor(message?: string) { | ||
super(message); | ||
Object.setPrototypeOf(this, InvalidContextError.prototype); | ||
this.name = 'InvalidContextError'; | ||
this.code = ErrorCode.INVALID_CONTEXT; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
src/errors/error-abstract.ts → src/errors/open-feature-error-abstract.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { ErrorCode } from '../types'; | ||
import { OpenFeatureError } from './open-feature-error-abstract'; | ||
|
||
export class TargetingKeyMissingError extends OpenFeatureError { | ||
code: ErrorCode; | ||
constructor(message?: string) { | ||
super(message); | ||
Object.setPrototypeOf(this, TargetingKeyMissingError.prototype); | ||
this.name = 'TargetingKeyMissingError'; | ||
this.code = ErrorCode.TARGETING_KEY_MISSING; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export * from './open-feature'; | ||
export * from './types'; | ||
export * from './errors/index'; | ||
export * from './errors'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.