double-check : Use validate and log error
This commit is contained in:
+4
-2
@@ -14,10 +14,12 @@ export async function parse<S extends yup.Maybe<yup.AnyObject>>(schema: yup.Obje
|
||||
if (!config.ok) return config
|
||||
|
||||
log.trace('double-check')
|
||||
const res = await schema.isValid(config.data, {strict: true})
|
||||
if (!res) {
|
||||
try {
|
||||
await schema.validate(config.data, {strict: true})
|
||||
} catch (e) {
|
||||
log.error('Double-check failed')
|
||||
log.debug('Config', config.data)
|
||||
log.debug('Error:', e)
|
||||
return {ok: false}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user