scottgonzalez/node-browserstack

takeScreenshot failing

Closed this issue · 5 comments

Hey there, I am encountering an intermittent error and just not too sure where it's coming from, the takeScreenshot callback is passed error, data but when logging it out it seems to have been passed incorrect values.

error = null;
data = {};

I think that this is being caused by the remote browser having been shutdown and it's actually the Browserstack API that could be passing the wrong value? Any thoughts would be welcome.

Yeah, this is what happens if the worker isn't active. It also happens if the worker id isn't even valid. I thought I had checked what was happening in this case when I wrote the implementation, but either I didn't or the API changed.

@nakula @rahulnwn Is this intended behavior? I'd expect an error response when trying to take a screenshot with an invalid or terminated worker.

I suppose that case was not handled. It has been fixed now.

Thanks for looking into that. Great to see things failing loudly,
especially during early experimentation. Really excited about this API!

Typed on a mobile, which should explain a lot.
On Sep 19, 2013 5:42 PM, "rahulnwn" notifications@github.com wrote:

I suppose that case was not handled. It has been fixed now.


Reply to this email directly or view it on GitHubhttps://github.com//issues/21#issuecomment-24754034
.

Thanks @rahulnwn. All other error responses contain an errors array in addition to the message field. The current response is:

{
    "message": "Worker not found"
}

For consistency, I would have expected something like:

{
    "message": "Worker not found",
    "errors": [
        { "code": "invalid", "field": "id" }
    ]
}

I'm not too concerned about this, but if the error will stay as is, I'll need to update the error handling.

The error reporting has been fixed upstream.