ParseFileError (src/error.rs)

sway · swayfmt/src/error.rs · rust · Apache-2.0
dev-tools, tag:knn-classified

Defines ParseFileError and related error types for formatting and configuration errors.

// Source: https://github.com/FuelLabs/sway | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
use std::{io, path::PathBuf};
use sway_error::error::CompileError;
use thiserror::Error;

#[derive(Debug, Clone, PartialEq, Eq, Hash, Error)]
#[error("Unable to parse: {}", self.0.iter().map(|x| x.to_string()).collect::<Vec<String>>().join("\n"))]
pub struct ParseFileError(pub Vec<CompileError>);

#[derive(Debug, Error)]
pub enum FormatterError {
    #[error("Error parsing file: {0}")]
    ParseFileError(#[from] ParseFileError),
    #[error("Error formatting a message into a stream: {0}")]
    FormatError(#[from] std::fmt::Error),
    #[error("Error while adding comments")]
    CommentError

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key