diff --git a/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/auth/AuthAppException.kt b/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/auth/AuthAppException.kt new file mode 100644 index 0000000..96b05d5 --- /dev/null +++ b/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/auth/AuthAppException.kt @@ -0,0 +1,10 @@ +package com.tarkvaraprojekt.mobileauthapp.auth + +/** + * A specialised RuntimeException class for exceptions related to the mobile authentication app. + * Possible error codes can be found at + * https://github.com/TanelOrumaa/Estonian-ID-card-mobile-authenticator-POC/wiki/Error-codes + * @param message Error message + * @param code An error code defined in the project wiki + */ +open class AuthAppException(message: String, var code: Int) : RuntimeException(message) \ No newline at end of file diff --git a/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/auth/InvalidCANException.kt b/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/auth/InvalidCANException.kt new file mode 100644 index 0000000..073c790 --- /dev/null +++ b/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/auth/InvalidCANException.kt @@ -0,0 +1,7 @@ +package com.tarkvaraprojekt.mobileauthapp.auth + +/** + * An AuthAppException for when the user entered CAN does not match the one read from the ID-card + * @see AuthAppException + */ +class InvalidCANException : AuthAppException("Invalid CAN", 400) \ No newline at end of file