From 758f815aa1922b1678488dd2e5867319f45f2bf9 Mon Sep 17 00:00:00 2001 From: Tim H Date: Tue, 10 Oct 2017 15:59:01 +0200 Subject: [PATCH] introduce new camera exceptions --- .../CameraConfigurationFailedException.java | 16 ++++++++++++++++ .../cameraview/CameraUnavailableException.java | 17 +++++++++++++++++ .../cameraview/CapturingFailedException.java | 15 +++++++++++++++ .../CapturingImageFailedException.java | 17 +++++++++++++++++ .../CapturingPictureFailedException.java | 17 +++++++++++++++++ .../CapturingSnapshotFailedException.java | 17 +++++++++++++++++ .../CapturingVideoFailedException.java | 16 ++++++++++++++++ 7 files changed, 115 insertions(+) create mode 100644 cameraview/src/main/java/com/otaliastudios/cameraview/CameraConfigurationFailedException.java create mode 100644 cameraview/src/main/java/com/otaliastudios/cameraview/CameraUnavailableException.java create mode 100644 cameraview/src/main/java/com/otaliastudios/cameraview/CapturingFailedException.java create mode 100644 cameraview/src/main/java/com/otaliastudios/cameraview/CapturingImageFailedException.java create mode 100644 cameraview/src/main/java/com/otaliastudios/cameraview/CapturingPictureFailedException.java create mode 100644 cameraview/src/main/java/com/otaliastudios/cameraview/CapturingSnapshotFailedException.java create mode 100644 cameraview/src/main/java/com/otaliastudios/cameraview/CapturingVideoFailedException.java diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraConfigurationFailedException.java b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraConfigurationFailedException.java new file mode 100644 index 00000000..ef035ed8 --- /dev/null +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraConfigurationFailedException.java @@ -0,0 +1,16 @@ +package com.otaliastudios.cameraview; + +/** + * An object of this class describes an error that occurred during the normal runtime of the camera. + * The previously started setting change failed, but the camera should be still available. + */ +public class CameraConfigurationFailedException extends CameraException { + + CameraConfigurationFailedException(String message) { + super(message); + } + + CameraConfigurationFailedException(String message, Throwable cause) { + super(message, cause); + } +} \ No newline at end of file diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/CameraUnavailableException.java b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraUnavailableException.java new file mode 100644 index 00000000..e8637746 --- /dev/null +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/CameraUnavailableException.java @@ -0,0 +1,17 @@ +package com.otaliastudios.cameraview; + +/** + * An object of this class describes an error that occurred during the normal runtime of the camera. + * It prevents the camera from being used. The cause may be temporary or permanent. You should + * restart the camera or deactivate any user interaction with the camera. + */ +public class CameraUnavailableException extends CameraException { + + CameraUnavailableException(String message) { + super(message); + } + + CameraUnavailableException(String message, Throwable cause) { + super(message, cause); + } +} \ No newline at end of file diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/CapturingFailedException.java b/cameraview/src/main/java/com/otaliastudios/cameraview/CapturingFailedException.java new file mode 100644 index 00000000..f5e8044c --- /dev/null +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/CapturingFailedException.java @@ -0,0 +1,15 @@ +package com.otaliastudios.cameraview; + +/** + * An object of this class describes an error that occurred during the normal runtime of the camera. + * The previously started capturing failed, but the camera should be still available. + */ +public abstract class CapturingFailedException extends CameraException { + CapturingFailedException(String message) { + super(message); + } + + CapturingFailedException(String message, Throwable cause) { + super(message, cause); + } +} \ No newline at end of file diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/CapturingImageFailedException.java b/cameraview/src/main/java/com/otaliastudios/cameraview/CapturingImageFailedException.java new file mode 100644 index 00000000..58ee4b74 --- /dev/null +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/CapturingImageFailedException.java @@ -0,0 +1,17 @@ +package com.otaliastudios.cameraview; + +/** + * An object of this class describes an error that occurred during the normal runtime of the camera. + * The previously started image capturing failed (snapshot or "real picture"), but the camera should + * be still available. + */ +public abstract class CapturingImageFailedException extends CapturingFailedException { + + CapturingImageFailedException(String message) { + super(message); + } + + CapturingImageFailedException(String message, Throwable cause) { + super(message, cause); + } +} \ No newline at end of file diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/CapturingPictureFailedException.java b/cameraview/src/main/java/com/otaliastudios/cameraview/CapturingPictureFailedException.java new file mode 100644 index 00000000..ea6aa6fa --- /dev/null +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/CapturingPictureFailedException.java @@ -0,0 +1,17 @@ +package com.otaliastudios.cameraview; + +/** + * An object of this class describes an error that occurred during the normal runtime of the camera. + * The previously started picture capturing failed, but the camera should be still available. + * This exception does not handle failed snapshots. + */ +public class CapturingPictureFailedException extends CapturingImageFailedException { + + CapturingPictureFailedException(String message) { + super(message); + } + + CapturingPictureFailedException(String message, Throwable cause) { + super(message, cause); + } +} \ No newline at end of file diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/CapturingSnapshotFailedException.java b/cameraview/src/main/java/com/otaliastudios/cameraview/CapturingSnapshotFailedException.java new file mode 100644 index 00000000..f19de20c --- /dev/null +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/CapturingSnapshotFailedException.java @@ -0,0 +1,17 @@ +package com.otaliastudios.cameraview; + +/** + * An object of this class describes an error that occurred during the normal runtime of the camera. + * The previously started snapshot capturing failed, but the camera should be still available. + * This exception does not handle failed "real picture" capturing. + */ +public class CapturingSnapshotFailedException extends CapturingImageFailedException { + + CapturingSnapshotFailedException(String message) { + super(message); + } + + CapturingSnapshotFailedException(String message, Throwable cause) { + super(message, cause); + } +} \ No newline at end of file diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/CapturingVideoFailedException.java b/cameraview/src/main/java/com/otaliastudios/cameraview/CapturingVideoFailedException.java new file mode 100644 index 00000000..d9707b8d --- /dev/null +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/CapturingVideoFailedException.java @@ -0,0 +1,16 @@ +package com.otaliastudios.cameraview; + +/** + * An object of this class describes an error that occurred during the normal runtime of the camera. + * The previously started video capturing failed, but the camera should be still available. + */ +public class CapturingVideoFailedException extends CapturingFailedException { + + CapturingVideoFailedException(String message) { + super(message); + } + + CapturingVideoFailedException(String message, Throwable cause) { + super(message, cause); + } +} \ No newline at end of file