From 820be379f87a38748c4313f7b0fc348b01e6bec1 Mon Sep 17 00:00:00 2001 From: gmorer Date: Wed, 14 Oct 2020 00:48:16 +0200 Subject: [PATCH] Add serde_json::error::Error::msg() method --- src/error.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/error.rs b/src/error.rs index 7dcdd81c9..811a13869 100644 --- a/src/error.rs +++ b/src/error.rs @@ -18,6 +18,11 @@ pub struct Error { pub type Result = result::Result; impl Error { + /// Message of this error + pub fn msg(&self) -> String { + self.err.code.to_string() + } + /// One-based line number at which the error was detected. /// /// Characters in the first line of the input (before the first newline