Class Parslet::ParseFailed
In: lib/parslet.rb
Parent: StandardError

Raised when the parse failed to match or to consume all its input. It contains the message that should be presented to the user. If you want to display more error explanation, you can print the error_tree that is stored in the parslet. This is a graphical representation of what went wrong.

Example:

  begin
    parslet.parse(str)
  rescue Parslet::ParseFailed => failure
    puts parslet.error_tree
  end

Alternatively, you can just require ‘parslet/convenience’ and call the method parse_with_debug instead of parse. This method will never raise and print error trees to stdout.

Example:

  require 'parslet/convenience'
  parslet.parse_with_debug(str)

Methods

new  

Attributes

cause  [R] 

Public Class methods

[Validate]