Skip to content

Panic in checkForErrors when the service responds with an Internal Service Error #5

Description

@emaildanwilson

The client hits the error:

panic: interface conversion: interface {} is nil, not []interface {}

Maybe it can bail if the error is >= 500?

2021/02/23 21:42:07 client.go:224: In GET by ID : &{GET https://api.dns.constellix.com/v1/domains/REDACTED/records/cname/search?exact=observer-workload-REDACTED HTTP/1.1 1 1 map[Content-Type:[application/json] X-Cns-Security-Token:[REDACTED]] <nil> <nil> 0 [] false api.dns.constellix.com map[] map[] <nil> map[]   <nil> <nil> <nil> 0xc0000b8020}
2021/02/23 21:42:07 client.go:231: Response for Get:  &{500 Internal Server Error 500 HTTP/1.1 1 1 map[Cnsdns-Account-Id:[REDACTED] Cnsdns-User-Role:[] Connection:[keep-alive] Content-Language:[en] Content-Type:[text/html;charset=utf-8] Date:[Tue, 23 Feb 2021 21:42:07 GMT] Requestlimitheader:[70] Requestlimitinterval:[10.00] Requestlimitrate:[7.00] Requestrefreshinterval:[0] Requestsremainingheader:[0] Server:[Apache-Coyote/1.1]] 0xc000cd1140 -1 [chunked] false false map[] 0xc000b60f00 0xc000a2b8c0}
panic: interface conversion: interface {} is nil, not []interface {}

goroutine 6838 [running]:
github.com/Constellix/constellix-go-client/client.checkForErrors(0xc00160b710, 0x2, 0x2)
	~/go/pkg/mod/github.com/!constellix/constellix-go-client@v1.0.1/client/client.go:184 +0x43f
github.com/Constellix/constellix-go-client/client.(*Client).GetbyId(0xc000639340, 0xc00101db30, 0x4c, 0x6, 0xc00101db30, 0x4c)
	~/go/pkg/mod/github.com/!constellix/constellix-go-client@v1.0.1/client/client.go:233 +0x26b

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions