From 5814edc117a40a53a95891354465e0ea284f43aa Mon Sep 17 00:00:00 2001 From: h2570su Date: Thu, 9 Nov 2023 11:49:39 +0800 Subject: [PATCH] Remove log.Fatal() uasge in encoder.go --- encoder.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/encoder.go b/encoder.go index 51f0a78..52f2c10 100644 --- a/encoder.go +++ b/encoder.go @@ -3,7 +3,6 @@ package schema import ( "errors" "fmt" - "log" "reflect" "strconv" ) @@ -97,7 +96,7 @@ func (e *Encoder) encode(v reflect.Value, dst map[string][]string) error { if isValidStructPointer(v.Field(i)) && !e.hasCustomEncoder(v.Field(i).Type()) { err := e.encode(v.Field(i).Elem(), dst) if err != nil { - log.Fatal(err) + errors[v.Field(i).Elem().Type().String()] = err } continue } @@ -118,7 +117,7 @@ func (e *Encoder) encode(v reflect.Value, dst map[string][]string) error { if v.Field(i).Type().Kind() == reflect.Struct { err := e.encode(v.Field(i), dst) if err != nil { - log.Fatal(err) + errors[v.Field(i).Type().String()] = err } continue }