adobe-platform / go-metronome

A Go-based metronome client
Apache License 2.0
3 stars 4 forks source link

Fix Panic on non-json response #5

Open seanisom opened 6 years ago

seanisom commented 6 years ago

Upon a 5XX error with a non-json response, go-chronos panics.

Proposing to modify to fail gracefully instead.

I0502 14:31:51.692278 59179 exec.cpp:162] Version: 1.2.3
I0502 14:31:51.698241 59187 exec.cpp:236] Executor registered on agent 96360164-784f-4590-ab96-7eef1d1547df-S2
panic: interface conversion: interface {} is *[]metronome.Job, not *string

goroutine 125 [running]:
git.corp.adobe.com/adobe-platform/flight-director/vendor/github.com/adobe-platform/go-metronome/metronome.(*Client).apiCall(0xc420782300, 0xec5606, 0x3, 0xec9b27, 0x8, 0xc42084a5a0, 0x0, 0x0, 0xcea3e0, 0xc4205c63e0, ...)
    /go/src/git.corp.adobe.com/adobe-platform/flight-director/vendor/github.com/adobe-platform/go-metronome/metronome/client.go:189 +0xc45
git.corp.adobe.com/adobe-platform/flight-director/vendor/github.com/adobe-platform/go-metronome/metronome.(*Client).apiGet(0xc420782300, 0xec9b27, 0x8, 0xc42084a5a0, 0xcea3e0, 0xc4205c63e0, 0xc4206f52f8, 0x419218, 0x30)
    /go/src/git.corp.adobe.com/adobe-platform/flight-director/vendor/github.com/adobe-platform/go-metronome/metronome/client.go:111 +0x8d
git.corp.adobe.com/adobe-platform/flight-director/vendor/github.com/adobe-platform/go-metronome/metronome.(*Client).Jobs(0xc420782300, 0xc42084a570, 0xc4206fa200, 0x0)
    /go/src/git.corp.adobe.com/adobe-platform/flight-director/vendor/github.com/adobe-platform/go-metronome/metronome/jobs.go:65 +0x16d
git.corp.adobe.com/adobe-platform/flight-director/vendor/github.com/adobe-platform/go-metronome/metronome.NewClient(0xc420026371, 0x1b, 0x0, 0x5, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    /go/src/git.corp.adobe.com/adobe-platform/flight-director/vendor/github.com/adobe-platform/go-metronome/metronome/client.go:102 +0x1e7
git.corp.adobe.com/adobe-platform/flight-director/shared/metronome-manager.createMetronomeClient(0x0, 0x0, 0xc42002a193, 0x4, 0x1e, 0xc42002a1cd, 0x5, 0xc42002834b, 0x34, 0xc4200261bf, ...)
    /go/src/git.corp.adobe.com/adobe-platform/flight-director/shared/metronome-manager/metronome-manager.go:28 +0xd3
git.corp.adobe.com/adobe-platform/flight-director/shared/metronome-manager.NewMetronomeManager(0x0, 0x0, 0xc42002a193, 0x4, 0x1e, 0xc42002a1cd, 0x5, 0xc42002834b, 0x34, 0xc4200261bf, ...)
    /go/src/git.corp.adobe.com/adobe-platform/flight-director/shared/metronome-manager/metronome-manager.go:38 +0x58
git.corp.adobe.com/adobe-platform/flight-director/worker.(*Worker).InitializeMetronome(0xc4204a3100, 0xf038b0, 0xc42055e358)
    /go/src/git.corp.adobe.com/adobe-platform/flight-director/worker/metronome.go:33 +0x10f
git.corp.adobe.com/adobe-platform/flight-director/worker.(*Worker).Start(0xc4204a3100, 0x0, 0x0)
    /go/src/git.corp.adobe.com/adobe-platform/flight-director/worker/worker.go:195 +0x105
created by main.main
    /go/src/git.corp.adobe.com/adobe-platform/flight-director/main.go:189 +0x9e4
I0502 14:31:53.500156 59184 health_checker.cpp:165] Health checking stopped
W0502 14:31:53.500156 59179 logging.cpp:91] RAW: Received signal SIGTERM from process 9161 of user 0; exiting
seanisom commented 6 years ago

@mayanand @iderdik @msabramo FYI