From 09ed1dcda46385d0c2e82feeff1a6f0761215de0 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Wed, 17 Nov 2021 08:39:01 -0800 Subject: [PATCH] Combined constructors. --- .../thauvin/erik/crypto/CryptoException.kt | 25 ++++--------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/src/main/kotlin/net/thauvin/erik/crypto/CryptoException.kt b/src/main/kotlin/net/thauvin/erik/crypto/CryptoException.kt index 38dc96f..583c872 100644 --- a/src/main/kotlin/net/thauvin/erik/crypto/CryptoException.kt +++ b/src/main/kotlin/net/thauvin/erik/crypto/CryptoException.kt @@ -35,26 +35,11 @@ package net.thauvin.erik.crypto /** * Thrown when an exceptional condition has occurred. */ -@Suppress("unused") -class CryptoException : Exception { - var statusCode: Int - private set - - /** Constructs a new exception with the specified status code, message and cause. */ - constructor(statusCode: Int = NO_STATUS, message: String, cause: Throwable) : super(message, cause) { - this.statusCode = statusCode - } - - /** Constructs a new exception with the specified status code and message. */ - constructor(statusCode: Int = NO_STATUS, message: String) : super(message) { - this.statusCode = statusCode - } - - /** Constructs a new exception with the specified status code and cause. */ - constructor(statusCode: Int = NO_STATUS, cause: Throwable) : super(cause) { - this.statusCode = statusCode - } - +class CryptoException @JvmOverloads constructor( + var statusCode: Int = NO_STATUS, + message: String, + cause: Throwable? = null +) : Exception(message, cause) { companion object { const val NO_STATUS = -1 private const val serialVersionUID = 1L