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

[Android] Net module - only supports success calls? #44

Open
rafaeliga opened this issue Aug 19, 2016 · 5 comments
Open

[Android] Net module - only supports success calls? #44

rafaeliga opened this issue Aug 19, 2016 · 5 comments

Comments

@rafaeliga
Copy link
Contributor

rafaeliga commented Aug 19, 2016

When my api returns any status code different from 200, I get this error/crash:

--------- beginning of main
--------- beginning of system
(main)> 08-19 15:56:03.087 31788 31952 E br/com/rubythree/hello: Java exception raised: java.io.FileNotFoundException: http://192.168.1.119:3000/api/tokens.json
--------- beginning of crash

My call:

begin
 Net.post(url, options) do |response|
  p response.body
 end
rescue => e
 p e
 p e.message
end

I try to add a begin/rescue blocks, but it didnt work.

@jjaffeux
Copy link
Contributor

Please provide a sample I can run

@rafaeliga
Copy link
Contributor Author

I created a new project to test:

motion create --template=flow HelloFlowSample

main_activity.rb

class MainActivity < Android::App::Activity
  def onCreate(savedInstanceState)
    Store.context = self
    super

    Net.get('http://www.google.com/error') do |response|
      p "====== #{response.status} ======="
    end    
  end
end

Crash/error:

--------- beginning of system
--------- beginning of main
(main)> 08-19 16:23:41.134 7839 7944 E com/yourcompany/helloflowsample: Java exception raised: java.io.FileNotFoundException: http://www.google.com/error
--------- beginning of crash

@rafaeliga
Copy link
Contributor Author

hey @jjaffeux, did you reproduce the crash?

I would try to debug the Java files....can you help me with that?

thanks

@rafaeliga
Copy link
Contributor Author

@jjaffeux can you help me to start on debug and fix this error on Flow/Net? Which file should be looking? android/request.rb(https://github.com/HipByte/Flow/blob/master/flow/net/android/request.rb)? Thanks!

@rafaeliga
Copy link
Contributor Author

@jjaffeux please check the pull request that I created when you have a chance! Thanks!

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