From f1a5ee7ee19decb14df5e9ee3aac12de94a486b0 Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Tue, 29 Jun 2021 10:18:39 +0200 Subject: [PATCH] fix: Log errors in `update` and `configureSession` --- android/src/main/java/com/mrousavy/camera/CameraView.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/android/src/main/java/com/mrousavy/camera/CameraView.kt b/android/src/main/java/com/mrousavy/camera/CameraView.kt index 3b528fe..8ed2f44 100644 --- a/android/src/main/java/com/mrousavy/camera/CameraView.kt +++ b/android/src/main/java/com/mrousavy/camera/CameraView.kt @@ -273,10 +273,12 @@ class CameraView(context: Context) : FrameLayout(context), LifecycleOwner { if (changedProps.contains("enableZoomGesture")) { setOnTouchListener(if (enableZoomGesture) touchEventListener else null) } - } catch (e: CameraError) { - invokeOnError(e) } catch (e: Throwable) { - invokeOnError(UnknownCameraError(e)) + Log.e(TAG, "update() threw: ${e.message}") + when(e) { + is CameraError -> invokeOnError(e) + else -> invokeOnError(UnknownCameraError(e)) + } } } } @@ -432,6 +434,7 @@ class CameraView(context: Context) : FrameLayout(context), LifecycleOwner { Log.i(TAG_PERF, "Session configured in $duration ms! Camera: ${camera!!}") invokeOnInitialized() } catch (exc: Throwable) { + Log.e(TAG, "Failed to configure session: ${exc.message}") throw when (exc) { is CameraError -> exc is IllegalArgumentException -> {