]> git.codecow.com Git - nano25519.git/commitdiff
Errors module has no imports, so revert custom error location for better expectations.
authorChris Duncan <chris@codecow.com>
Thu, 15 Oct 2026 17:24:27 +0000 (10:24 -0700)
committerChris Duncan <chris@codecow.com>
Thu, 15 Oct 2026 17:24:27 +0000 (10:24 -0700)
src/lib/errors.ts
src/lib/primordials.ts

index b4176347887bd6a19dba2e548ec14a52bce6b642..d33333a6123b68557c273f77806f1f213d599fc3 100644 (file)
@@ -1,7 +1,18 @@
 //! SPDX-FileCopyrightText: 2026 Chris Duncan <chris@codecow.com>
 //! SPDX-License-Identifier: GPL-3.0-or-later
 
-import { Nano25519WasmError, } from './primordials'
+export class Nano25519MutexError extends Error { }
+Object.defineProperty(Nano25519MutexError, 'name', { value: 'Nano25519MutexError' })
+Object.freeze(Nano25519MutexError)
+export class Nano25519RangeError extends RangeError { }
+Object.defineProperty(Nano25519RangeError, 'name', { value: 'Nano25519RangeError' })
+Object.freeze(Nano25519RangeError)
+export class Nano25519TypeError extends TypeError { }
+Object.defineProperty(Nano25519TypeError, 'name', { value: 'Nano25519TypeError' })
+Object.freeze(Nano25519TypeError)
+export class Nano25519WasmError extends Error { }
+Object.defineProperty(Nano25519WasmError, 'name', { value: 'Nano25519WasmError' })
+Object.freeze(Nano25519WasmError)
 
 /**
  * Message text for the codes in `src/assembly/errors.ts`. The numbers are the
index f73e0fa3611b34b28f7cd93d545c7169b5613688..961b39393f5f09d96b4311134b9a951f64e51e3b 100644 (file)
@@ -1,6 +1,8 @@
 //! SPDX-FileCopyrightText: 2026 Chris Duncan <chris@codecow.com>
 //! SPDX-License-Identifier: GPL-3.0-or-later
 
+import { Nano25519RangeError, Nano25519TypeError, } from './errors'
+
 /**
  * Builtins captured once, when this module is evaluated, so that nothing on a
  * call path resolves a global or a prototype method that hostile code could
@@ -42,30 +44,6 @@ const objectCreate = Object.create
 export const objectDefineProperty = Object.defineProperty
 export const objectFreeze = Object.freeze
 
-/** Custom errors */
-class Nano25519MutexError extends Error { }
-objectDefineProperty(Nano25519MutexError, 'name', { value: 'Nano25519MutexError' })
-objectFreeze(Nano25519MutexError)
-
-class Nano25519RangeError extends RangeError { }
-objectDefineProperty(Nano25519RangeError, 'name', { value: 'Nano25519RangeError' })
-objectFreeze(Nano25519RangeError)
-
-class Nano25519TypeError extends TypeError { }
-objectDefineProperty(Nano25519TypeError, 'name', { value: 'Nano25519TypeError' })
-objectFreeze(Nano25519TypeError)
-
-class Nano25519WasmError extends Error { }
-objectDefineProperty(Nano25519WasmError, 'name', { value: 'Nano25519WasmError' })
-objectFreeze(Nano25519WasmError)
-
-export {
-       Nano25519MutexError,
-       Nano25519RangeError,
-       Nano25519TypeError,
-       Nano25519WasmError
-}
-
 /** Type aliases for legibility. */
 export type Bytes = Uint8Array<ArrayBuffer>
 export type Words = Uint32Array<ArrayBuffer>