commit f280a2ea9cd8e253919fd0d15df5e885c1decda9
parent 7b602609eef76dc2248eaecd23cee13ba7169d1d
Author: MS <ms@taler.net>
Date: Mon, 21 Feb 2022 09:25:48 +0100
fix error handling
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/util/src/main/kotlin/amounts.kt b/util/src/main/kotlin/amounts.kt
@@ -1,5 +1,6 @@
package tech.libeufin.util
+import UtilError
import io.ktor.http.*
/*
@@ -29,7 +30,7 @@ fun validatePlainAmount(plainAmount: String): Boolean {
fun parseAmount(amount: String): AmountWithCurrency {
val match = Regex("([A-Z]+):([0-9]+(\\.[0-9]+)?)").find(amount) ?: throw
- EbicsProtocolError(HttpStatusCode.BadRequest, "invalid amount: $amount")
+ UtilError(HttpStatusCode.BadRequest, "invalid amount: $amount")
val (currency, number) = match.destructured
return AmountWithCurrency(currency, Amount(number))
}