refactor(errors): introduce MissingEnvVarError for missing host env vars
Replace die()/RuntimeError at the point of detection with a typed MissingEnvVarError, and catch it in the CLI dispatcher alongside ManifestError. Library code stays free of stderr output; the CLI renders all user-facing error lines in one place. Sites updated: egress.egress_resolve_token_values (unset/empty token), git_gate._provision_dynamic_key and revoke_git_gate_provisioned_keys (missing forge_token_env), env.resolve_env (unset interpolated var). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+4
-2
@@ -35,6 +35,7 @@ import re
|
||||
import sys
|
||||
from dataclasses import dataclass, field
|
||||
|
||||
from .errors import MissingEnvVarError
|
||||
from .log import die
|
||||
from .manifest import Manifest
|
||||
|
||||
@@ -136,9 +137,10 @@ def resolve_env(manifest: Manifest) -> ResolvedEnv:
|
||||
host_var = env_entry_interpolated_from(raw)
|
||||
host_value = os.environ.get(host_var, "")
|
||||
if not host_value:
|
||||
die(
|
||||
raise MissingEnvVarError(
|
||||
host_var,
|
||||
f"env entry {name} is interpolated from ${host_var}, "
|
||||
f"but ${host_var} is unset or empty in the host environment."
|
||||
f"but ${host_var} is unset or empty in the host environment.",
|
||||
)
|
||||
forwarded[name] = host_value
|
||||
else: # literal
|
||||
|
||||
Reference in New Issue
Block a user