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

Added error message for scan formatting error #52

Merged
merged 4 commits into from
Oct 21, 2021
Merged

Added error message for scan formatting error #52

merged 4 commits into from
Oct 21, 2021

Conversation

Shubhamr837
Copy link
Contributor

Scan json object is only created if scan formatting is checked as true .Try catch is added to catch JSONException thrown by ScanJson . After error occurs scan formatting is set to false for the remaining rows and error message is displayed .
should fix odk-x/tool-suite-X#220

Try catch is added to catch JSONException thrown by ScanJson . After error occurs scan formatting is set to false for the remaining rows and error message is displayed .
@odk-x-bot
Copy link

Can one of the admins verify this patch? Also need an authorization to run tests.

@wbrunette
Copy link
Member

runtests

{
e.printStackTrace();
DialogUtils.showError("Scan formatting is not possible for the selected table",true);
config.setScanFormatting(false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes more sense to abort the operation instead of selecting a different option. That also avoids adding an extra publicly mutable field to CsvConfig.

Is there a way to check if the attachment exists instead of catching the exception?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your suggestion @linl33 , The table I uploaded did had attachments and the download attachments option was also working fine . I used the geotagger table ( https://github.com/odk-x/suitcase/tree/master/testfiles/dataToUpload ) . Only this scan formatting option is returning an error . In the table metadata fetched I was unable to find any parameter which could determine if scan formatting is possible or not .
I can add code to abort the operation if a JSONException is thrown by this method . Please suggest

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linl33 thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I meant by "attachment exists" is to check if the particular attachment required to apply scan formatting exists. I think it makes more sense to abort the download when a JSONException is caught here.

@wbrunette wbrunette requested a review from linl33 April 6, 2021 18:00
@Shubhamr837
Copy link
Contributor Author

Thanks @linl33 , I have made the changes to abort the process. There was a try catch block in the ODKCsv file that was catching the exception and printing it in the log . This resulted in the process running even after there was an error . I have added the exceptions to method signature and now that exception will end the process and display an error message to the user . Please review.

@wbrunette
Copy link
Member

@linl33 does this do what you were thinking?

@wbrunette
Copy link
Member

@Shubhamr837 is this still good to go after all your other changes? I am guessing so, just confirming.

1 similar comment
@wbrunette
Copy link
Member

@Shubhamr837 is this still good to go after all your other changes? I am guessing so, just confirming.

@wbrunette
Copy link
Member

@Shubhamr837 is this PR still good to merge after all your other changes? I am guessing so, just confirming.

@Shubhamr837
Copy link
Contributor Author

@wbrunette sorry for late reply, yes this PR is needed for error handling in suitcase

@wbrunette wbrunette merged commit 03f10e7 into odk-x:development Oct 21, 2021
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

Successfully merging this pull request may close these issues.

4 participants