From 9763e11237fea3e8a5547a0bd615d8f16dacd954 Mon Sep 17 00:00:00 2001 From: "Cuong. Duong Manh" Date: Thu, 30 May 2024 12:19:22 +0700 Subject: [PATCH] [feat] enhance logs handler base feature --- vngcloud/sdk_error/isdk_error.go | 1 + vngcloud/sdk_error/sdk_error.go | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/vngcloud/sdk_error/isdk_error.go b/vngcloud/sdk_error/isdk_error.go index 4ccc5cd..f0e0de1 100644 --- a/vngcloud/sdk_error/isdk_error.go +++ b/vngcloud/sdk_error/isdk_error.go @@ -15,6 +15,7 @@ type ISdkError interface { GetErrorCode() ErrorCode GetParameters() map[string]interface{} GetErrorMessages() string + GetListParameters() []interface{} } type IErrorRespone interface { diff --git a/vngcloud/sdk_error/sdk_error.go b/vngcloud/sdk_error/sdk_error.go index c4cd0b3..50bd490 100644 --- a/vngcloud/sdk_error/sdk_error.go +++ b/vngcloud/sdk_error/sdk_error.go @@ -119,3 +119,16 @@ func (s *SdkError) GetErrorMessages() string { return lfmt.Sprintf("%s: %s", s.message, s.error.Error()) } + +func (s *SdkError) GetListParameters() []interface{} { + var result []interface{} + if s.parameters == nil { + return result + } + + for key, val := range s.parameters { + result = append(result, key, val) + } + + return result +}