class ReadOnlySecretProviderError
extends Error
Since 0.5.0

Thrown when a secret is written through a provider that cannot store.

EnvProvider is the read-only provider: environment variables are process state, immutable at runtime. set is the provider's ONLY write method and rejects with this class, so both public write operations inherit the refusal from one site — SecretsService.rotate() delegates to provider.set(). It rejects, never throws synchronously: a synchronous throw from a method typed Promise<void> would bypass any caller using .catch(), the M52b/M52c/M70j defect class.

The status is 501, not 403: nothing is wrong with the caller or its credentials — the deployment's provider cannot perform the operation at all, which is what 501 means.

Examples

Example 1

import { ReadOnlySecretProviderError } from '@setu-ts/secrets-plugin';
try {
  await secrets.set('database/password', 'next');
} catch (err) {
  if (err instanceof ReadOnlySecretProviderError) {
    // The configured provider is read-only; use a writable provider.
  }
}

Constructors

ReadOnlySecretProviderError(provider: string)

Creates the error. The message is the full diagnostic — safe to log, never to serve.

Parameters
provider: string

The name of the read-only provider

Properties

readonly
name: string

Discriminant for consumers that cannot use instanceof across realms.

readonly
provider: string

The provider that refused the write (e.g. 'EnvProvider').

Usage

import { ReadOnlySecretProviderError } from "secrets-plugin/src/index.ts";