Skip to main content

Error

Enum Error 

Source
#[non_exhaustive]
pub enum Error {
Show 50 variants InvalidName { kind: NameKind, value: String, reason: &'static str, }, InsecureToken { url: RemoteUrl, }, NotAccepted { reason: &'static str, }, StdoutOutputs { target: Label, outputs: usize, }, CanonicalJson { source: Error, }, FloatRejected { path: String, }, UnreadableJson { source: Error, }, NonCanonicalJson { offset: usize, }, CorruptState { file: PathBuf, source: Box<Self>, }, Evaluation { provenance: Provenance, failure: EvaluationFailure, diagnostic: Diagnostic, }, MissingBuildFile { directory: Directory, requested_by: Option<Provenance>, }, InvalidDeclaration { provenance: Provenance, origin: Origin, order: DeclarationOrder, field: DeclarationField, source: Box<Self>, }, ActionConflict { provenance: Provenance, origin: Origin, order: DeclarationOrder, found: ActionFound, }, Nondeterministic { provenance: Provenance, first_run: Option<Box<Declaration>>, second_run: Option<Box<Declaration>>, }, DiscoveryChanged { label: Label, provenance: Provenance, }, DuplicateLabel { label: Label, sites: Vec<DeclarationSite>, }, DuplicateSetting { name: SettingName, sites: Vec<Provenance>, }, UnknownReference { site: Box<DeclarationSite>, field: DeclarationField, reference: Label, suggestion: Option<Label>, }, WrongReferenceKind { site: Box<DeclarationSite>, field: DeclarationField, reference: Label, found: DeclaredKind, declared_in: Provenance, }, UnknownSetting { site: Box<DeclarationSite>, name: String, suggestion: Option<SettingName>, }, DependencyCycle { path: Vec<DeclarationSite>, }, TooManyTargets { count: usize, }, Refused { want: Want, site: Option<Box<DeclarationSite>>, ceiling: Box<Ceiling>, }, PluginRefused { violation: Box<PluginViolation>, }, NotApproved { unapproved: Box<WantedSet>, reason: DenialReason, }, MissingTool { site: Box<DeclarationSite>, program: Program, }, PinnedEnv { name: EnvName, value: EnvValue, site: Box<DeclarationSite>, }, MissingInput { site: Box<DeclarationSite>, path: SourcePath, }, InputNotAFile { site: Box<DeclarationSite>, path: SourcePath, found: InputKind, }, UnknownOverride { name: SettingName, }, UnknownTarget { label: Label, suggestion: Option<Label>, }, NotATest { asked: Label, declared_with: TargetRole, site: Box<DeclarationSite>, }, InvalidQuery { expression: String, }, NoRun { label: Label, suggestion: Option<Label>, damaged: Vec<NonZeroUsize>, }, MissingOutput { label: Label, }, ForeignPlan, UploadUnsandboxed { which: UnsandboxedRemote, }, RemoteToken { from: TokenSource, }, RemoteSwitch { name: RemoteVariable, value: String, }, RemoteFlags { conflict: RemoteFlagConflict, }, OutputConflict { path: OutputPath, first: Box<DeclarationSite>, second: Box<DeclarationSite>, }, NoProgram { site: Box<DeclarationSite>, }, DispatcherFault { targets: Vec<Label>, }, LostBuildFiles { directories: Vec<Directory>, }, Adapter { port: PortName, diagnostic: Diagnostic, }, InvalidTree { fault: TreeFault, }, PluginTree { plugin: PluginName, path: PathBuf, }, PluginNotFetched { plugin: PluginName, reason: String, }, PluginChanged { plugin: PluginName, reason: String, }, PluginFetch { plugin: PluginName, diagnostic: Diagnostic, },
}
Expand description

Every way a call into this crate can fail.

Non-exhaustive: adding a variant is not a breaking change for downstream crates.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

InvalidName

A domain name did not satisfy its grammar.

