refactor/tweaked the error message

This commit is contained in:
hongwei 2025-01-23 22:36:36 +08:00
parent 17b83123c1
commit e1d2d92edd
4 changed files with 9 additions and 9 deletions

View File

@ -504,7 +504,7 @@ There are the following request types on this access path:
})
}
SigningBasketX.signingBasketProvider.vend.saveSigningBasketStatus(basketId, ConstantsBG.SigningBasketsStatus.ACTC.toString)
unboxFullOrFail(boxedChallenge, callContext, s"$InvalidConnectorResponse ")
unboxFullOrFail(boxedChallenge, callContext, s"$InvalidConnectorResponse validateChallengeAnswerC5")
} else { // Fail due to unexisting payment
val paymentIds = basket.flatMap(_.payments).getOrElse(Nil).mkString(",")
unboxFullOrFail(Empty, callContext, s"$InvalidConnectorResponse Some of paymentIds [${paymentIds}] are invalid")
@ -520,10 +520,10 @@ There are the following request types on this access path:
})
}
// Fail in case of an error message
unboxFullOrFail(boxedChallenge, callContext, s"$InvalidConnectorResponse ")
unboxFullOrFail(boxedChallenge, callContext, s"$InvalidConnectorResponse validateChallengeAnswerC5")
}
case _ => // Fail in case of an error message
Future(unboxFullOrFail(Empty, callContext, s"$InvalidConnectorResponse "))
Future(unboxFullOrFail(Empty, callContext, s"$InvalidConnectorResponse getChallenge"))
}
} yield {
(JSONFactory_BERLIN_GROUP_1_3.createStartPaymentAuthorisationJson(challenge), callContext)

View File

@ -3167,7 +3167,7 @@ object APIUtil extends MdcLoggable with CustomJsonFormats{
}
def connectorEmptyResponse[T](box: Box[T], cc: Option[CallContext])(implicit m: Manifest[T]): T = {
unboxFullOrFail(box, cc, InvalidConnectorResponse, 400)
unboxFullOrFail(box, cc, s"$InvalidConnectorResponse ${nameOf(connectorEmptyResponse _)}" , 400)
}
def unboxFuture[T](box: Box[Future[T]]): Future[Box[T]] = box match {

View File

@ -1,12 +1,12 @@
package code.api.util.newstyle
import code.api.util.APIUtil.{OBPReturnType, unboxFullOrFail}
import code.api.util.ErrorMessages.InvalidConnectorResponseForGetBankAccounts
import code.api.util.ErrorMessages.{InvalidConnectorResponse}
import code.api.util.{APIUtil, CallContext}
import code.bankconnectors.Connector
import code.views.Views
import com.openbankproject.commons.model.{AccountBalances, AccountsBalances, BankId, BankIdAccountId, User, ViewId}
import com.github.dwickern.macros.NameOf.nameOf
import scala.concurrent.Future
object BalanceNewStyle {
@ -46,13 +46,13 @@ object BalanceNewStyle {
def getBankAccountBalances(bankIdAccountId: BankIdAccountId, callContext: Option[CallContext]): OBPReturnType[AccountBalances] = {
Connector.connector.vend.getBankAccountBalances(bankIdAccountId: BankIdAccountId, callContext: Option[CallContext]) map { i =>
(unboxFullOrFail(i._1, callContext,s"$InvalidConnectorResponseForGetBankAccounts", 400 ), i._2)
(unboxFullOrFail(i._1, callContext,s"$InvalidConnectorResponse ${nameOf(getBankAccountBalances _)} ", 400 ), i._2)
}
}
def getBankAccountsBalances(bankIdAccountIds: List[BankIdAccountId], callContext: Option[CallContext]): OBPReturnType[AccountsBalances] = {
Connector.connector.vend.getBankAccountsBalances(bankIdAccountIds: List[BankIdAccountId], callContext: Option[CallContext]) map { i =>
(unboxFullOrFail(i._1, callContext,s"$InvalidConnectorResponseForGetBankAccounts", 400 ), i._2)
(unboxFullOrFail(i._1, callContext,s"$InvalidConnectorResponse ${nameOf(getBankAccountsBalances _)}", 400 ), i._2)
}
}

View File

@ -339,7 +339,7 @@ case class BankAccountExtended(val bankAccount: BankAccount) extends MdcLoggable
if(APIUtil.hasAccountAccess(view, BankIdAccountId(bankId, accountId), user, callContext)) {
for {
(transactions, callContext) <- Connector.connector.vend.getTransactions(bankId, accountId, callContext, queryParams) map {
x => (unboxFullOrFail(x._1, callContext, InvalidConnectorResponse, 400), x._2)
x => (unboxFullOrFail(x._1, callContext, InvalidConnectorResponseForGetTransactions, 400), x._2)
}
} yield {
view.moderateTransactionsWithSameAccount(bank, transactions) match {