@@ -517,15 +517,21 @@ protected ServerResponse doInBackground(Void... voids) {
517517 return new ServerResponse (thisReq_ .getRequestPath (), BranchError .ERR_BRANCH_TRACKING_DISABLED , "" , "" );
518518 }
519519 String branchKey = Branch .getInstance ().prefHelper_ .getBranchKey ();
520- ServerResponse result ;
521- if (thisReq_ .isGetRequest ()) {
522- result = Branch .getInstance ().getBranchRemoteInterface ().make_restful_get (thisReq_ .getRequestUrl (), thisReq_ .getGetParams (), thisReq_ .getRequestPath (), branchKey );
523- } else {
524- BranchLogger .v ("Beginning rest post for " + thisReq_ );
525- result = Branch .getInstance ().getBranchRemoteInterface ().make_restful_post (thisReq_ .getPostWithInstrumentationValues (instrumentationExtraData_ ), thisReq_ .getRequestUrl (), thisReq_ .getRequestPath (), branchKey );
520+ ServerResponse result = null ;
521+
522+ try {
523+ if (thisReq_ .isGetRequest ()) {
524+ result = Branch .getInstance ().getBranchRemoteInterface ().make_restful_get (thisReq_ .getRequestUrl (), thisReq_ .getGetParams (), thisReq_ .getRequestPath (), branchKey );
525+ } else {
526+ BranchLogger .v ("BranchPostTask doInBackground beginning rest post for " + thisReq_ );
527+ result = Branch .getInstance ().getBranchRemoteInterface ().make_restful_post (thisReq_ .getPostWithInstrumentationValues (instrumentationExtraData_ ), thisReq_ .getRequestUrl (), thisReq_ .getRequestPath (), branchKey );
528+ }
529+ if (latch_ != null ) {
530+ latch_ .countDown ();
531+ }
526532 }
527- if ( latch_ != null ) {
528- latch_ . countDown ( );
533+ catch ( Exception e ) {
534+ BranchLogger . v ( "BranchPostTask doInBackground caught exception: " + e . getMessage () );
529535 }
530536 return result ;
531537 }
@@ -542,7 +548,7 @@ void onPostExecuteInner(ServerResponse serverResponse) {
542548 latch_ .countDown ();
543549 }
544550 if (serverResponse == null ) {
545- thisReq_ .handleFailure (BranchError .ERR_BRANCH_INVALID_REQUEST , "Null response." );
551+ thisReq_ .handleFailure (BranchError .ERR_OTHER , "Null response." );
546552 return ;
547553 }
548554
0 commit comments