From d0c56b6433ca96eedf3c9482ec51456aa80dd772 Mon Sep 17 00:00:00 2001 From: Philip Tamimi-Sarnikowski Date: Mon, 13 Feb 2023 18:59:51 +0100 Subject: [PATCH] docs: fix output examples for ToJSON (#117) --- format.go | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/format.go b/format.go index 1802255..23c61c0 100644 --- a/format.go +++ b/format.go @@ -123,32 +123,32 @@ func NewDefaultJSONFormat(options FormatOptions) JSONFormat { // An error without trace will be formatted as follows: // // { -// "root": [ -// { +// "root": { // "message": "Root error msg" +// }, +// "wrap": [ +// { +// "message": "Wrap error msg" // } -// ], -// "wrap": { -// "message": "Wrap error msg" -// } +// ] // } // // An error with trace will be formatted as follows: // // { -// "root": [ +// "root": { +// "message": "Root error msg", +// "stack": [ +// "::", +// "::" +// ] +// }, +// "wrap": [ // { -// "message": "Root error msg", -// "stack": [ -// "::", -// "::" -// ] +// "message": "Wrap error msg", +// "stack": "::" // } -// ], -// "wrap": { -// "message": "Wrap error msg", -// "stack": "::" -// } +// ] // } func ToJSON(err error, withTrace bool) map[string]interface{} { return ToCustomJSON(err, NewDefaultJSONFormat(FormatOptions{