Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle errors from the API #17

Open
technicalpickles opened this issue May 21, 2024 · 0 comments
Open

Handle errors from the API #17

technicalpickles opened this issue May 21, 2024 · 0 comments

Comments

@technicalpickles
Copy link
Member

I hadn't tried running this in awhile, and got:

/Users/josh.nichols/.rbenv/versions/3.3.1/lib/ruby/gems/3.3.0/gems/buildkite-cli-0.1.0/lib/bk/commands/artifacts.rb:93:in `call': undefined method `build' for nil (NoMethodError)

          build = result.data.build
                             ^^^^^^
	from /Users/josh.nichols/.rbenv/versions/3.3.1/lib/ruby/gems/3.3.0/gems/dry-cli-1.0.0/lib/dry/cli.rb:116:in `perform_registry'
	from /Users/josh.nichols/.rbenv/versions/3.3.1/lib/ruby/gems/3.3.0/gems/dry-cli-1.0.0/lib/dry/cli.rb:65:in `call'
	from /Users/josh.nichols/.rbenv/versions/3.3.1/lib/ruby/gems/3.3.0/gems/buildkite-cli-0.1.0/exe/bk:5:in `<top (required)>'
	from /Users/josh.nichols/.rbenv/versions/3.3.1/bin/bk:25:in `load'
	from /Users/josh.nichols/.rbenv/versions/3.3.1/bin/bk:25:in `<main>'

Code is:

result = query(BuildArtifactsQuery, variables: {slug: slug, jobs_after: jobs_after})

def query(graphql_query, **kwargs)
result = nil
spinner.run("Done") do |spinner|
result = Client.query(graphql_query, **kwargs)
end
result
end

I suspect there's a class of non-200 we should just handle, and surface to the user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant