diff options
Diffstat (limited to 'sandbox/src/main/kotlin/tech/libeufin/sandbox/Helpers.kt')
-rw-r--r-- | sandbox/src/main/kotlin/tech/libeufin/sandbox/Helpers.kt | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Helpers.kt b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Helpers.kt index de22bf34..16f1d6b9 100644 --- a/sandbox/src/main/kotlin/tech/libeufin/sandbox/Helpers.kt +++ b/sandbox/src/main/kotlin/tech/libeufin/sandbox/Helpers.kt @@ -236,11 +236,14 @@ fun getHistoryElementFromTransactionRow( * customer to own multiple bank accounts. */ fun getCustomer(username: String): DemobankCustomerEntity { + return maybeGetCustomer(username) ?: throw notFound("Customer '${username}' not found") +} +fun maybeGetCustomer(username: String): DemobankCustomerEntity? { return transaction { DemobankCustomerEntity.find { DemobankCustomersTable.username eq username }.firstOrNull() - } ?: throw notFound("Customer '${username}' not found") + } } /** |