Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 762c8ed5 authored by Danny Lin's avatar Danny Lin
Browse files

fastboot: Always propagate device connect exceptions

This reduces the chances of silent error suppression. Errors are already
handled in the event handler that requests error suppression.
parent 8777c26c
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ export class FastbootDevice {
     *
     * @private
     */
    async _validateAndConnectDevice(rethrowErrors) {
    async _validateAndConnectDevice() {
        // Validate device
        let ife = this.device.configurations[0].interfaces[0].alternates[0];
        if (ife.endpoints.length !== 2) {
@@ -123,10 +123,8 @@ export class FastbootDevice {
                this._connectReject = null;
            }

            if (rethrowErrors) {
            throw error;
        }
        }

        // Return from waitForConnect()
        if (this._connectResolve !== null) {
@@ -227,7 +225,7 @@ export class FastbootDevice {
                // Check whether waitForConnect() is pending and save it for later
                let hasPromiseReject = this._connectReject !== null;
                try {
                    await this._validateAndConnectDevice(false);
                    await this._validateAndConnectDevice();
                } catch (error) {
                    // Only rethrow errors from the event handler if waitForConnect()
                    // didn't already handle them
@@ -240,7 +238,7 @@ export class FastbootDevice {
            this._registeredUsbListeners = true;
        }

        await this._validateAndConnectDevice(true);
        await this._validateAndConnectDevice();
    }

    /**