Skip to content

Commit

Permalink
chore: added errors
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlementlegen committed Sep 23, 2024
1 parent 9e57d63 commit 481c1dc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/helpers/validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export function validateAndDecodeSchemas(rawEnv: object, rawSettings: object) {
const decodedEnv = Value.Decode(envSchema, rawEnv || {});
return { decodedEnv, decodedSettings };
} catch (e) {
console.error("validateAndDecodeSchemas", e);
if (e instanceof TransformDecodeCheckError || e instanceof TransformDecodeError) {
throw { errors: [e.error] };
}
Expand Down
10 changes: 5 additions & 5 deletions src/validate-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ main()
console.log("Configuration validated.");
return payload;
})
.catch((e) => {
console.error("Failed to validate configuration", e);
core.setFailed(e.errors);
return e;
.catch(({ errors }) => {
console.error("Failed to validate configuration", errors);
core.setFailed(errors);
return errors;
})
.then(async (errors) => {
console.log("returning data to kernel!", errors);
console.log("returning data to kernel! payload is", errors);
const payload = github.context.payload.inputs;
await returnDataToKernel(process.env.GITHUB_TOKEN, payload.stateId, errors, "configuration_validation");
})
Expand Down

0 comments on commit 481c1dc

Please sign in to comment.