{"action":"created","issue":{"url":"https://api.github.com/repos/looker/looker-sdk-ruby/issues/38","labels_url":"https://api.github.com/repos/looker/looker-sdk-ruby/issues/38/labels{/name}","comments_url":"https://api.github.com/repos/looker/looker-sdk-ruby/issues/38/comments","events_url":"https://api.github.com/repos/looker/looker-sdk-ruby/issues/38/events","html_url":"https://github.com/looker/looker-sdk-ruby/issues/38","id":107545557,"number":38,"title":"JSONParse error on Postgres db error","user":{"login":"cworsley4","id":1875169,"avatar_url":"https://avatars.githubusercontent.com/u/1875169?v=3","gravatar_id":"","url":"https://api.github.com/users/cworsley4","html_url":"https://github.com/cworsley4","followers_url":"https://api.github.com/users/cworsley4/followers","following_url":"https://api.github.com/users/cworsley4/following{/other_user}","gists_url":"https://api.github.com/users/cworsley4/gists{/gist_id}","starred_url":"https://api.github.com/users/cworsley4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cworsley4/subscriptions","organizations_url":"https://api.github.com/users/cworsley4/orgs","repos_url":"https://api.github.com/users/cworsley4/repos","events_url":"https://api.github.com/users/cworsley4/events{/privacy}","received_events_url":"https://api.github.com/users/cworsley4/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/looker/looker-sdk-ruby/labels/bug","name":"bug","color":"555E61"},{"url":"https://api.github.com/repos/looker/looker-sdk-ruby/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-21T16:06:42Z","updated_at":"2015-09-21T18:03:51Z","closed_at":"2015-09-21T18:03:51Z","body":"@jbandhauer \r\nNot sure that this is an SDK issue as much as it is with the Looker API but I'll start here. I get a JSONParse error when there is a DB (Redshift/Postgres in this case) error thrown, when running a look. Judging by the error message the SDK throws the JSONParse error when it gets an unexpected response format from the looker instance. My thought is that an UnexpectedResponse exception of sorts should get thrown and that the API shouldn't be returning something that isn't in JSON format. This is how the API reports other errors it knows how to handle.\r\n\r\n```\r\n{\r\n  \"error\": \"Could not load model \\\"thelook\\\".\",\r\n  \"error_detail\": [\r\n    \"Model is not configured\"\r\n  ]\r\n}\r\n\r\n```\r\n```\r\n#<JSON::ParserError: unexpected token at 'SQL Error: ERROR: table 806669 dropped by concurrent transaction]'>\r\n\r\njson/ext/Parser.java:251:in `parse'\r\n/usr/local/lib/jruby-1.7.12/lib/ruby/shared/json/common.rb:155:in `parse'\r\n/usr/local/lib/jruby-1.7.12/lib/ruby/shared/json/common.rb:334:in `load'\r\norg/jruby/RubyMethod.java:128:in `call'\r\n/var/www/looker/panopticon/releases/20150919190326/bundle/vendor/jruby/1.9/gems/sawyer-0.6.0/lib/sawyer/serializer.rb:62:in `decode'\r\n/var/www/looker/panopticon/releases/20150919190326/bundle/vendor/jruby/1.9/gems/sawyer-0.6.0/lib/sawyer/agent.rb:125:in `decode_body'\r\n/var/www/looker/panopticon/releases/20150919190326/bundle/vendor/jruby/1.9/bundler/gems/looker-sdk-ruby-a72323386700/lib/looker-sdk/sawyer_patch.rb:24:in `data'\r\n/var/www/looker/panopticon/releases/20150919190326/bundle/vendor/jruby/1.9/bundler/gems/looker-sdk-ruby-a72323386700/lib/looker-sdk/client.rb:230:in `request'\r\n/var/www/looker/panopticon/releases/20150919190326/bundle/vendor/jruby/1.9/bundler/gems/looker-sdk-ruby-a72323386700/lib/looker-sdk/client.rb:137:in `paginate'\r\n/var/www/looker/panopticon/releases/20150919190326/bundle/vendor/jruby/1.9/bundler/gems/looker-sdk-ruby-a72323386700/lib/looker-sdk/client/dynamic.rb:96:in `invoke_remote'\r\n/var/www/looker/panopticon/releases/20150919190326/bundle/vendor/jruby/1.9/bundler/gems/looker-sdk-ruby-a72323386700/lib/looker-sdk/client/dynamic.rb:63:in `method_missing'\r\n/var/www/looker/panopticon/releases/20150919190326/lib/looker/permissions_api.rb:114:in `set_accounts_lists'\r\n/var/www/looker/panopticon/releases/20150919190326/lib/looker/permissions_api.rb:80:in `update'\r\n/var/www/looker/panopticon/releases/20150919190326/lib/looker/permissions_api.rb:32:in `initialize'\r\norg/jruby/RubyKernel.java:1501:in `loop'\r\n/var/www/looker/panopticon/releases/20150919190326/lib/looker/permissions_api.rb:31:in `initialize'"},"comment":{"url":"https://api.github.com/repos/looker/looker-sdk-ruby/issues/comments/142062732","html_url":"https://github.com/looker/looker-sdk-ruby/issues/38#issuecomment-142062732","issue_url":"https://api.github.com/repos/looker/looker-sdk-ruby/issues/38","id":142062732,"user":{"login":"jbandhauer","id":5367611,"avatar_url":"https://avatars.githubusercontent.com/u/5367611?v=3","gravatar_id":"","url":"https://api.github.com/users/jbandhauer","html_url":"https://github.com/jbandhauer","followers_url":"https://api.github.com/users/jbandhauer/followers","following_url":"https://api.github.com/users/jbandhauer/following{/other_user}","gists_url":"https://api.github.com/users/jbandhauer/gists{/gist_id}","starred_url":"https://api.github.com/users/jbandhauer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbandhauer/subscriptions","organizations_url":"https://api.github.com/users/jbandhauer/orgs","repos_url":"https://api.github.com/users/jbandhauer/repos","events_url":"https://api.github.com/users/jbandhauer/events{/privacy}","received_events_url":"https://api.github.com/users/jbandhauer/received_events","type":"User","site_admin":false},"created_at":"2015-09-21T18:03:51Z","updated_at":"2015-09-21T18:03:51Z","body":"Not an SDK bug. This is a known query API issue.\r\n\r\nNote that for some query errors that occur after the results are already streaming we do intentionally embed errors into a 'success' response. That happens because if the error can't be detected until some of the rows are already streamed then there isn't a lot of choice; there is no good way to signal an error at that stage because HTTP requires setting the result code at the start of the response. So, if the error is detected after a bunch of rows have already been streamed then we just stick the error into the result stream and close the connection.\r\n\r\nBut, in this case we should be signalling the error better. This is a side effect of some legacy looker code on how it returns query errors to the browser."}}