Exception: Ucode::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/ucode/error.rb

Overview

Base error class for all ucode failures.

Every error raised anywhere in the codebase is_a?(Ucode::Error). Errors carry structured context (file:, line:, codepoint:, version:, etc.) so CLI formatters can render useful diagnostics without re-parsing strings.

Hierarchy:

Ucode::Error
├── Ucode::FetchError
   ├── Ucode::NetworkError
   └── Ucode::ChecksumError
├── Ucode::ParseError
   ├── Ucode::MalformedLineError
   └── Ucode::UnknownPropertyError
├── Ucode::LookupError
   ├── Ucode::DatabaseMissingError
   ├── Ucode::DatabaseSchemaError
   └── Ucode::UnknownVersionError
└── Ucode::GlyphError
    ├── Ucode::PdfRenderError
    ├── Ucode::GridDetectionError
    ├── Ucode::LastResortMissingError
    └── Ucode::EmbeddedFontsMissingError

Direct Known Subclasses

FetchError, GlyphError, LookupError, ParseError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, context: {}) ⇒ Error

Returns a new instance of Error.

Parameters:

  • message (String, nil) (defaults to: nil)
  • context (Hash{Symbol=>Object}) (defaults to: {})

    structured diagnostic context



33
34
35
36
# File 'lib/ucode/error.rb', line 33

def initialize(message = nil, context: {})
  @context = context
  super(build_message(message))
end

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



29
30
31
# File 'lib/ucode/error.rb', line 29

def context
  @context
end