Comments (15)
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.
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.
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.
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.
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.
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.
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.
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.
I'm not running into any problems along these lines during my use of the Android app - Mike are you still?
from inaturalistandroid.
I haven't noticed it lately. I'm curious whether anything ever showed up in Airbrake though.
from inaturalistandroid.
I'm looking at Airbreak now - do you know how to access the Notification Ken-ichi's referring to?
from inaturalistandroid.
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.
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.
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.
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)
- Can no longer access phone's Gallery app when importing photos
- Observers list in Explore - some people are listed twice HOT 2
- Allow iNat to only access one's approximate location prevents the app from obtaining any location
- JSONException in ObservationViewerFragment$PhotosViewPagerAdapter.instantiateItem HOT 1
- Long pressing IDs or comments made by others brings up options menu
- News tab uses last-modified date to sort journal posts
- Consistent location icon for obscured and public locations HOT 2
- JSONException in ObservationViewerFragment
- NullPointerException in ObservationViewerFragment
- ActivityNotFoundException in ObservationEditor.takePhoto
- Can't import sounds made with Recorder app HOT 1
- Accomodate new subject DQA flag HOT 2
- Android banner and modal for unconfirmed users HOT 7
- Suggestions compare screen doesn't show taxon photos HOT 1
- Replace all instances of Whitney with Roboto
- ArrayIndexOutOfBoundsException in TaxonActivity.refreshSeasonalityChart
- Suggest ID infinite loop HOT 2
- App available in F-Droid HOT 2
- App crashes if you add an ID to an unidentified observation where the observer has opted out of community ID HOT 1
- Obscure date/time for private/obscured obs the user does not have access to
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from inaturalistandroid.