Bug 1545793 - Propogate new BITS client error through the async XPCOM layer r=lina
authorKirk Steuber <ksteuber@mozilla.com>
Mon, 22 Apr 2019 16:21:53 +0000
changeset 470379 6e95f85fb09f4286e751927b89be768b7a0a4945
parent 470378 dddeb70e81e72d019d4309ac2dd138b7f03c1a2b
child 470380 27c8b8f5b3c81e5f216a4ac948c7d082e19fc287
push id112868
push useropoprus@mozilla.com
push dateMon, 22 Apr 2019 22:19:22 +0000
treeherdermozilla-inbound@24537856cc88 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslina
bugs1545793
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1545793 - Propogate new BITS client error through the async XPCOM layer r=lina Differential Revision: https://phabricator.services.mozilla.com/D28257
toolkit/components/bitsdownload/nsIBits.idl
toolkit/components/bitsdownload/src/bits_interface/error.rs
--- a/toolkit/components/bitsdownload/nsIBits.idl
+++ b/toolkit/components/bitsdownload/nsIBits.idl
@@ -83,16 +83,17 @@ interface nsIBits : nsISupports
   const long ERROR_TYPE_MISSING_BITS_CLIENT                               = 41;
   const long ERROR_TYPE_FAILED_TO_GET_JOB_STATUS                          = 42;
   const long ERROR_TYPE_BITS_STATE_ERROR                                  = 43;
   const long ERROR_TYPE_BITS_STATE_TRANSIENT_ERROR                        = 44;
   const long ERROR_TYPE_BITS_STATE_CANCELLED                              = 45;
   const long ERROR_TYPE_BITS_STATE_UNEXPECTED                             = 46;
   const long ERROR_TYPE_VERIFICATION_FAILURE                              = 47;
   const long ERROR_TYPE_ACCESS_DENIED_EXPECTED                            = 48;
+  const long ERROR_TYPE_FAILED_TO_CONNECT_TO_BCM                          = 49;
 
   /**
    * nsBitsErrorAction values
    * These values indicate where the error occurred.
    */
   const long ERROR_ACTION_UNKNOWN                                         = 1;
   const long ERROR_ACTION_NONE                                            = 2;
   const long ERROR_ACTION_START_DOWNLOAD                                  = 3;
