Skip to content

Commit

Permalink
fix: transforme should before validate
Browse files Browse the repository at this point in the history
  • Loading branch information
Val-istar-Guo committed Jan 20, 2024
1 parent 89bd0dd commit d6a2501
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/config.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,15 @@ export class ConfigModule extends ConfigurableModuleClass {
if (value !== undefined) instance[key] = value
}

const errors = await validate(instance)
const result = instanceToInstance(instance)
const errors = await validate(result)

if (errors.length) {
Logger.error(errors.map((error) => error.toString()).join('\n'))
throw new Error(errors.map((error) => error.toString()).join('\n'))
}

return instanceToInstance(instance)
return result
},
}
}
Expand Down

0 comments on commit d6a2501

Please sign in to comment.