#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("invalid auth root private key: {0}")]
AuthPrivKey(String),
#[error("invalid auth root public key: {0}")]
AuthPubKey(String),
#[error(
"refusing to bind {addr} with control-plane auth disabled: an \
unauthenticated control plane must not be exposed to a non-loopback \
address. Configure auth keys, bind a loopback address, or set the `dev` \
security profile / `allow_unauthenticated_public_bind` for local dev"
)]
UnauthenticatedPublicBind { addr: std::net::SocketAddr },
#[cfg(feature = "handlers")]
#[error("handlers SQL binding: env var {0} is not set")]
SqlEnvUnset(String),
#[cfg(feature = "handlers")]
#[error("handlers SQL binding: `url` (cluster sqld) requires `admin_url`")]
SqlAdminUrlRequired,
#[cfg(feature = "handlers")]
#[error("handlers SQL binding: unknown preview_mode {0:?} (expected empty | branch | shared)")]
UnknownPreviewMode(String),
#[cfg(feature = "handlers")]
#[error("handlers SQL binding: reading preview_init {path:?}: {source}")]
PreviewInitRead {
path: std::path::PathBuf,
#[source]
source: std::io::Error,
},
#[cfg(any(feature = "sql-postgres", feature = "sql-mysql"))]
#[error("handlers SQL binding: external database {name:?} has unknown kind {kind:?} (expected postgres | mysql)")]
SqlExternalKind { name: String, kind: String },
#[cfg(any(feature = "sql-postgres", feature = "sql-mysql"))]
#[error("handlers SQL binding: external database {0:?} is missing `url_env`")]
SqlExternalUrlEnvMissing(String),
#[cfg(any(feature = "sql-postgres", feature = "sql-mysql"))]
#[error("handlers SQL binding: external database {name:?}: {source}")]
SqlExternalConnect {
name: String,
#[source]
source: boatramp_core::sql::SqlError,
},
#[cfg(any(feature = "sql-postgres", feature = "sql-mysql"))]
#[error(
"handlers SQL binding: managed database {0:?} needs a `[secrets]` envelope to seal its \
generated credential — set `[secrets]` (envelope = \"local\" or \"vault\"), or supply \
`password_env` to bring your own"
)]
SqlManagedNeedsSecrets(String),
#[cfg(any(feature = "sql-postgres", feature = "sql-mysql"))]
#[error("handlers SQL binding: managed database {name:?}: {reason}")]
SqlManagedCredential { name: String, reason: String },
#[cfg(all(
feature = "handlers",
not(any(feature = "sql-postgres", feature = "sql-mysql"))
))]
#[error("handlers SQL binding: external database {0:?} needs an external SQL engine — rebuild with --features sql-postgres and/or sql-mysql")]
SqlExternalUnavailable(String),
#[cfg(not(feature = "slatedb"))]
#[error("this build has no slatedb support; rebuild with `--features slatedb`")]
NoSlatedbSupport,
#[cfg(not(feature = "cloudflare-kv"))]
#[error("this build has no Cloudflare KV support; rebuild with `--features cloudflare-kv`")]
NoCloudflareKvSupport,
#[cfg(any(feature = "slatedb", feature = "cloudflare-kv"))]
#[error(transparent)]
Kv(#[from] boatramp_core::kv::KvError),
#[cfg(not(feature = "fs"))]
#[error("this build has no filesystem blob support; rebuild with `--features fs`")]
NoFsSupport,
#[cfg(not(feature = "s3"))]
#[error("this build has no S3 support; rebuild with `--features s3`")]
NoS3Support,
#[cfg(not(feature = "gcs"))]
#[error("this build has no GCS support; rebuild with `--features gcs`")]
NoGcsSupport,
#[cfg(not(feature = "azure"))]
#[error("this build has no Azure support; rebuild with `--features azure`")]
NoAzureSupport,
#[cfg(feature = "s3")]
#[error("--s3-bucket is required for --blobs s3")]
S3BucketRequired,
#[cfg(feature = "gcs")]
#[error("--gcs-bucket is required for --blobs gcs")]
GcsBucketRequired,
#[cfg(feature = "gcs")]
#[error("GCS backend: {0}")]
GcsConnect(String),
#[cfg(feature = "azure")]
#[error("--azure-account and --azure-container are required for --blobs azure")]
AzureConfigRequired,
#[cfg(feature = "azure")]
#[error("Azure backend: {0}")]
AzureConnect(String),
#[cfg(feature = "handlers")]
#[error(transparent)]
Handler(#[from] boatramp_handlers::HandlerError),
#[error("secrets envelope: {0}")]
Envelope(String),
}
pub type Result<T> = std::result::Result<T, Error>;