Exception: Typstify::CompileError

Inherits:
Error
  • Object
show all
Defined in:
lib/typstify/errors.rb

Overview

The Typst compiler rejected the document. Carries the compiler's own annotated diagnostic, which points at the offending line.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(template:, typst_message:, line: nil, column: nil) ⇒ CompileError

Returns a new instance of CompileError.



36
37
38
39
40
41
42
43
# File 'lib/typstify/errors.rb', line 36

def initialize(template:, typst_message:, line: nil, column: nil)
  @template = template
  @typst_message = typst_message
  @line = line
  @column = column
  location = line ? " (line #{line}#{", column #{column}" if column})" : ""
  super("Typst failed to compile #{template}#{location}:\n\n#{typst_message}")
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



34
35
36
# File 'lib/typstify/errors.rb', line 34

def column
  @column
end

#lineObject (readonly)

Returns the value of attribute line.



34
35
36
# File 'lib/typstify/errors.rb', line 34

def line
  @line
end

#templateObject (readonly)

Returns the value of attribute template.



34
35
36
# File 'lib/typstify/errors.rb', line 34

def template
  @template
end

#typst_messageObject (readonly)

Returns the value of attribute typst_message.



34
35
36
# File 'lib/typstify/errors.rb', line 34

def typst_message
  @typst_message
end