CipherStashDocs
StackLatestPackagesStackSrcErrorsInterfaces

EncryptionError

Base error interface returned by all encryption operations. Every operation that can fail returns `Result<T, EncryptionError>`. Use the `type` field to narr...

@cipherstash/stack


Interface: EncryptionError

Defined in: packages/stack/src/errors/index.ts:33

Base error interface returned by all encryption operations.

Every operation that can fail returns Result<T, EncryptionError>. Use the type field to narrow to a specific error kind, or use StackError for an exhaustive discriminated union.

Example

const result = await client.encrypt(value, opts)
if (result.failure) {
  switch (result.failure.type) {
    case EncryptionErrorTypes.EncryptionError:
      console.error('Encryption failed:', result.failure.message)
      break
    case EncryptionErrorTypes.LockContextError:
      console.error('Lock context issue:', result.failure.message)
      break
  }
}

Properties

type

type: string;

Defined in: packages/stack/src/errors/index.ts:34


message

message: string;

Defined in: packages/stack/src/errors/index.ts:35


code?

optional code: ProtectErrorCode;

Defined in: packages/stack/src/errors/index.ts:36

On this page