Handle error in upsert_timeboard #5

Open
jantman opened this Issue Feb 17, 2017 · 0 comments

Projects

None yet

1 participant

@jantman
Collaborator
jantman commented Feb 17, 2017

I tried creating a graph that had an incorrect graph definition. The traceback wasn't helpful at all:

 INFO API: Upserting timeboard: circleci-builder-dev
Found 198 existing timeboards in DataDog
rake aborted!
NoMethodError: undefined method `[]' for nil:NilClass
/home/jantman/manheim/git/Tooling/terraform-circleci-builder/vendor/ruby/2.1.0/gems/dogtrainer-0.2.0/lib/dogtrainer/api.rb:531:in `upsert_timeboard'
/home/jantman/manheim/git/Tooling/terraform-circleci-builder/lib/datadog_helpers.rb:149:in `setup_dashboard'
/home/jantman/manheim/git/Tooling/terraform-circleci-builder/Rakefile:79:in `block in <top (required)>'
Tasks: TOP => datadog
(See full trace by running task with --trace)

It turns out that DataDog's API returned a 400, but dogapi doesn't treat this as an error, it just returns a normal array; @dog.create_dashboard() returns:

["400", {"errors"=>["Error(s) found in query:\nError parsing query: \n avg:circlecienterprise.circlerunqueuebuilds\n                                           ^\nExpected \"{\" (at char 43), (line:1, col:44) "]}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment