From becf4a722824c71c1a382bfb7c407f81eee380cc Mon Sep 17 00:00:00 2001 From: Aryan Jassal Date: Thu, 12 Jun 2025 12:07:42 +1000 Subject: [PATCH] fix: library errors extend `ErrorQUIC` --- .gitignore | 3 +++ src/errors.ts | 8 ++++---- src/types.ts | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 331a2b48..dfae509b 100644 --- a/.gitignore +++ b/.gitignore @@ -128,3 +128,6 @@ dist .yarn/build-state.yml .yarn/install-state.gz .pnp.* + +# prettierrc for local editing +.prettierrc diff --git a/src/errors.ts b/src/errors.ts index d70d71f4..af889c68 100644 --- a/src/errors.ts +++ b/src/errors.ts @@ -1,4 +1,4 @@ -import type { POJO } from '@matrixai/errors'; +import type { POJO } from './types.js'; import type { ConnectionError, CryptoError } from './native/types.js'; import { AbstractError } from '@matrixai/errors'; @@ -6,15 +6,15 @@ class ErrorQUIC extends AbstractError { static description = 'QUIC error'; } -class ErrorQUICUndefinedBehaviour extends AbstractError { +class ErrorQUICUndefinedBehaviour extends ErrorQUIC { static description = 'You should never see this error'; } -class ErrorQUICHostInvalid extends AbstractError { +class ErrorQUICHostInvalid extends ErrorQUIC { static description = 'Host provided was not valid'; } -class ErrorQUICPortInvalid extends AbstractError { +class ErrorQUICPortInvalid extends ErrorQUIC { static description = 'Port provided was not valid'; } diff --git a/src/types.ts b/src/types.ts index aad435e0..d469193d 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,6 +1,8 @@ import type QUICStream from './QUICStream.js'; import type { CryptoError } from './native/types.js'; +type POJO = { [key: string]: any }; + /** * Opaque types are wrappers of existing types * that require smart constructors @@ -350,6 +352,7 @@ type StreamCodeToReason = (type: 'read' | 'write', code: number) => any; type QUICStreamMap = Map; export type { + POJO, Opaque, Class, Callback,