code: private void broadcastError(final Exception exception) {
  
          Logger.info(LOG_TAG, "Broadcasting error for upload with ID: "
                  + params.id + ". " + exception.getMessage());
  
          final UploadInfo uploadInfo = new UploadInfo(params.id, startTime, uploadedBytes,
                  totalBytes, (attempts - 1),
                  successfullyUploadedFiles,
                  pathStringListFrom(params.files));
  
          final UploadNotificationConfig notificationConfig = params.notificationConfig;
  
          if (notificationConfig != null && notificationConfig.getError().message != null) {
              updateNotification(uploadInfo, notificationConfig.getError());
          }
  
          BroadcastData data = new BroadcastData()
                  .setStatus(BroadcastData.Status.ERROR)
                  .setUploadInfo(uploadInfo)
                  .setException(exception);
  
          final UploadStatusDelegate delegate = UploadService.getUploadStatusDelegate(params.id);
          if (delegate != null) {
              mainThreadHandler.post(new Runnable() {
                  @Override
                  public void run() {
                      delegate.onError(service, uploadInfo, null, exception);
                  }
              });
          } else {
              service.sendBroadcast(data.getIntent());
          }
  
          service.taskCompleted(params.id);
      }
docs: Broadcasts an error.
  This called automatically by {@link UploadTask} when the specific implementation of
  {@link UploadTask#upload()} throws an exception and there aren't any left retries.
  You should never call this method explicitly in your implementation.
  
  @param exception exception to broadcast. It's the one thrown by the specific implementation
  of {@link UploadTask#upload()}