From c2a6f5dd7fbcba27b7ab3533ae6383a30490b48e Mon Sep 17 00:00:00 2001 From: beruangcoklat Date: Thu, 26 May 2022 08:00:05 +0700 Subject: [PATCH] handling error in AddProtos --- core/resource.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/resource.go b/core/resource.go index eee4c03..015b617 100644 --- a/core/resource.go +++ b/core/resource.go @@ -285,8 +285,14 @@ func (r *Resource) AddProtos(protos []Proto) error { protoPath := filepath.Join(BasePath, r.clientConn.Target()) err := os.MkdirAll(protoPath, 0777) if os.IsExist(err) { - os.RemoveAll(protoPath) + err = os.RemoveAll(protoPath) + if err != nil { + return err + } err = os.MkdirAll(protoPath, 0777) + if err != nil { + return err + } } else if err != nil { return err }