File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -223,6 +223,14 @@ public struct BedrockService: Sendable {
223223 )
224224 }
225225 }
226+ } else if let validationError = error as? AWSBedrockRuntime . ValidationException {
227+ logger. trace ( " ValidationException while \( context) " , metadata: [ " error " : " \( error) " ] )
228+ let message = validationError. properties. message ?? " Validation error occurred "
229+ if message. contains ( " Input is too long " ) {
230+ throw BedrockLibraryError . inputTooLong ( message)
231+ } else {
232+ throw BedrockLibraryError . invalid ( message)
233+ }
226234 } else {
227235 logger. trace ( " Error while \( context) " , metadata: [ " error " : " \( error) " ] )
228236 throw error
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ public enum BedrockLibraryError: Error {
4141 case notSupported( String )
4242 case notFound( String )
4343 case authenticationFailed( String )
44+ case inputTooLong( String )
4445 case unknownError( String )
4546
4647 public var message : String {
@@ -86,6 +87,8 @@ public enum BedrockLibraryError: Error {
8687 return " Not found: \( message) "
8788 case . authenticationFailed( let message) :
8889 return " Authentication failed: \( message) "
90+ case . inputTooLong( let message) :
91+ return " Input too long: \( message) "
8992 case . unknownError( let message) :
9093 return " Unknown error: \( message) "
9194 }
You can’t perform that action at this time.
0 commit comments