Fields

§kind: NameKind

Which kind of name was being built.

§value: String

The rejected input, as given.

§reason: &'static str

Why the grammar rejected it.

§

InsecureToken

A remote cache is given a token but named by a grpc:// URL, which sends it unencrypted.

Fields

§url: RemoteUrl

The remote cache’s URL.

§

NotAccepted

A declaration holds a value its kind of target does not take.

Fields

§reason: &'static str

Why the declaration cannot hold the value.

§

StdoutOutputs

A target whose output is its stdout does not declare exactly one output.

Fields

§target: Label

The target.

§outputs: usize

How many outputs it declares.

§

CanonicalJson

A value could not be serialized as JSON at all.

Fields

§source: Error

The underlying serde_json failure.

§

FloatRejected

A floating-point number reached the canonical serializer.

Fields

§path: String

Where in the value the float was found, as a JSONPath-style location.

§

UnreadableJson

Bytes could not be read as a value: they are not JSON, or the JSON does not describe a valid value of the type asked for.

Fields

§source: Error

The underlying serde_json failure, which names the line and column.

§

NonCanonicalJson

Bytes describe a valid value, but are not the bytes the canonical serializer writes for it.

Fields

§offset: usize

The index of the first byte that differs from the canonical form of the value.

§

CorruptState

A file an adapter keeps a workspace’s state in does not hold what the adapter writes there.

Distinct from Error::Adapter, which is a file that could not be read at all: this one was read, and its content is refused. source is the reading failure, Error::UnreadableJson or Error::NonCanonicalJson.

Fields

§file: PathBuf

The file, as the adapter opened it.

§source: Box<Self>

Why its content was refused.

§

Evaluation

An adapter could not evaluate a build file.

Fields

§provenance: Provenance

The build file.

§failure: EvaluationFailure

What kind of failure it was.

§diagnostic: Diagnostic

The adapter’s message, for display only.

§

MissingBuildFile

A directory that had to be evaluated holds no build file.

Fields

§directory: Directory

The directory.

§requested_by: Option<Provenance>

The build file whose subdir call requested it; None for the workspace root.

§

InvalidDeclaration

A value in a declaration did not satisfy its grammar.

Fields

§provenance: Provenance

The build file.

§origin: Origin

Whose code made the declaration.

§order: DeclarationOrder

The call’s position in the file.

§field: DeclarationField

The field holding the value.

§source: Box<Self>

The grammar failure.

§

ActionConflict

A target named both or neither of rule and run.

Fields

§provenance: Provenance

The build file.

§origin: Origin

Whose code made the declaration.

§order: DeclarationOrder

The call’s position in the file.

§found: ActionFound

What was found instead of exactly one.

§

Nondeterministic

Two evaluations of the same workspace declared different things.

Fields

§provenance: Provenance

The build file to fix: the one whose declaration the other evaluation lacks.

§first_run: Option<Box<Declaration>>

The first evaluation’s declaration at the first difference; None past its end.

§second_run: Option<Box<Declaration>>

The second evaluation’s declaration at the first difference; None past its end.

§

DiscoveryChanged

The build files, evaluated with the results of the discovery targets, declared different discovery targets than they did without them.

Fields

§label: Label

The first discovery target, in declaration order, that one evaluation declared and the other did not or declared differently.

§provenance: Provenance

The build file that declares it.

§

DuplicateLabel

A label was declared more than once, as any mix of target, rule and alias.

Fields

§label: Label

The label.

§sites: Vec<DeclarationSite>

Every declaration of it, with its build file and whose code made it, in the declarations’ own order.

§

DuplicateSetting

A build setting was declared more than once.

Fields

§name: SettingName

The setting.

§sites: Vec<Provenance>

The build file of every declaration of it, in the declarations’ own order.

§

UnknownReference

A reference names a label nothing declares.

Fields

§site: Box<DeclarationSite>

The declaration holding the reference, and its build file.

