From 5d023a1ed0419e63615e41fd14004373e44f87ed Mon Sep 17 00:00:00 2001 From: Matthew Hall Date: Fri, 31 Mar 2023 22:09:05 +1300 Subject: More informative error messages --- src/parcom/parser.cr | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/parcom/parser.cr b/src/parcom/parser.cr index 9e74845..3fe4746 100644 --- a/src/parcom/parser.cr +++ b/src/parcom/parser.cr @@ -160,6 +160,8 @@ module Parcom # Calls this parser's parsing function with the given input stream. def parse(tokens : Tokens(T)) : Result(T, U) @f.call(tokens) + rescue ex : ParserFail + raise ParserFail.new("#{@name}: #{ex.message}") end # Same as `#parse`, but returns `nil` instead of -- cgit v1.2.1