From 5a198d6ee02608f1dfe79fbcc556859db6b0fc53 Mon Sep 17 00:00:00 2001 From: Dongdong Zhou Date: Sat, 13 Apr 2024 21:40:54 +0100 Subject: [PATCH] expose hcl-edit parser error message (#334) hcl-edit parser error already returns line and location, but message is also required for user to be able to pretty print the error themselves --- crates/hcl-edit/src/parser/error.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/hcl-edit/src/parser/error.rs b/crates/hcl-edit/src/parser/error.rs index 0456fd2d..be53359e 100644 --- a/crates/hcl-edit/src/parser/error.rs +++ b/crates/hcl-edit/src/parser/error.rs @@ -21,6 +21,11 @@ impl Error { } } + /// Returns the message in the input where the error occurred. + pub fn message(&self) -> &str { + &self.inner.message + } + /// Returns the line from the input where the error occurred. /// /// Note that this returns the full line containing the invalid input. Use