Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d9c5d0857b |
+15
-5
@@ -71,6 +71,8 @@ type SDKError struct {
|
||||
Code *string
|
||||
Message *string
|
||||
Data *string
|
||||
Stack *string
|
||||
errMsg *string
|
||||
}
|
||||
|
||||
// RuntimeObject is used for converting http configuration
|
||||
@@ -178,6 +180,19 @@ func NewSDKError(obj map[string]interface{}) *SDKError {
|
||||
return err
|
||||
}
|
||||
|
||||
func (err *SDKError) SetErrMsg(msg string) {
|
||||
err.errMsg = String(msg)
|
||||
}
|
||||
|
||||
func (err *SDKError) Error() string {
|
||||
if err.errMsg == nil {
|
||||
str := fmt.Sprintf("SDKError:\n Code: %s\n Message: %s\n Data: %s\n",
|
||||
StringValue(err.Code), StringValue(err.Message), StringValue(err.Data))
|
||||
err.SetErrMsg(str)
|
||||
}
|
||||
return StringValue(err.errMsg)
|
||||
}
|
||||
|
||||
// Return message of CastError
|
||||
func (err *CastError) Error() string {
|
||||
return StringValue(err.Message)
|
||||
@@ -495,11 +510,6 @@ func setDialContext(runtime *RuntimeObject, port int) func(cxt context.Context,
|
||||
}
|
||||
}
|
||||
|
||||
func (err *SDKError) Error() string {
|
||||
return fmt.Sprintf("SDKError:\n Code: %s\n Message: %s\n Data: %s\n",
|
||||
StringValue(err.Code), StringValue(err.Message), StringValue(err.Data))
|
||||
}
|
||||
|
||||
func ToObject(obj interface{}) map[string]interface{} {
|
||||
result := make(map[string]interface{})
|
||||
byt, _ := json.Marshal(obj)
|
||||
|
||||
Reference in New Issue
Block a user