From c26265571231206bccce92139843ea968b44986e Mon Sep 17 00:00:00 2001 From: srinandan Date: Sun, 30 Jan 2022 09:59:23 -0800 Subject: [PATCH] handle file open error --- apiclient/httpclient.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apiclient/httpclient.go b/apiclient/httpclient.go index f128d2e4..711b57ef 100644 --- a/apiclient/httpclient.go +++ b/apiclient/httpclient.go @@ -78,7 +78,11 @@ func PostHttpZip(print bool, auth bool, method string, url string, headers map[s //PostHttpOctet method is used to send resources, proxy bundles, shared flows etc. func PostHttpOctet(print bool, update bool, url string, proxyName string) (respBody []byte, err error) { - file, _ := os.Open(proxyName) + file, err := os.Open(proxyName) + if err != nil { + clilog.Error.Printf("failed to open the file %s with error: %v", proxyName, err) + return nil, err + } defer file.Close() var req *http.Request