Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
UrlLoader and response content when Event.ERROR — Gideros Forum

UrlLoader and response content when Event.ERROR

pykasopykaso Member
edited May 2013 in User experience
Hi,

it's possible to get the response content in Event.ERROR callback?

Comments

  • ar2rsawseenar2rsawseen Maintainer
    Hello @pykaso ;)

    if Event.ERROR is called, then it means content was not retrieved, thus there is nothing to provide there
  • pykasopykaso Member
    Hello @ar2rsawseen,
    most of the REST APIs return some error content together with 4xx error header.

    In my case, I have problem with corona-cloud API. Server sent me what's wrong, but I can't see the message :(


  • ar2rsawseenar2rsawseen Maintainer
    @pykaso I think that in this case UrlLoader most probably should call Event.COMPLETE with the response that it got from the server.
    If UrlLoader gets Event.ERROR I think it should mean that it could not even connect to the remote server.
  • pykasopykaso Member
    It should to do but does not. Of course I'm using both listeners.

    loader:addEventListener(Event.COMPLETE, onComplete)
    loader:addEventListener(Event.ERROR, onError)
  • pykasopykaso Member
    Thank you for this advice, I'm sending requests with this header.
    >> POST request
    >> Headers: 
          [Content-Type] => application/x-www-form-urlencoded
          [Authorization] => Basic xxyyzz
    >> Url: <a href="https://api.coronalabs.com/.." rel="nofollow">https://api.coronalabs.com/..</a>.
     
    onErrorCallback()
    I got response content when i tried same request through curl.
  • ar2rsawseenar2rsawseen Maintainer
    edited May 2013
    Is there a description/docs of Corona API? I've registered and can set up app etc, but see no way where to send API requests, etc.

    Ok, I've found something in completely different place, let me test it
  • ar2rsawseenar2rsawseen Maintainer
    Accepted Answer
    Ok I have good news, neutral news and bad news :)

    Good news: I was able to make it work

    Neutral news: I was lazy and simply used https://github.com/coronalabs/corona-cloud-core/blob/master/corona-cloud-core.lua rewritten a bit for Gideros.
    There was a lots of auto replaces, so I may have missed something, etc, I haven't tested all, but what I tested seems to work

    Bad news: there seems to be a bug in Gideros Desktop player, thus it always gets an error callback, but everything works on devices and device players, so you may have to test everything there

    I've added the Gideros version of Corona Cloud API to the post.

    Simply add it to the project, also add json.lu from here: https://github.com/ar2rsawseen/Json

    And use it like this:
    coronaCloudController.init("accesskery", "secretkey")
    stage:addEventListener("Leaderboards", function(e)
    	print(e.results)
    end)
    stage:addEventListener("UserRegistered", function(e)
    	print(e.results)
    end)
    coronaCloudController.getLeaderboards()
    coronaCloudController.registerUser( "Test", "Test", "testtest", "test@test.test", "test" )
    I don't know if there are official Corona docs, I haven't found them, but if there are any, all the method names and parameters should be the same
    zip
    zip
    CoronaCloudAPI.zip
    6K
  • pykasopykaso Member
    Wow @ar2rsawseen,

    It looks like a lot of work. Thanks for all the news.

    I'm using too theirs corona cloud.lua rewritten a bit for Gideros :)

    The bug in Gideros Desktop player makes me sad because of simple console debug prints :)

    Gideros team, is a chance that it will be fixed soon? :(|)
Sign In or Register to comment.