Skip to main content

Code

Enum Code 

Source
pub enum Code {
Show 64 variants InvalidCharacter, InvalidFrontMatter, UnterminatedString, UnterminatedExpression, UnexpectedEof, InvalidJsxSelfClosingTag, UnterminatedJsxTag, InvalidJsxClosingTag, InvalidJsxAttribute, UnterminatedCodeBlock, EmptyFrontMatter, UnterminatedLink, UnterminatedImage, UnterminatedInlineCode, UnterminatedCodeBlockBlock, UnterminatedJsxOpenTag, UnterminatedJsxCloseTag, UnterminatedJsxExpression, UnterminatedMdComment, UnterminatedFrontmatter, MismatchedJsxCloseTag, TableShapeMismatch, StraySetextUnderline, MissingJsxAttributeValue, ListMarkerOverflow, EmptyFrontmatter, InvalidFrontmatterYaml, HeadingLevelClamped, RecoveredUnterminatedJsx, ImportFileNotFound, InvalidLineRange, RegistryIndexUnreadable, RegistryIndexMalformed, RegistryEntryNotFound, RegistrySourceUnreadable, ComponentSourceUnreadable, AssetCopyFailed, MermaidRenderFailed, MmdcUnavailable, MissingComponentAttr, AssetSourceMissing, BaseDirNotFound, KatexOpts, ThemeNotBundled, MalformedJsxTagName, MdxTableUnsupported, HtmlExpressionDropped, NoRootDir, NoConfig, NoCollections, CollectionNotFound, CollectionPatternNotFound, CollectionSchemaNotFound, InvalidConfig, InvalidConfigPath, ConfigExists, IoRead, IoWrite, IoCreateDir, JsonDeserialize, JsonSerialize, LockPoisoned, IoRecoverable, Custom { code: String, severity: Severity, },
}
Expand description

Stable, machine-readable diagnostic identifiers spanning the whole pipeline. Codes use disjoint string namespaces per layer:

  • E*** - lexer errors (feature lexer)
  • W*** - lexer warnings (feature lexer)
  • P*** - parser errors (feature parser)
  • PW*** - parser warnings (feature parser)
  • T*** - transform errors (feature transform)
  • TW*** - transform warnings (feature transform)
  • G*** - codegen errors (feature codegen)
  • GW*** - codegen warnings (feature codegen)
  • C*** - core / engine errors (feature core)
  • CW*** - core / engine warnings (feature core)
  • S*** - shared cross-cutting errors (IO, JSON, locks; always available)
  • SW*** - shared cross-cutting warnings (always available)

Custom { code, severity } is the escape hatch for third-party transformers that want to emit through the same engine without forking this enum.

Variants§

§

InvalidCharacter

E001 - Source byte the dispatcher cannot map to any token rule.

§

InvalidFrontMatter

E002 - Frontmatter --- opened but inner YAML is malformed.

§

UnterminatedString

E003 - Quoted string literal opened without a closer before EOL/EOF.

§

UnterminatedExpression

E004 - { ... } expression opened but brace depth never returned to zero.

§

UnexpectedEof

E005 - EOF reached mid-construct where more input was required.

§

InvalidJsxSelfClosingTag

E006 - <Tag / seen but the closing > is missing.

§

UnterminatedJsxTag

E007 - <Tag ... open tag never reached > or /> before a hard break/EOF.

§

InvalidJsxClosingTag

E008 - </Tag close tag malformed: missing name or >.

§

InvalidJsxAttribute

E009 - JSX attribute name= had no following value (string / {expr}).

§

UnterminatedCodeBlock

E010 - Fenced code block opened without an equal-length closer before EOF.

§

EmptyFrontMatter

W001 - Frontmatter parsed cleanly but YAML body was empty.

P001 - [text](href) opened but ] never seen before a hard break/EOF.

§

UnterminatedImage

P002 - ![alt](src) opened but ] never seen before a hard break/EOF.

§

UnterminatedInlineCode

P003 - Backtick run inline never closes on the same line.

§

UnterminatedCodeBlockBlock

