File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -248,6 +248,12 @@ func (e *UnknownResource) ToResourceNotFoundError() SdkError {
248248 }
249249
250250 messageParts := strings .Split (e .Message , `"` )
251+
252+ // Some errors uses ' and not "
253+ if len (messageParts ) == 1 {
254+ messageParts = strings .Split (e .Message , "'" )
255+ }
256+
251257 switch len (messageParts ) {
252258 case 2 : // message like: `"111..." not found`
253259 resourceNotFound .ResourceID = messageParts [0 ]
Original file line number Diff line number Diff line change @@ -128,6 +128,18 @@ func TestNonStandardError(t *testing.T) {
128128 },
129129 }))
130130
131+ t .Run ("unknown_resource single qupte" , run (& testCase {
132+ resStatus : "404 Not Found" ,
133+ resStatusCode : http .StatusNotFound ,
134+ contentType : "application/json" ,
135+ resBody : `{"type": "unknown_resource", "message": "Volume '11111111-1111-4111-8111-111111111111' not found"}` ,
136+ expectedError : & ResourceNotFoundError {
137+ ResourceID : "11111111-1111-4111-8111-111111111111" ,
138+ Resource : "volume" ,
139+ RawBody : []byte (`{"type": "unknown_resource", "message": "Volume '11111111-1111-4111-8111-111111111111' not found"}` ),
140+ },
141+ }))
142+
131143 t .Run ("conflict type" , run (& testCase {
132144 resStatus : "409 Conflict" ,
133145 resStatusCode : http .StatusConflict ,
You can’t perform that action at this time.
0 commit comments