mirror of
https://github.com/IT4Change/gradido.git
synced 2026-03-01 12:44:43 +00:00
better error message for validation error, fix jest error
This commit is contained in:
parent
9d4bda53da
commit
d9647183c5
@ -17,6 +17,7 @@ export function validate(schema: ObjectSchema, data: any) {
|
||||
throw new Error('missing key in config validation with joi: ' + details)
|
||||
}
|
||||
const value = err.context.value
|
||||
try {
|
||||
const description = schemaJson.keys[key]
|
||||
? schema.describe().keys[key].flags.description
|
||||
: 'No description available'
|
||||
@ -29,6 +30,10 @@ export function validate(schema: ObjectSchema, data: any) {
|
||||
`Error on Environment Variable ${key} with value = ${value}: ${err.message}. ${description}`,
|
||||
)
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Error getting description for key ' + key + ': ' + e)
|
||||
throw e
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,7 +91,8 @@ const getLoggerMocked = mock().mockImplementation((param: any) => {
|
||||
})
|
||||
|
||||
mock.module('log4js', () => ({
|
||||
getLogger: getLoggerMocked
|
||||
getLogger: getLoggerMocked,
|
||||
addLayout: jest.fn()
|
||||
}))
|
||||
|
||||
export function getLogger(name: string) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user