Add new Exception types

This commit is contained in:
Paul Schaub 2025-04-10 12:47:00 +02:00
parent a72545e3b9
commit 65aa0afd4e
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -16,6 +16,22 @@ abstract class SOPGPException : RuntimeException {
abstract fun getExitCode(): Int
/** An otherwise unspecified failure occurred */
class UnspecificFailure : SOPGPException {
constructor(message: String) : super(message)
constructor(message: String, e: Throwable) : super(message, e)
constructor(e: Throwable) : super(e)
override fun getExitCode(): Int = EXIT_CODE
companion object {
const val EXIT_CODE = 1
}
}
/** No acceptable signatures found (sop verify, inline-verify). */
class NoSignature : SOPGPException {
@JvmOverloads
@ -378,4 +394,23 @@ abstract class SOPGPException : RuntimeException {
const val EXIT_CODE = 107
}
}
/**
* Key not certification-capable (e.g., expired, revoked, unacceptable usage flags) (sop
* certify-userid)
*/
class KeyCannotCertify : SOPGPException {
constructor(message: String) : super(message)
constructor(message: String, e: Throwable) : super(message, e)
constructor(e: Throwable) : super(e)
override fun getExitCode(): Int = EXIT_CODE
companion object {
const val EXIT_CODE = 109
}
}
}