packer-cn/vendor/github.com/NaverCloudPlatform/ncloud-sdk-go/common/parseErrorResponse.go

21 lines
399 B
Go
Raw Normal View History

2018-01-11 05:41:47 -05:00
package common
import (
"encoding/xml"
"strings"
)
func ParseErrorResponse(bytes []byte) (*ResponseError, error) {
responseError := ResponseError{}
if err := xml.Unmarshal([]byte(bytes), &responseError); err != nil {
return nil, err
}
if responseError.ReturnMessage != "" {
responseError.ReturnMessage = strings.TrimSpace(responseError.ReturnMessage)
}
return &responseError, nil
}