Skip to content

Commit 07ba9cc

Browse files
authored
Include the return code only if Backend has no ReturnCode (#48)
* Include the return code only if Backend has no ReturnCode Signed-off-by: Sameer Shaikh <[email protected]> * Return error code to caller Signed-off-by: Sameer Shaikh <[email protected]> * Return error code to caller Signed-off-by: Sameer Shaikh <[email protected]> * Return error code to caller Signed-off-by: Sameer Shaikh <[email protected]> * Return error code to caller Signed-off-by: Sameer Shaikh <[email protected]> * Return error code to caller Signed-off-by: Sameer Shaikh <[email protected]> * Return error code to caller Signed-off-by: Sameer Shaikh <[email protected]> * Return error code to caller Signed-off-by: Sameer Shaikh <[email protected]> * error-code Signed-off-by: Sameer Shaikh <[email protected]> * Include the return code only if Backend has no ReturnCode Signed-off-by: Sameer Shaikh <[email protected]> * Include the return code only if Backend has no ReturnCode Signed-off-by: Sameer Shaikh <[email protected]> --------- Signed-off-by: Sameer Shaikh <[email protected]>
1 parent 8d17367 commit 07ba9cc

File tree

2 files changed

+8
-34
lines changed

2 files changed

+8
-34
lines changed

lib/utils/messages.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ package util
1919

2020
import (
2121
"fmt"
22+
"strings"
2223
)
2324

25+
const vpcError = "Trace Code:"
26+
2427
// Message Wrapper Message/Error Class
2528
type Message struct {
2629
Code string
@@ -39,5 +42,9 @@ func (msg Message) Error() string {
3942

4043
// Info ...
4144
func (msg Message) Info() string {
42-
return fmt.Sprintf("{Code:%s, Type:%s, Description:%s, BackendError:%s, RC:%d}", msg.Code, msg.Type, msg.Description, msg.BackendError, msg.RC)
45+
if strings.Contains(msg.BackendError, vpcError) {
46+
return fmt.Sprintf("{%s.%s}", msg.BackendError, msg.Description)
47+
} else {
48+
return fmt.Sprintf("{Code:%s, Description:%s.%s, RC:%d}", msg.Code, msg.Description, msg.BackendError, msg.RC)
49+
}
4350
}

lib/utils/messages_test.go

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)