Git Product home page Git Product logo

Comments (15)

md5 avatar md5 commented on July 16, 2024

It looks like the response from observation_photos.json is missing the "photo" key, so o.getJSONObject("photo") returns null. That would appear to happen only when this branch is triggered in the controller: https://github.com/inaturalist/inaturalist/blob/master/app/controllers/observation_photos_controller.rb#L61

It looks like the JSON response contains an error instead of a proper response and that should probably be checked here: https://github.com/inaturalist/iNaturalistAndroid/blob/master/src/org/inaturalist/android/INaturalistService.java#L755

Regardless, a NPE should never occur, so some more error checking should certainly be done.

from inaturalistandroid.

md5 avatar md5 commented on July 16, 2024

If the rails logs are handy for the date I posted the photo, it should be possible to see what the original error message was. The observation I reported the problem for has this timestamp: Jul. 29, 2014 04:38:59 -0700

from inaturalistandroid.

md5 avatar md5 commented on July 16, 2024

Also, regarding the missing photo on disk issue, I don't think that could have been the case for me since all I did was take the photo, go into the iNat app to add the observation, and have the failed sync occur. I didn't do anything that would alter the photo on disk between those steps and it was still on my camera in the same place after the failed sync.

from inaturalistandroid.

kueda avatar kueda commented on July 16, 2024

Cool, good sleuthing. We don't keep server logs that far back, but I'll add an Airbrake notification there and see what we get.

from inaturalistandroid.

loarie avatar loarie commented on July 16, 2024

Mike - do you think this is something you can get to the bottom of and/or would it be helpful for us to contract a few hours of Yaron's time to help you look into it?

from inaturalistandroid.

md5 avatar md5 commented on July 16, 2024

I think that getting the error message from the server side would help determine the underlying issue (assuming it's just a single problem).

Beyond that, the error handling should be enhanced in the app itself, which would mean someone doing dev work on iNaturalistAndroid. I'd be happy to do that work, since it's quite easy, but I need to get my development setup for the app working and I haven't had time to do it yet since I'm on vacation :)

from inaturalistandroid.

kueda avatar kueda commented on July 16, 2024

Ok, we'll put @budowski on this issue for now then. I have the Airbrake notification in place, so if you can trigger the error again I can probably figure out what's causing the ObservationPhoto to be invalid.

from inaturalistandroid.

md5 avatar md5 commented on July 16, 2024

Sounds good. My suggestion would be to put the check for the "errors" key in the JSON response into the post method, assuming that the method of presenting errors from various controllers consistently uses that key. These invalid JSON responses should never be making it to code that expects a valid response.

Beyond that, I'm leery to recommend having null checks on every call to getJSONObject, but NPEs suck enough that it might be worth looking for a way to avoid these exceptions and get better information (e.g. a version of getJSONObject that throws an informative exception on a missing key).

from inaturalistandroid.

loarie avatar loarie commented on July 16, 2024

I'm not running into any problems along these lines during my use of the Android app - Mike are you still?

from inaturalistandroid.

md5 avatar md5 commented on July 16, 2024

I haven't noticed it lately. I'm curious whether anything ever showed up in Airbrake though.

from inaturalistandroid.

loarie avatar loarie commented on July 16, 2024

I'm looking at Airbreak now - do you know how to access the Notification Ken-ichi's referring to?

from inaturalistandroid.

md5 avatar md5 commented on July 16, 2024

I think it would say "Failed to create observation photo" (cf. https://github.com/inaturalist/inaturalist/blob/master/app/controllers/observation_photos_controller.rb#L62-L63)

from inaturalistandroid.

loarie avatar loarie commented on July 16, 2024

I don't see any 'Failed to create observation photo' notifications (under resolved or unresolved errors) on Airbrake searching through the last 6 months

from inaturalistandroid.

md5 avatar md5 commented on July 16, 2024

Good to hear that. If the work was never done to standardize the error handling in this app, I think it still makes sense as an enhancement, but I'd consider this immediate issue closed for the moment.

The bottom line is that images were failing to sync because something was breaking on the server that is no longer breaking. The enhanced error handling just helps to make better sense of future server errors, should they occur.

from inaturalistandroid.

loarie avatar loarie commented on July 16, 2024

ok great - I think @pleary is going to take on standardizing error handling in the coming months. Thanks for your help with this and everything else, Mike

from inaturalistandroid.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.