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

QueryBuilder dies with RuntimeBinderException on incorrect API key #71

Closed
jouniheikniemi opened this issue May 19, 2017 · 2 comments
Closed

Comments

@jouniheikniemi
Copy link

jouniheikniemi commented May 19, 2017

If I try to access a space with an invalid API key, the API returns 404. QueryBuilder doesn't handle this gracefully, but obviously tries to parse the result. That leaves me with stack traces of this sort (async frames removed):

`RuntimeBinderException: Cannot perform runtime binding on a null reference

CallSite.Target(Closure , CallSite , object )
System.Dynamic.UpdateDelegates.UpdateAndExecute1<T0, TRet>(CallSite site, T0 arg0)
Contentful.Core.ContentfulClientBase+d__8.MoveNext()
Contentful.Core.ContentfulClientBase+d__14.MoveNext()
Contentful.Core.ContentfulClientBase+d__11.MoveNext()
Contentful.Core.ContentfulClientBase+d__10.MoveNext()
Contentful.Core.ContentfulClient+d__32.MoveNext()
Contentful.Core.ContentfulClient+d__14.MoveNext()
Contentful.Core.ContentfulClient+d__13.MoveNext()`

If I have an invalid API key, there's a graceful error message because it can't be converted to a bearer token, but a valid token for another space causes this.

@Roblinde
Copy link
Collaborator

Thank you, I'll look into it!

Roblinde added a commit that referenced this issue May 19, 2017
@Roblinde
Copy link
Collaborator

Hi, this should now be fixed in the latest version.

The problem was an inconsistensy in the error format in our API, there was no error object returned in the details object. I've made the code slightly more resilient to this case.

Thanks again for the report and let me know if it doesn't seem to work for you.

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

2 participants