Skip to content

Convert awserr.NewRequestFailure to v2 #2196

Answered by RanVaknin
yongzhang asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @yongzhang,

As far as I can tell there is no provided implementation that has the requestId provided the same way.
You can write your own implementation around APIError to include requestId pretty easily though:

type MyServiceError struct {
	smithy.APIError
	requestId string
}

func (e *MyServiceError) RequestId() string {
	return e.requestId
}

func main(){
        // some code...
	mockErr := &MyServiceError{
		APIError: &smithy.GenericAPIError{
			Code:    "500",
			Message: "Internal Service Error",
			Fault:   0,
		},
		requestId: "dc4cd45a-2655-11ee-be56-0242ac120002",
	}

}

Thanks,
Ran~

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@yongzhang
Comment options

@RanVaknin
Comment options

Answer selected by yongzhang
@yongzhang
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
2 participants