MCPcopy Create free account
hub / github.com/awsdocs/aws-doc-sdk-examples / ProcessError

Function ProcessError

gov2/bedrock-runtime/actions/invoke_model.go:153–167  ·  view source on GitHub ↗

snippet-end:[gov2.bedrock-runtime.InvokeTitanImage]

(err error, modelId string)

Source from the content-addressed store, hash-verified

151// snippet-end:[gov2.bedrock-runtime.InvokeTitanImage]
152
153func ProcessError(err error, modelId string) {
154 errMsg := err.Error()
155 if strings.Contains(errMsg, "no such host") {
156 log.Printf(`The Bedrock service is not available in the selected region.
157 Please double-check the service availability for your region at
158 https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services/.\n`)
159 } else if strings.Contains(errMsg, "Could not resolve the foundation model") {
160 log.Printf(`Could not resolve the foundation model from model identifier: \"%v\".
161 Please verify that the requested model exists and is accessible
162 within the specified region.\n
163 `, modelId)
164 } else {
165 log.Printf("Couldn't invoke model: \"%v\". Here's why: %v\n", modelId, err)
166 }
167}
168
169// snippet-end:[gov2.bedrock-runtime.InvokeModelWrapper.complete]

Callers 4

InvokeClaudeMethod · 0.85
InvokeTitanImageMethod · 0.85
ConverseClaudeMethod · 0.85
ConverseNovaMethod · 0.85

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected