Skip to main content

PackagingError

Enum PackagingError 

Source
pub enum PackagingError {
Show 21 variants ConfigMissing { root: PathBuf, }, ConfigRead { path: PathBuf, source: Error, }, ConfigParse { path: PathBuf, source: Error, }, ConfigInvalid { field: String, reason: String, }, SchemaRead { path: PathBuf, source: Error, }, SchemaParse { path: PathBuf, source: Error, }, ProjectNotBuilt { missing: PathBuf, }, GleamTomlMissing { path: PathBuf, }, GleamMetadataRead { path: PathBuf, source: Error, }, GleamMetadataParse { path: PathBuf, source: Error, }, DependencyUnresolved { package: String, }, BeamRead { path: PathBuf, source: Error, }, ModuleNameNotUtf8 { path: PathBuf, }, DuplicateModule { module: String, first: String, second: String, }, EntryModuleNotFound { module: String, searched: PathBuf, }, SourceRead { path: PathBuf, source: Error, }, PathEscapesRoot { field: String, path: PathBuf, }, OutputConflict { first: String, second: String, path: PathBuf, }, OutputOverrideAmbiguous { count: usize, }, OutputWrite { path: PathBuf, source: PackageError, }, Package(PackageError),
}
Expand description

Errors produced while packaging a built Gleam workflow project.

Every variant carries the offending path, field, or module as structured data — not just formatted text — so callers can map variants to actionable guidance (for example, PackagingError::ProjectNotBuilt maps to “run gleam build”).

Variants§

§

ConfigMissing

The project root contains no workflow.toml packaging descriptor.

Fields

§root: PathBuf

Project root that was searched for the descriptor.

§

ConfigRead

The workflow.toml descriptor exists but could not be read.

Fields

§path: PathBuf

Path of the descriptor that could not be read.

§source: Error

I/O failure reported while reading the descriptor.

§

ConfigParse

The workflow.toml descriptor is not valid TOML for the schema.

The wrapped error carries unknown-key detail: every table rejects unrecognised keys, naming the key and its location.

Fields

§path: PathBuf

Path of the descriptor that failed to parse.

§source: Error

TOML deserialisation failure, including unknown-key detail.

§

ConfigInvalid

The workflow.toml descriptor parsed but failed semantic validation.

Fields

§field: String

Descriptor field that failed validation, e.g. workflow[0].entry_module.

§reason: String

Human-readable reason the field value was rejected.

§

SchemaRead

A declared JSON-Schema file could not be read.

Fields

§path: PathBuf

Resolved path of the schema file that could not be read.

§source: Error

I/O failure reported while reading the schema file.

§

SchemaParse

A declared JSON-Schema file is not valid JSON.

Fields

§path: PathBuf

Resolved path of the schema file that failed to parse.

§source: Error

JSON parsing failure reported by serde_json.

§

ProjectNotBuilt

The compiled Erlang output required for packaging does not exist.

Fields

§missing: PathBuf

Build-output path that was required but absent.

§

GleamTomlMissing

The project root contains no gleam.toml, so it is not a Gleam project.

Fields

§path: PathBuf

Path where gleam.toml was expected.

§

GleamMetadataRead

A Gleam metadata file (gleam.toml or the manifest.toml lockfile) could not be read.

Fields

§path: PathBuf

Path of the metadata file that could not be read.

§source: Error

I/O failure reported while reading the metadata file.

§

GleamMetadataParse

A Gleam metadata file could not be parsed as the expected TOML shape.

Fields

§path: PathBuf

Path of the metadata file that failed to parse.

§source: Error

TOML deserialisation failure reported while parsing the file.

§

DependencyUnresolved

A production dependency named in gleam.toml is absent from the manifest.toml lockfile, so the dependency closure cannot be computed.

Fields

§package: String

Gleam package name that could not be resolved in the lockfile.

§

BeamRead

A compiled .beam module (or its containing directory) could not be read.

Fields

§path: PathBuf

Path of the compiled module or module directory that failed to read.

§source: Error

I/O failure reported while reading the compiled output.

§

ModuleNameNotUtf8

A compiled module filename is not valid UTF-8 and cannot become a logical module name.

Fields

§path: PathBuf

Path whose filename failed UTF-8 decoding.

§

DuplicateModule

Two Gleam packages in the production dependency closure provide the same logical module name.

Fields

§module: String

Logical module name provided more than once.

§first: String

Gleam package that provided the module first.

§second: String

Gleam package that provided the module again.

§

EntryModuleNotFound

A declared workflow entry module is absent from the compiled output.

Fields

§module: String

Entry module declared by workflow.toml.

§searched: PathBuf

Compiled-output directory that was searched.

§

SourceRead

A first-party Gleam source file could not be read for inclusion.

Fields

§path: PathBuf

Path of the source file or directory that could not be read.

§source: Error

I/O failure reported while reading the source tree.

§

PathEscapesRoot

A workflow.toml-declared path is absolute or escapes the project root after lexically folding . and .. components.

Only descriptor-sourced paths (output, input_schema, output_schema) are confined to the root; the programmatic PackageOptions::output_override is the caller’s own path and is intentionally exempt.

Fields

§field: String

Descriptor field that declared the path, e.g. workflow[0].output.

§path: PathBuf

The offending path exactly as declared in the descriptor.

§

OutputConflict

Two workflows resolve to the same output archive path.

Fields

§first: String

Entry module of the workflow that claimed the path first.

§second: String

Entry module of the workflow that claimed the path again.

§path: PathBuf

Output path claimed by both workflows.

§

OutputOverrideAmbiguous

An output override was supplied for a project declaring multiple workflows.

Fields

§count: usize

Number of workflows the project declares.

§

OutputWrite

A workflow’s .aion archive could not be built or written to its resolved output path.

Unlike the transparent PackagingError::Package variant, this one names the output path, so “No such file or directory”-style I/O failures identify the file that could not be written.

Fields

§path: PathBuf

Resolved output path the archive could not be written to.

§source: PackageError

Package-format failure reported while building or writing.

§

Package(PackageError)

A package-format failure surfaced while building, writing, or re-loading an archive (reserved module names, write I/O, verify-after-write).

Trait Implementations§

Source§

impl Debug for PackagingError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for PackagingError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for PackagingError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<PackageError> for PackagingError

Source§

fn from(source: PackageError) -> Self

Converts to this type from the input type.
Source§

impl From<PackagingError> for CodegenError

Source§

fn from(source: PackagingError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.