Module: MaRuKu::Errors

### Home Classes Methods

### In Files

- lib/maruku.rb
- lib/maruku/errors.rb

### Methods

- #maruku_error
- #maruku_recover
- #raise_error
- #tell_user

### Class/Module Index

Quicksearch

- MaRuKu
- MaRuKu::AttributeList
- MaRuKu::Errors
- MaRuKu::Exception
- MaRuKu::HTMLElement
- MaRuKu::HTMLFragment
- MaRuKu::Helpers
- MaRuKu::In
- MaRuKu::In::Markdown
- MaRuKu::In::Markdown::BlockLevelParser
- MaRuKu::In::Markdown::BlockLevelParser::BlockContext
- MaRuKu::In::Markdown::BlockLevelParser::LineSource
- MaRuKu::In::Markdown::SpanExtension
- MaRuKu::In::Markdown::SpanLevelParser
- MaRuKu::In::Markdown::SpanLevelParser::CharSourceDebug
- MaRuKu::In::Markdown::SpanLevelParser::CharSourceManual
- MaRuKu::In::Markdown::SpanLevelParser::CharSourceStrscan
- MaRuKu::In::Markdown::SpanLevelParser::HTMLHelper
- MaRuKu::In::Markdown::SpanLevelParser::SpanContext
- MaRuKu::MDDocument
- MaRuKu::MDElement
- MaRuKu::MDHTMLElement
- MaRuKu::MDLine
- MaRuKu::NokogiriHTMLFragment
- MaRuKu::Out
- MaRuKu::Out::EntityTable
- MaRuKu::Out::HTML
- MaRuKu::Out::HTML::HTMLElement
- MaRuKu::Out::Latex
- MaRuKu::Out::Latex::MDDocumentExtensions
- MaRuKu::Out::Markdown
- MaRuKu::REXMLHTMLFragment
- MaRuKu::Section
- MaRuKu::Strings
- Maruku
- Maruku::In
- Maruku::In::Markdown
- Maruku::In::Markdown::FencedCode
- Object
- String
- Textile2Signature

No matching classes.

# MaRuKu::Errors

### Constants

FRAME_WIDTH

### Public Instance Methods

maruku_error(s, src=nil, con=nil, recover=nil) click to toggle source

Properly handles a formatting error. All such errors go through this method.

The behavior depends on {MaRuKu::Globals `MaRuKu::Globals`}. If this is `:warning`, this prints the error to stderr (or `@error_stream` if it's defined) and tries to continue. If `:on_error` is `:ignore`, this doesn't print anything and tries to continue. If it's `:raise`, this raises a {MaRuKu::Exception}.

By default, `:on_error` is set to `:warning`.

@overload def maruku_error(s, src = nil, con = nil) @param s [String] The text of the error @param src [describe, nil] The source of the error @param con [describe, nil] The context of the error @param recover [String, nil] Recovery text @raise [MaRuKu::Exception] If `:on_error` is set to `:raise`

    # File lib/maruku/errors.rb, line 24
    def maruku_error(s, src=nil, con=nil, recover=nil)
      policy = get_setting(:on_error)

      case policy
      when :ignore
      when :raise
        raise_error create_frame(describe_error(s, src, con, recover))
      when :warning
        tell_user create_frame(describe_error(s, src, con, recover))
      else
        raise "Unknown on_error policy: #{policy.inspect}"
      end
    end

maruku_recover(s, src=nil, con=nil, recover=nil) click to toggle source

This is like {maruku_error} but will never raise.

    # File lib/maruku/errors.rb, line 39
    def maruku_recover(s, src=nil, con=nil, recover=nil)
      policy = get_setting(:on_error)

      case policy
      when :ignore
      when :raise, :warning
        tell_user create_frame(describe_error(s, src, con, recover))
      else
        raise "Unknown on_error policy: #{policy.inspect}"
      end
    end

raise_error(s) click to toggle source

    # File lib/maruku/errors.rb, line 51
    def raise_error(s)
      raise MaRuKu::Exception, s, caller
    end

tell_user(s) click to toggle source

    # File lib/maruku/errors.rb, line 55
    def tell_user(s)
      (self.attributes[:error_stream] || $stderr) << s << "\n"
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.