--- a/toolkit/components/bitsdownload/src/bits_interface/error.rs
+++ b/toolkit/components/bitsdownload/src/bits_interface/error.rs
@@ -55,16 +55,17 @@ pub enum ErrorType {
     TransferAlreadyComplete,
     OperationAlreadyInProgress,
     MissingBitsClient,
     FailedToGetJobStatus,
     BitsStateError,
     BitsStateTransientError,
     BitsStateCancelled,
     BitsStateUnexpected,
+    FailedToConnectToBcm,
 }
 
 impl ErrorType {
     pub fn bits_code(&self) -> i32 {
         let val = match self {
             ErrorType::NullArgument => nsIBits::ERROR_TYPE_NULL_ARGUMENT,
             ErrorType::InvalidArgument => nsIBits::ERROR_TYPE_INVALID_ARGUMENT,
             ErrorType::NotInitialized => nsIBits::ERROR_TYPE_NOT_INITIALIZED,
@@ -111,16 +112,17 @@ impl ErrorType {
                 nsIBits::ERROR_TYPE_OPERATION_ALREADY_IN_PROGRESS
             }
             ErrorType::MissingBitsClient => nsIBits::ERROR_TYPE_MISSING_BITS_CLIENT,
             ErrorType::FailedToGetJobStatus => nsIBits::ERROR_TYPE_FAILED_TO_GET_JOB_STATUS,
             ErrorType::BitsStateError => nsIBits::ERROR_TYPE_BITS_STATE_ERROR,
             ErrorType::BitsStateTransientError => nsIBits::ERROR_TYPE_BITS_STATE_TRANSIENT_ERROR,
             ErrorType::BitsStateCancelled => nsIBits::ERROR_TYPE_BITS_STATE_CANCELLED,
             ErrorType::BitsStateUnexpected => nsIBits::ERROR_TYPE_BITS_STATE_UNEXPECTED,
+            ErrorType::FailedToConnectToBcm => nsIBits::ERROR_TYPE_FAILED_TO_CONNECT_TO_BCM,
         };
         val as i32
     }
 }
 
 impl From<&PipeError> for ErrorType {
     fn from(error: &PipeError) -> Self {
         match error {
@@ -306,16 +308,22 @@ impl From<StartJobFailure> for BitsTaskE
                 error_code: error_code.into(),
             },
             StartJobFailure::Resume(error_code) => BitsTaskError {
                 error_type: ErrorType::FailedToResumeBitsJob,
                 error_action,
                 error_stage,
                 error_code: error_code.into(),
             },
+            StartJobFailure::ConnectBcm(error_code) => BitsTaskError {
+                error_type: ErrorType::FailedToConnectToBcm,
+                error_action,
+                error_stage,
+                error_code: error_code.into(),
+            },
             StartJobFailure::OtherBITS(error_code) => BitsTaskError {
                 error_type: ErrorType::OtherBitsError,
                 error_action,
                 error_stage,
                 error_code: error_code.into(),
             },
             StartJobFailure::Other(message) => BitsTaskError {
                 error_type: ErrorType::OtherBitsClientError,
@@ -345,16 +353,22 @@ impl From<MonitorJobFailure> for BitsTas
                 error_code: ErrorCode::None,
             },
             MonitorJobFailure::GetJob(error_code) => BitsTaskError {
                 error_type: ErrorType::FailedToGetBitsJob,
                 error_action,
                 error_stage,
                 error_code: error_code.into(),
             },
+            MonitorJobFailure::ConnectBcm(error_code) => BitsTaskError {
+                error_type: ErrorType::FailedToConnectToBcm,
+                error_action,
+                error_stage,
+                error_code: error_code.into(),
+            },
             MonitorJobFailure::OtherBITS(error_code) => BitsTaskError {
                 error_type: ErrorType::OtherBitsError,
                 error_action,
                 error_stage,
                 error_code: error_code.into(),
             },
             MonitorJobFailure::Other(message) => BitsTaskError {
                 error_type: ErrorType::OtherBitsClientError,
@@ -384,16 +398,22 @@ impl From<SuspendJobFailure> for BitsTas
                 error_code: error_code.into(),
             },
             SuspendJobFailure::SuspendJob(error_code) => BitsTaskError {
                 error_type: ErrorType::FailedToSuspendBitsJob,
                 error_action,
                 error_stage,
                 error_code: error_code.into(),
             },
+            SuspendJobFailure::ConnectBcm(error_code) => BitsTaskError {
+                error_type: ErrorType::FailedToConnectToBcm,
+                error_action,
+                error_stage,
+                error_code: error_code.into(),
+            },
             SuspendJobFailure::OtherBITS(error_code) => BitsTaskError {
                 error_type: ErrorType::OtherBitsError,
                 error_action,
                 error_stage,
                 error_code: error_code.into(),
             },
             SuspendJobFailure::Other(message) => BitsTaskError {
                 error_type: ErrorType::OtherBitsClientError,
@@ -423,16 +443,22 @@ impl From<ResumeJobFailure> for BitsTask
                 error_code: error_code.into(),
             },
             ResumeJobFailure::ResumeJob(error_code) => BitsTaskError {
                 error_type: ErrorType::FailedToResumeBitsJob,
                 error_action,
                 error_stage,
                 error_code: error_code.into(),
             },
+            ResumeJobFailure::ConnectBcm(error_code) => BitsTaskError {
+                error_type: ErrorType::FailedToConnectToBcm,
+                error_action,
+                error_stage,
+                error_code: error_code.into(),
+            },
             ResumeJobFailure::OtherBITS(error_code) => BitsTaskError {
                 error_type: ErrorType::OtherBitsError,
                 error_action,
                 error_stage,
                 error_code: error_code.into(),
             },
             ResumeJobFailure::Other(message) => BitsTaskError {
                 error_type: ErrorType::OtherBitsClientError,
@@ -462,16 +488,22 @@ impl From<SetJobPriorityFailure> for Bit
                 error_code: error_code.into(),
             },
             SetJobPriorityFailure::ApplySettings(error_code) => BitsTaskError {
                 error_type: ErrorType::FailedToApplyBitsJobSettings,
                 error_action,
                 error_stage,
                 error_code: error_code.into(),
             },
+            SetJobPriorityFailure::ConnectBcm(error_code) => BitsTaskError {
+                error_type: ErrorType::FailedToConnectToBcm,
+                error_action,
+                error_stage,
+                error_code: error_code.into(),
+            },
             SetJobPriorityFailure::OtherBITS(error_code) => BitsTaskError {
                 error_type: ErrorType::OtherBitsError,
                 error_action,
                 error_stage,
                 error_code: error_code.into(),
             },
             SetJobPriorityFailure::Other(message) => BitsTaskError {
                 error_type: ErrorType::OtherBitsClientError,
@@ -534,16 +566,22 @@ impl From<CompleteJobFailure> for BitsTa
                 error_code: error_code.into(),
             },
             CompleteJobFailure::PartialComplete => BitsTaskError {
                 error_type: ErrorType::PartiallyCompletedBitsJob,
                 error_action,
                 error_stage,
                 error_code: ErrorCode::None,
             },
+            CompleteJobFailure::ConnectBcm(error_code) => BitsTaskError {
+                error_type: ErrorType::FailedToConnectToBcm,
+                error_action,
+                error_stage,
+                error_code: error_code.into(),
+            },
             CompleteJobFailure::OtherBITS(error_code) => BitsTaskError {
                 error_type: ErrorType::OtherBitsError,
                 error_action,
                 error_stage,
                 error_code: error_code.into(),
             },
             CompleteJobFailure::Other(message) => BitsTaskError {
                 error_type: ErrorType::OtherBitsClientError,
@@ -573,16 +611,22 @@ impl From<CancelJobFailure> for BitsTask
                 error_code: error_code.into(),
             },
             CancelJobFailure::CancelJob(error_code) => BitsTaskError {
                 error_type: ErrorType::FailedToCancelBitsJob,
                 error_action,
                 error_stage,
                 error_code: error_code.into(),
             },
+            CancelJobFailure::ConnectBcm(error_code) => BitsTaskError {
+                error_type: ErrorType::FailedToConnectToBcm,
+                error_action,
+                error_stage,
+                error_code: error_code.into(),
+            },
             CancelJobFailure::OtherBITS(error_code) => BitsTaskError {
                 error_type: ErrorType::OtherBitsError,
                 error_action,
                 error_stage,
                 error_code: error_code.into(),
             },
             CancelJobFailure::Other(message) => BitsTaskError {
                 error_type: ErrorType::OtherBitsClientError,