P004 - Fenced code block opened but matching ``` (or longer) never seen.

§

UnterminatedJsxOpenTag

P005 - <Tag ... opened but no > / /> before the next block break.

§

UnterminatedJsxCloseTag

P006 - </Tag opened but no > before the next block break.

§

UnterminatedJsxExpression

P007 - { ... } expression opened but no closing } at matching depth.

§

UnterminatedMdComment

P008 - {/* ... */} markdown comment opened but no */} before EOF.

§

UnterminatedFrontmatter

P009 - Frontmatter --- opened but no closing --- line found.

§

MismatchedJsxCloseTag

P010 - <Foo> close-tag name does not match the most recent open tag.

§

TableShapeMismatch

P011 - Table header line had N cells but alignment row had M (M != N).

§

StraySetextUnderline

P012 - Setext underline === / --- appeared without a preceding paragraph.

§

MissingJsxAttributeValue

P013 - JSX attribute appeared with = but no value (string / {expr}).

§

ListMarkerOverflow

P014 - List item used an ordered marker number that overflows u32.

§

EmptyFrontmatter

PW001 - Frontmatter parsed but YAML content was empty.

§

InvalidFrontmatterYaml

PW002 - YAML in frontmatter failed to parse; recovered by treating as null.

§

HeadingLevelClamped

PW003 - Heading level > 6 was clamped to 6.

§

RecoveredUnterminatedJsx

PW004 - Auto-recovery synthesised a self-close for <Tag ... to keep parsing.

§

ImportFileNotFound

T001 - CodeImport: file=path referenced a path that could not be read.

§

InvalidLineRange

T002 - CodeImport: {ranges} spec was malformed.

§

RegistryIndexUnreadable

T003 - ComponentPreview: registry_index JSON file failed to read.

§

RegistryIndexMalformed

T004 - ComponentPreview: registry_index content was not valid JSON.

§

RegistryEntryNotFound

T005 - ComponentPreview: requested name not found in the registry index.

§

RegistrySourceUnreadable

T006 - ComponentPreview: registry entry’s first file path could not be read.

§

ComponentSourceUnreadable

T007 - ComponentSource: path= attribute pointed to an unreadable file.

§

AssetCopyFailed

T008 - CopyLinkedFiles: write to assets_dir failed mid-publish.

§

MermaidRenderFailed

T009 - Mermaid: mmdc exited non-zero or produced no SVG.

§

MmdcUnavailable

TW001 - Mermaid: mmdc CLI is not on PATH; the transformer becomes a no-op.

§

MissingComponentAttr

TW002 - ComponentPreview / ComponentSource: required name / path attribute is missing.

§

AssetSourceMissing

TW003 - CopyLinkedFiles: a referenced asset path did not exist; original src / href preserved.

§

BaseDirNotFound

TW004 - CodeImport / ComponentSource: non-disk source (Origin::Stdin / Inline / Memory) without an explicit base_dir, so relative file= / path= paths can’t be resolved.

§

KatexOpts

TW006 - Math (KaTeX): katex::Opts::builder().build() failed; the resulting renderer falls back to a no-op rendering for the affected span. Almost always a sign of a broken build (the args are constants).

§

ThemeNotBundled

TW005 - PrettyCode: a configured theme name is not present in the bundled syntect themes. Highlight falls back to the first bundled theme, so the missing mode silently produces wrong colors. The diagnostic lists every bundled theme so consumers can pick a valid one.

§

MalformedJsxTagName

G001 - Codegen encountered a JSX tag with an empty / invalid name.

§

MdxTableUnsupported

GW001 - MdxBodyEmitter: GFM Table node dropped (no inline table renderer yet). Run disable-gfm first to convert tables to plain text.

§

HtmlExpressionDropped

GW002 - HtmlEmitter: raw JsxExpression discarded (HTML output can’t run JS); use the MDX body emitter for full JSX support.

§

NoRootDir

C001 - No root dir configured.

§

NoConfig

C002 - No config file found.

§

NoCollections

C003 - No collections configured.

§

CollectionNotFound

C004 - Collection not found.

§

CollectionPatternNotFound

C005 - Collection pattern not found.

§

CollectionSchemaNotFound

C006 - Collection schema not found.

§

InvalidConfig

C007 - Invalid config.

§

InvalidConfigPath

C008 - Invalid config path.

§

ConfigExists

CW001 - Config file already exists at the target path.

§

IoRead

S001 - std::fs::read* / read_to_string failed at the named path.

§

IoWrite

S002 - std::fs::write failed at the named path.

§

IoCreateDir

S003 - std::fs::create_dir_all failed for the named path.

§

JsonDeserialize

S004 - serde_json (or other deserializer) failed to parse the input.

§

JsonSerialize

S005 - serde_json (or other serializer) failed to encode the value.

§

LockPoisoned

S006 - A Mutex / RwLock was poisoned by a panic in another thread.

§

IoRecoverable

SW001 - Best-effort recoverable IO miss (e.g. cache load fell through). Build continues without the cached state.

§

Custom

Carry an arbitrary code string + explicit severity through the same engine. For third-party transformer authors who don’t want to fork this enum. Prefer adding a typed variant when contributing upstream.

Fields

§code: String
§severity: Severity

Trait Implementations§

Source§

impl Clone for Code

Source§

fn clone(&self) -> Code

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Code

Source§

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

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

impl<'de> Deserialize<'de> for Code

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl DiagnosticCode for Code

Source§

fn code(&self) -> &str

Stable string identifier rendered in the header (e.g. "E0001").
Source§

fn severity(&self) -> Severity

Severity inferred from this code.
Source§

fn url(&self) -> Option<&'static str>

Optional documentation URL rendered after the code in pretty mode.
Source§

impl Serialize for Code

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Code

§

impl RefUnwindSafe for Code

§

impl Send for Code

§

impl Sync for Code

§

impl Unpin for Code

§

impl UnsafeUnpin for Code

§

impl UnwindSafe for Code

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,