diff --git a/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/ManagementService.kt b/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/ManagementService.kt index 2a80396af47c..325bef869277 100644 --- a/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/ManagementService.kt +++ b/android/lib/daemon-grpc/src/main/kotlin/net/mullvad/mullvadvpn/lib/daemon/grpc/ManagementService.kt @@ -245,16 +245,19 @@ class ManagementService( suspend fun getDevice(): Either = Either.catch { grpc.getDevice(Empty.getDefaultInstance()) } .map { it.toDomain() } + .onLeft { Logger.e("Get device error", it) } .mapLeft { GetDeviceStateError.Unknown(it) } suspend fun updateDevice(): Either = Either.catch { grpc.updateDevice(Empty.getDefaultInstance()) } .mapEmpty() + .onLeft { Logger.e("Update device error", it) } .mapLeft { DeviceUpdateError(it) } suspend fun getDeviceList(token: AccountNumber): Either> = Either.catch { grpc.listDevices(StringValue.of(token.value)) } .map { it.devicesList.map(ManagementInterface.Device::toDomain) } + .onLeft { Logger.e("Get device list error", it) } .mapLeft { GetDeviceListError.Unknown(it) } suspend fun removeDevice( @@ -270,10 +273,12 @@ class ManagementService( ) } .mapEmpty() + .onLeft { Logger.e("Remove device error", it) } .mapLeft { DeleteDeviceError.Unknown(it) } suspend fun connect(): Either = Either.catch { grpc.connectTunnel(Empty.getDefaultInstance()).value } + .onLeft { Logger.e("Connect error", it) } .mapLeft(ConnectError::Unknown) suspend fun disconnect(): Either = @@ -302,6 +307,7 @@ class ManagementService( // will get 404 until the api have been published, thus we need to ignore error downstream. private suspend fun getVersionInfo(): Either = Either.catch { grpc.getVersionInfo(Empty.getDefaultInstance()).toDomain() } + .onLeft { Logger.e("Get version info error", it) } .mapLeft { GetVersionInfoError.Unknown(it) } private suspend fun getCurrentApiAccessMethod(): ApiAccessMethodSetting = @@ -341,6 +347,7 @@ class ManagementService( null } } + .onLeft { Logger.e("Get account history error", it) } .mapLeft(GetAccountHistoryError::Unknown) private suspend fun getInitialServiceState() { @@ -360,6 +367,7 @@ class ManagementService( accountNumber: AccountNumber ): Either = Either.catch { grpc.getAccountData(StringValue.of(accountNumber.value)).toDomain() } + .onLeft { Logger.e("Get account data error", it) } .mapLeft(GetAccountDataError::Unknown) suspend fun createAccount(): Either = @@ -367,10 +375,12 @@ class ManagementService( val accountNumberStringValue = grpc.createNewAccount(Empty.getDefaultInstance()) AccountNumber(accountNumberStringValue.value) } + .onLeft { Logger.e("Create account error", it) } .mapLeft(CreateAccountError::Unknown) suspend fun setDnsOptions(dnsOptions: ModelDnsOptions): Either = Either.catch { grpc.setDnsOptions(dnsOptions.fromDomain()) } + .onLeft { Logger.e("Set dns options error", it) } .mapLeft(SetDnsOptionsError::Unknown) .mapEmpty() @@ -380,6 +390,7 @@ class ManagementService( val updated = DnsOptions.state.set(currentDnsOptions, dnsState) grpc.setDnsOptions(updated.fromDomain()) } + .onLeft { Logger.e("Set dns state error", it) } .mapLeft(SetDnsOptionsError::Unknown) .mapEmpty() @@ -393,6 +404,7 @@ class ManagementService( grpc.setDnsOptions(updatedDnsOptions.fromDomain()) } + .onLeft { Logger.e("Set custom dns error", it) } .mapLeft(SetDnsOptionsError::Unknown) .mapEmpty() @@ -404,6 +416,7 @@ class ManagementService( grpc.setDnsOptions(updatedDnsOptions.fromDomain()) updatedDnsOptions.customOptions.addresses.lastIndex } + .onLeft { Logger.e("Add custom dns error", it) } .mapLeft(SetDnsOptionsError::Unknown) suspend fun deleteCustomDns(index: Int): Either = @@ -417,16 +430,19 @@ class ManagementService( } grpc.setDnsOptions(updatedDnsOptions.fromDomain()) } + .onLeft { Logger.e("Delete custom dns error", it) } .mapLeft(SetDnsOptionsError::Unknown) .mapEmpty() suspend fun setWireguardMtu(value: Int): Either = Either.catch { grpc.setWireguardMtu(UInt32Value.of(value)) } + .onLeft { Logger.e("Set wireguard mtu error", it) } .mapLeft(SetWireguardMtuError::Unknown) .mapEmpty() suspend fun resetWireguardMtu(): Either = Either.catch { grpc.setWireguardMtu(UInt32Value.newBuilder().clearValue().build()) } + .onLeft { Logger.e("Reset wireguard mtu error", it) } .mapLeft(SetWireguardMtuError::Unknown) .mapEmpty() @@ -434,6 +450,7 @@ class ManagementService( value: ModelQuantumResistantState ): Either = Either.catch { grpc.setQuantumResistantTunnel(value.toDomain()) } + .onLeft { Logger.e("Set wireguard quantum resistant error", it) } .mapLeft(SetWireguardQuantumResistantError::Unknown) .mapEmpty() @@ -449,6 +466,7 @@ class ManagementService( } grpc.setObfuscationSettings(updatedObfuscationSettings.fromDomain()) } + .onLeft { Logger.e("Set obfuscation error", it) } .mapLeft(SetObfuscationOptionsError::Unknown) .mapEmpty() @@ -462,16 +480,19 @@ class ManagementService( } grpc.setObfuscationSettings(updatedSettings.fromDomain()) } + .onLeft { Logger.e("Set obfuscation port error", it) } .mapLeft(SetObfuscationOptionsError::Unknown) .mapEmpty() suspend fun setAutoConnect(isEnabled: Boolean): Either = Either.catch { grpc.setAutoConnect(BoolValue.of(isEnabled)) } + .onLeft { Logger.e("Set auto connect error", it) } .mapLeft(SetAutoConnectError::Unknown) .mapEmpty() suspend fun setAllowLan(allow: Boolean): Either = Either.catch { grpc.setAllowLan(BoolValue.of(allow)) } + .onLeft { Logger.e("Set allow lan error", it) } .mapLeft(SetAllowLanError::Unknown) .mapEmpty() @@ -485,6 +506,7 @@ class ManagementService( ) grpc.setRelaySettings(updatedRelaySettings.fromDomain()) } + .onLeft { Logger.e("Set relay location error", it) } .mapLeft(SetRelayLocationError::Unknown) .mapEmpty() @@ -502,16 +524,19 @@ class ManagementService( suspend fun updateCustomList(customList: ModelCustomList): Either = Either.catch { grpc.updateCustomList(customList.fromDomain()) } + .onLeft { Logger.e("Update custom list error", it) } .mapLeft(::UnknownCustomListError) .mapEmpty() suspend fun deleteCustomList(id: CustomListId): Either = Either.catch { grpc.deleteCustomList(StringValue.of(id.value)) } + .onLeft { Logger.e("Delete custom list error", it) } .mapLeft(::UnknownCustomListError) .mapEmpty() suspend fun clearAllRelayOverrides(): Either = Either.catch { grpc.clearAllRelayOverrides(Empty.getDefaultInstance()) } + .onLeft { Logger.e("Clear all relay overrides error", it) } .mapLeft(ClearAllOverridesError::Unknown) .mapEmpty() @@ -535,6 +560,7 @@ class ManagementService( RelaySettings.relayConstraints.wireguardConstraints.set(relaySettings, value) grpc.setRelaySettings(updated.fromDomain()) } + .onLeft { Logger.e("Set wireguard constraints error", it) } .mapLeft(SetWireguardConstraintsError::Unknown) .mapEmpty() @@ -553,6 +579,7 @@ class ManagementService( } grpc.setRelaySettings(updated.fromDomain()) } + .onLeft { Logger.e("Set ownership and providers error", it) } .mapLeft(SetWireguardConstraintsError::Unknown) .mapEmpty() @@ -564,6 +591,7 @@ class ManagementService( val updated = RelaySettings.relayConstraints.ownership.set(relaySettings, ownership) grpc.setRelaySettings(updated.fromDomain()) } + .onLeft { Logger.e("Set ownership error", it) } .mapLeft(SetWireguardConstraintsError::Unknown) .mapEmpty() @@ -576,6 +604,7 @@ class ManagementService( RelaySettings.relayConstraints.providers.set(relaySettings, providersConstraint) grpc.setRelaySettings(updated.fromDomain()) } + .onLeft { Logger.e("Set providers error", it) } .mapLeft(SetWireguardConstraintsError::Unknown) .mapEmpty() @@ -594,20 +623,24 @@ class ManagementService( suspend fun initializePlayPurchase(): Either = Either.catch { grpc.initPlayPurchase(Empty.getDefaultInstance()).toDomain() } + .onLeft { Logger.e("Initialize play purchase error", it) } .mapLeft { PlayPurchaseInitError.OtherError } suspend fun verifyPlayPurchase(purchase: PlayPurchase): Either = Either.catch { grpc.verifyPlayPurchase(purchase.fromDomain()) } + .onLeft { Logger.e("Verify play purchase error", it) } .mapLeft { PlayPurchaseVerifyError.OtherError } .mapEmpty() suspend fun addSplitTunnelingApp(app: AppId): Either = Either.catch { grpc.addSplitTunnelApp(StringValue.of(app.value)) } + .onLeft { Logger.e("Add split tunneling app error", it) } .mapLeft(AddSplitTunnelingAppError::Unknown) .mapEmpty() suspend fun removeSplitTunnelingApp(app: AppId): Either = Either.catch { grpc.removeSplitTunnelApp(StringValue.of(app.value)) } + .onLeft { Logger.e("Remove split tunneling app error", it) } .mapLeft(RemoveSplitTunnelingAppError::Unknown) .mapEmpty() @@ -615,17 +648,20 @@ class ManagementService( enabled: Boolean ): Either = Either.catch { grpc.setSplitTunnelState(BoolValue.of(enabled)) } + .onLeft { Logger.e("Set split tunneling state error", it) } .mapLeft(RemoveSplitTunnelingAppError::Unknown) .mapEmpty() suspend fun getWebsiteAuthToken(): Either = Either.catch { grpc.getWwwAuthToken(Empty.getDefaultInstance()) } + .onLeft { Logger.e("Get website auth token error", it) } .map { WebsiteAuthToken.fromString(it.value) } suspend fun addApiAccessMethod( newAccessMethodSetting: NewAccessMethodSetting ): Either = Either.catch { grpc.addApiAccessMethod(newAccessMethodSetting.fromDomain()) } + .onLeft { Logger.e("Add api access method error", it) } .mapLeft(AddApiAccessMethodError::Unknown) .map { ApiAccessMethodId.fromString(it.value) } @@ -633,6 +669,7 @@ class ManagementService( apiAccessMethodId: ApiAccessMethodId ): Either = Either.catch { grpc.removeApiAccessMethod(apiAccessMethodId.fromDomain()) } + .onLeft { Logger.e("Remove api access method error", it) } .mapLeft(RemoveApiAccessMethodError::Unknown) .mapEmpty() @@ -640,6 +677,7 @@ class ManagementService( apiAccessMethodId: ApiAccessMethodId ): Either = Either.catch { grpc.setApiAccessMethod(apiAccessMethodId.fromDomain()) } + .onLeft { Logger.e("Set api access method error", it) } .mapLeft(SetApiAccessMethodError::Unknown) .mapEmpty() @@ -647,6 +685,7 @@ class ManagementService( apiAccessMethodSetting: ApiAccessMethodSetting ): Either = Either.catch { grpc.updateApiAccessMethod(apiAccessMethodSetting.fromDomain()) } + .onLeft { Logger.e("Update api access method error", it) } .mapLeft(::UnknownApiAccessMethodError) .mapEmpty()