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

Commit cd029e4f authored by Hasib Prince's avatar Hasib Prince
Browse files

removed redundant exception handling

parent ee6a8faf
Loading
Loading
Loading
Loading
Loading
+2 −21
Original line number Diff line number Diff line
@@ -169,28 +169,9 @@ object RetrofitModule {
                "User-Agent",
                "Dalvik/2.1.0 (Linux; U; Android ${Build.VERSION.RELEASE};)"
            ).header("Accept-Language", Locale.getDefault().language)
            try {

            return@Interceptor chain.proceed(builder.build())
            } catch (e: ConnectException) {
                return@Interceptor buildErrorResponse(e, chain)
            } catch (e: Exception) {
                return@Interceptor buildErrorResponse(e, chain)
            }
        }
        }

    private fun buildErrorResponse(
        e: Exception,
        chain: Interceptor.Chain
    ): Response {
        Timber.e("buildErrorResponse: ${e.localizedMessage}")
        return Response.Builder()
            .code(403)
            .message(e.localizedMessage ?: "Unknown error")
            .request(chain.request())
            .protocol(Protocol.HTTP_1_1)
            .body("{}".toResponseBody("application/json; charset=utf-8".toMediaTypeOrNull()))
            .build()
    }

    @Singleton
+1 −5
Original line number Diff line number Diff line
@@ -299,11 +299,7 @@ class MainActivityViewModel @Inject constructor(
    }

    fun getLaunchIntentForPackageName(packageName: String): Intent? {
        return try {
            appLoungePackageManager.getLaunchIntent(packageName)
        } catch (e: Exception) {
            null
        }
        return appLoungePackageManager.getLaunchIntent(packageName)
    }

    fun launchPwa(application: Application) {