§field: DeclarationField

Which field holds it: a dependency, a rule reference or an alias’s target.

§reference: Label

The label that was named.

§suggestion: Option<Label>

The nearest declared label the field could have named, if one is near enough.

§

WrongReferenceKind

A reference names a declaration of a kind its field cannot name.

Fields

§site: Box<DeclarationSite>

The declaration holding the reference, and its build file.

§field: DeclarationField

Which field holds it: a dependency, a rule reference or an alias’s target.

§reference: Label

The label that was named.

§found: DeclaredKind

What that label was declared as.

§declared_in: Provenance

The build file that declared it.

§

UnknownSetting

A command references a build setting nothing declares.

Fields

§site: Box<DeclarationSite>

The target or rule holding the reference in its command, or the rule holding it in its description, and its build file.

§name: String

The name after $opt:, as written.

§suggestion: Option<SettingName>

The nearest declared setting, if one is near enough.

§

DependencyCycle

The targets’ dependencies form a cycle.

Fields

§path: Vec<DeclarationSite>

The targets on the cycle, lowest label first; each depends on the next, and the last on the first.

§

TooManyTargets

The workspace declares more targets than the graph has ids for.

Fields

§count: usize

How many targets were declared.

§

Refused

A build wants something its workspace’s ceiling does not allow.

Fields

§want: Want

What was wanted.

§site: Option<Box<DeclarationSite>>

The lowest-labelled target wanting it, and its build file; None for a directory the build writes into, which the workspace names and no target declares.

§ceiling: Box<Ceiling>

What the workspace allows.

§

PluginRefused

A plugin’s target wants something its plugin does not allow.

Fields

§violation: Box<PluginViolation>

The want, the target that made it, and the plugin that does not allow it.

§

NotApproved

The approver did not approve what a build wants.

Fields

§unapproved: Box<WantedSet>

What was not approved.

§reason: DenialReason

Why, in words for the user.

§

MissingTool

A command names a program that cannot be found.

Fields

§site: Box<DeclarationSite>

The lowest-labelled target whose command names the program, and its build file.

§program: Program

The program.

§

PinnedEnv

A target declares an environment variable the workspace’s execution strategy sets itself.

Fields

§name: EnvName

The variable.

§value: EnvValue

The value the strategy gives it.

§site: Box<DeclarationSite>

The lowest-labelled target declaring the variable, and its build file.

§

MissingInput

A target reads a workspace file that does not exist.

Fields

§site: Box<DeclarationSite>

The lowest-labelled target declaring the input, and its build file.

§path: SourcePath

The file.

§

InputNotAFile

A target reads a workspace path that holds something other than a regular file.

Fields

§site: Box<DeclarationSite>

The lowest-labelled target declaring the input, and its build file.

§path: SourcePath

The path.

§found: InputKind

What stands there.

§

UnknownOverride

A setting was given a value for this run, but nothing declares it.

Fields

§name: SettingName

The setting that was named.

§

UnknownTarget

A run or a query was asked for a target, and no target or alias has that label.

Fields

§label: Label

The label that was asked for.

§suggestion: Option<Label>

The nearest declared target or alias, if one is near enough.

§

NotATest

A test run was asked for a target that is not a test.

Fields

§asked: Label

The label that was asked for.

§declared_with: TargetRole

The role the target it names was declared with, which says which function declared it.

§site: Box<DeclarationSite>

The target it names, which is the same label unless an alias was followed, and its build file.

§

InvalidQuery

A query was written in neither of the two forms a query takes.

Fields

§expression: String

The query as it was written.

§

NoRun

A log was asked for a target with no run in it.

Fields

§label: Label

The label that was asked for.

§suggestion: Option<Label>

The nearest label the log has a run for, if one is near enough.

§damaged: Vec<NonZeroUsize>

Every damaged line of the log, by number, in order: one of them may have been this target’s run.

§

MissingOutput

What a target printed in its last logged run is no longer in the content store.

Fields

§label: Label

The target whose output is gone.

§

ForeignPlan

A plan was handed over with a graph it was not made from.

§

UploadUnsandboxed

Uploading to the remote cache, or having the remote run actions, was asked for, and actions run bare.

A bare action can read files it did not declare, so a result it produced is not known to depend only on its declared inputs, and no one else could trust it.

Fields

§which: UnsandboxedRemote

What was asked for.

§

RemoteToken

The remote cache’s token is named, and cannot be used: the variable is unset or not text, the file is unreadable, or the token holds a character a header cannot carry.

The error names where the token should have come from and never holds the token itself.

Fields

§from: TokenSource

The variable or file the token was to come from.

§

RemoteSwitch

A remote cache switch variable holds something other than 1 or 0.

Fields

§name: RemoteVariable

The variable.

§value: String

What it holds, as text.

§

RemoteFlags

The remote cache flags of a run contradict each other or the workspace.

Fields

§conflict: RemoteFlagConflict

What is wrong with the combination.

§

OutputConflict

Two outputs would be written to one place: the same path, or a path that another output needs as a directory.

Fields

§path: OutputPath

The shorter of the two paths: the one both outputs need.

§first: Box<DeclarationSite>

The lower-labelled of the two targets, and its build file.

§second: Box<DeclarationSite>

The other target, and its build file; the same target when it declares both outputs.

§

NoProgram

A command names no program once its placeholders are expanded: it expanded to no argument, or its first argument is empty or still holds a $.

Fields

§site: Box<DeclarationSite>

The target whose command it is, and its build file.

§

DispatcherFault

The dispatcher returned success and left targets without an outcome: it lost a task, or the result of one, and with it everything that waited on that target.

Not an Error::Adapter: that carries an adapter’s own failure as text for display, while this names the targets left without an outcome, as data.

Fields

§targets: Vec<Label>

The targets without an outcome. Never empty; in label order.

§

LostBuildFiles

The dispatcher returned success and left build files unevaluated: it lost a task, or the result of one.

The load’s counterpart of Error::DispatcherFault, naming directories, not targets.

Fields

§directories: Vec<Directory>

The directories whose build file was not evaluated. Never empty; in directory order.

§

Adapter

An adapter could not do what a port asked of it.

Fields

§port: PortName

The port whose adapter failed.

§diagnostic: Diagnostic

The adapter’s message, for display only.

§

InvalidTree

A list of files is not a directory tree.

Fields

§fault: TreeFault

What is wrong with the list.

§

PluginTree

A plugin’s directory holds something other than regular files with Unicode names.

Fields

§plugin: PluginName

The plugin.

§path: PathBuf

The first such path found.

§

PluginNotFetched

A plugin buildl.toml names is not there to use: it is a directory that does not exist, a git plugin that buildl.lock does not pin as buildl.toml names it or whose store is missing, or a git revision that holds no file, or no folder at the plugin’s dir.

Fields

§plugin: PluginName

The plugin.

§reason: String

What is missing, and what to do about it.

§

PluginChanged

A plugin’s files are not the ones buildl.lock pinned: the store was changed after the plugin was fetched.

Fields

§plugin: PluginName

The plugin.

§reason: String

How the files differ from the lock.

§

PluginFetch

git could not fetch a plugin: it is not installed, or it refused the repository, the revision or the checkout.

Fields

§plugin: PluginName

The plugin.

§diagnostic: Diagnostic

What git printed, or why it could not be run, for display only.

Trait Implementations§

Source§

impl Debug for Error

Source§

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

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

impl Display for Error

Source§

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

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

impl Error for Error

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

Auto Trait Implementations§

§

impl !RefUnwindSafe for Error

§

impl !UnwindSafe for Error

§

impl Freeze for Error

§

impl Send for Error

§

impl Sync for Error

§

impl Unpin for Error

§

impl UnsafeUnpin for Error

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.