From ef112a71f42cf97dec5b1942d294a93f9e01ac73 Mon Sep 17 00:00:00 2001 From: "Cuong. Duong Manh" Date: Thu, 29 Aug 2024 08:22:03 +0700 Subject: [PATCH] [chore] add method parse error code into string --- vngcloud/sdk_error/isdk_error.go | 1 + vngcloud/sdk_error/sdk_error.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/vngcloud/sdk_error/isdk_error.go b/vngcloud/sdk_error/isdk_error.go index c6ef74a..f6e9f62 100644 --- a/vngcloud/sdk_error/isdk_error.go +++ b/vngcloud/sdk_error/isdk_error.go @@ -13,6 +13,7 @@ type IError interface { GetError() error GetMessage() string GetErrorCode() ErrorCode + GetStringErrorCode() string GetParameters() map[string]interface{} GetErrorMessages() string GetListParameters() []interface{} diff --git a/vngcloud/sdk_error/sdk_error.go b/vngcloud/sdk_error/sdk_error.go index dd55f87..834666f 100644 --- a/vngcloud/sdk_error/sdk_error.go +++ b/vngcloud/sdk_error/sdk_error.go @@ -108,6 +108,10 @@ func (s *SdkError) GetErrorCode() ErrorCode { return s.errorCode } +func (s *SdkError) GetStringErrorCode() string { + return string(s.errorCode) +} + func (s *SdkError) GetParameters() map[string]interface{} { return s.parameters }