Skip to content

Commit

Permalink
chore: export errors
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm committed Aug 20, 2024
1 parent e96771d commit c0206d8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Errors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ test('exports', () => {
"SizeExceedsPaddingSizeError",
"SizeOverflowError",
"SliceOffsetOutOfBoundsError",
"SiweInvalidMessageFieldError",
"InvalidPrimaryTypeError",
]
`)
})
4 changes: 4 additions & 0 deletions src/Errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ export {
} from './internal/errors/data.js'

export type { GlobalErrorType } from './internal/errors/error.js'

export { SiweInvalidMessageFieldError } from './internal/errors/siwe.js'

export { InvalidPrimaryTypeError } from './internal/errors/typedData.js'
1 change: 1 addition & 0 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ test('exports', () => {
"Secp256k1",
"Signature",
"Rlp",
"Siwe",
"TypedData",
"Types",
"Value",
Expand Down
19 changes: 19 additions & 0 deletions src/internal/errors/typedData.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { expect, test } from 'vitest'

import * as typedData from '../../../test/constants/typedData.js'
import { InvalidPrimaryTypeError } from './typedData.js'

test('InvalidPrimaryTypeError', () => {
expect(
new InvalidPrimaryTypeError({
primaryType: 'Boo',
types: typedData.complex.types,
}),
).toMatchInlineSnapshot(`
[InvalidPrimaryTypeError: Invalid primary type \`Boo\` must be one of \`["Name","Person","Mail"]\`.
Check that the primary type is a key in \`types\`.
See: https://oxlib.sh/errors#invalidprimarytypeerror]
`)
})

0 comments on commit c0206d8

Please sign in to comment.