Source File
unmarshal_error.go
Belonging Package
github.com/aws/aws-sdk-go/private/protocol/query
package query
import (
)
var UnmarshalErrorHandler = request.NamedHandler{Name: "awssdk.query.UnmarshalError", Fn: UnmarshalError}
type xmlErrorResponse struct {
Code string `xml:"Error>Code"`
Message string `xml:"Error>Message"`
RequestID string `xml:"RequestId"`
}
type xmlResponseError struct {
xmlErrorResponse
}
func ( *xmlResponseError) ( *xml.Decoder, xml.StartElement) error {
const = "ServiceUnavailableException"
const = "ErrorResponse"
switch .Name.Local {
case :
.Code =
.Message = "service is unavailable"
return .Skip()
case :
return .DecodeElement(&.xmlErrorResponse, &)
default:
return fmt.Errorf("unknown error response tag, %v", )
}
}
func ( *request.Request) {
defer .HTTPResponse.Body.Close()
var xmlResponseError
:= xmlutil.UnmarshalXMLError(&, .HTTPResponse.Body)
if != nil {
.Error = awserr.NewRequestFailure(
awserr.New(request.ErrCodeSerialization,
"failed to unmarshal error message", ),
.HTTPResponse.StatusCode,
.RequestID,
)
return
}
:= .RequestID
if len() == 0 {
= .RequestID
}
.Error = awserr.NewRequestFailure(
awserr.New(.Code, .Message, nil),
.HTTPResponse.StatusCode,
,
)
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |