more infos in error logging

This commit is contained in:
einhornimmond 2025-11-13 08:35:06 +01:00
parent b63724c470
commit f716c92fe9
2 changed files with 10 additions and 2 deletions

View File

@ -91,7 +91,7 @@ export async function addTransaction(
f.involvedPublicKey = seedKeyPairRole.generateKeyPair().getPublicKey()
const deferredTransaction = senderBlockchain.findOne(f)
if (!deferredTransaction) {
throw new Error("redeem deferred transfer: couldn't find parent deferred transfer on Gradido Node")
throw new Error(`redeem deferred transfer: couldn't find parent deferred transfer on Gradido Node for ${JSON.stringify(transaction, null, 2)} and public key from seed: ${f.involvedPublicKey?.convertToHex()}`)
}
const confirmedDeferredTransaction = deferredTransaction.getConfirmedTransaction()
if (!confirmedDeferredTransaction) {

View File

@ -1,5 +1,5 @@
import { TypeBoxFromValibot } from '@sinclair/typemap'
import { Elysia, status, t } from 'elysia'
import { Elysia, status, t, ValidationError } from 'elysia'
import { AddressType_NONE } from 'gradido-blockchain-js'
import { getLogger } from 'log4js'
import * as v from 'valibot'
@ -58,6 +58,14 @@ const logger = getLogger(`${LOG4JS_BASE_CATEGORY}.server`)
* 🔗 More info: https://elysiajs.com/at-glance.html
*/
export const appRoutes = new Elysia()
.onError(({ code, error }) => {
if (code === 'VALIDATION' && error instanceof ValidationError) {
logger.debug(JSON.stringify(error.all[0], null, 2))
logger.error(error.all[0].summary)
return error.all[0].summary
}
return error
})
// check if account exists by user, call example:
// GET /isAccountExist/by-user/0.0.21732/408780b2-59b3-402a-94be-56a4f4f4e8ec/0
.get(