Uploaded image for project: 'mUzima'
  1. mUzima
  2. MUZIMA-65

Clean up exception handling

    XMLWordPrintable

    Details

      Description

      Currently we have a lot code where the code catch IOException, wrap the IOException as a process specific operation exception (CohortSaveException) and then re-throw this exception to the original caller.

      This process would make a lot of sense if we plan to handle specific operation exception differently, but currently all of those exceptions are handled by logging that particular exception.

      Example:

              } catch (CohortController.CohortDownloadException e) {
                  Log.e(TAG, "Exception when trying to download cohorts", e);
                  result[0] = SyncStatusConstants.DOWNLOAD_ERROR;
                  return result;
              } catch (CohortController.CohortSaveException e) {
                  Log.e(TAG, "Exception when trying to save cohorts", e);
                  result[0] = SyncStatusConstants.SAVE_ERROR;
                  return result;
              } catch (CohortController.CohortDeleteException e) {
                  Log.e(TAG, "Exception occurred while deleting voided cohorts", e);
                  result[0] = SyncStatusConstants.DELETE_ERROR;
                  return result;
              }
              // result[0] never being used anywhere.
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              nribeka Nyoman Ribeka
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated: