Skip to content

Commit

Permalink
revert: error symbol visibility changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Tkacz authored and CatchMe2 committed Oct 16, 2024
1 parent e94f398 commit f50a6c0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
5 changes: 1 addition & 4 deletions src/errors/InternalError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export type InternalErrorParams<T = ErrorDetails> = {
const INTERNAL_ERROR_SYMBOL = Symbol.for('INTERNAL_ERROR_KEY')

export class InternalError<T = ErrorDetails> extends Error {
readonly [INTERNAL_ERROR_SYMBOL] = true
public readonly details?: T
public readonly errorCode: string

Expand All @@ -25,10 +26,6 @@ export class InternalError<T = ErrorDetails> extends Error {
}
}

Object.defineProperty(InternalError.prototype, INTERNAL_ERROR_SYMBOL, {
value: true,
})

export function isInternalError(error: unknown): error is InternalError {
return (
isNativeError(error) &&
Expand Down
5 changes: 1 addition & 4 deletions src/errors/PublicNonRecoverableError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const PUBLIC_NON_RECOVERABLE_ERROR_SYMBOL = Symbol.for('PUBLIC_NON_RECOVERABLE_E
* This error is returned to the consumer of API
*/
export class PublicNonRecoverableError<T = ErrorDetails> extends Error {
readonly [PUBLIC_NON_RECOVERABLE_ERROR_SYMBOL] = true
public readonly details?: T
public readonly errorCode: string
public readonly httpStatusCode: number
Expand All @@ -31,10 +32,6 @@ export class PublicNonRecoverableError<T = ErrorDetails> extends Error {
}
}

Object.defineProperty(PublicNonRecoverableError.prototype, PUBLIC_NON_RECOVERABLE_ERROR_SYMBOL, {
value: true,
})

export function isPublicNonRecoverableError(error: unknown): error is PublicNonRecoverableError {
return (
isNativeError(error) &&
Expand Down

0 comments on commit f50a6c0

Please sign in to comment.