JuteError

Enum JuteError 

Source
#[non_exhaustive]
pub enum JuteError {
Show 19 variants InvalidConversionToPremitive { token: String, }, UnexpectedToken { token: Option<String>, message: String, }, UnexpectedChar { c: char, message: String, }, UnexpectedEndOfTokenStream, UnexpectedEndOfFile, PathCanonicalizeError { message: String, }, UnTerminatedMultiLineComment, UnTerminatedQuotedString, QuotedStringWithNewLineCharacter, UnknownType { name: String, _type: String, record: String, module: String, file: PathBuf, }, AmbiguousType { name: String, _type: String, record: String, module: String, file: PathBuf, }, CircularDependency { cycle: String, }, Io(Error), Fmt(Error), Utf8(FromUtf8Error), DuplicateModuleName { module_name: String, file_name: PathBuf, }, DuplicateClassName { class_name: String, module_name: String, file_name: PathBuf, }, DuplicateFieldName { field_name: String, class_name: String, module_name: String, file_name: PathBuf, }, InvalidFieldType { field_type: String, field_name: String, class_name: String, module_name: String, file_name: PathBuf, },
}
Expand description

Top-level error type for the Jute compiler and code generator. JuteError represents all possible failures that can occur during:

  • Lexing
  • Parsing
  • Dependency resolution
  • Type validation
  • Code generation
  • I/O operations This enum is marked as #[non_exhaustive] to allow adding new error variants in the future without breaking downstream code. Consumers should match using a wildcard arm (_) to remain forward-compatible.

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.
§

InvalidConversionToPremitive

An invalid conversion was attempted from a token to a primitive type. This usually indicates a invalid token where permetive type was excepted

Fields

§token: String

The token that failed conversion.

§

UnexpectedToken

An unexpected token was encountered during parsing. This typically means the input does not conform to the Jute grammar.

Fields

§token: Option<String>

The token that was encountered (if any).

§message: String

Human-readable explanation of what was expected.

§

UnexpectedChar

An unexpected character was encountered during lexing.

Fields

§c: char

The unexpected character.

§message: String

Additional context about the error.

§

UnexpectedEndOfTokenStream

This usually indicates malformed or truncated input.

§

UnexpectedEndOfFile

The end of the source file was reached unexpectedly. Common causes include missing braces or incomplete declarations.

§

PathCanonicalizeError

Failed to canonicalize a filesystem path.

This can occur when resolving include paths or source file locations.

Fields

§message: String

Additional context explaining the failure.

§

UnTerminatedMultiLineComment

A multiline comment (/* ... */) was not properly terminated.

§

UnTerminatedQuotedString

A quoted string literal was not properly terminated.

§

QuotedStringWithNewLineCharacter

A quoted string literal contains a newline character,

§

UnknownType

A referenced type could not be resolved. Provides detailed context to help diagnose schema issues.

Fields

§name: String

Field name

§_type: String

Type

§record: String

Parrent record/class

§module: String

Parrent module

§file: PathBuf

Src File

§

AmbiguousType

This usually happens when two included modules define the same type name.

Fields

§name: String

The ambiguous type name.

§_type: String

The expected kind of the type.

§record: String

Record in which the ambiguity occurred.

§module: String

Module containing the record.

§file: PathBuf

Source file where the error occurred.

§

CircularDependency

A circular dependency was detected between modules. The cycle field describes the dependency loop.

Fields

§cycle: String

Human-readable representation of the dependency cycle.

§

Io(Error)

Wrapper around std::io::Error. Used for filesystem and I/O related failures.

§

Fmt(Error)

Wrapper around std::fmt::Error.

Typically occurs during code generation.

§

Utf8(FromUtf8Error)

Wrapper around UTF-8 decoding errors.

§

DuplicateModuleName

Duplicate module names detected across source files.

Fields

§module_name: String

Name of the duplicated module.

§file_name: PathBuf

File in which the duplicate was found.

§

DuplicateClassName

Duplicate class names detected within the same module.

Fields

§class_name: String

Name of the duplicated class.

§module_name: String

Module containing the duplicate.

§file_name: PathBuf

File in which the duplicate was found.

§

DuplicateFieldName

Duplicate field names detected within a class.

Fields

§field_name: String

Name of the duplicated field.

§class_name: String

Class containing the duplicate field.

§module_name: String

Module containing the class.

§file_name: PathBuf

File in which the duplicate was found.

§

InvalidFieldType

An invalid field type was used in a class definition.

Fields

§field_type: String

The invalid field type.

§field_name: String

Field name.

§class_name: String

Class containing the field.

§module_name: String

Module containing the class.

§file_name: PathBuf

File in which the error occurred.

Trait Implementations§

Source§

impl Debug for JuteError

Source§

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

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

impl Display for JuteError

Source§

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

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

impl Error for JuteError

Source§

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

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

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0§

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

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
§

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<Error> for JuteError

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.
Source§

impl From<Error> for JuteError

Source§

fn from(err: Error) -> Self

Converts to this type from the input type.
Source§

impl From<FromUtf8Error> for JuteError

Source§

fn from(err: FromUtf8Error) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

fn to_string(&self) -> String

Converts the given value to a String. Read more
§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.