From d1832e44ce1b10aeb5b9dc902b7d35ab51c41ff3 Mon Sep 17 00:00:00 2001 From: Jacob Nguyen <76754747+jacoobes@users.noreply.github.com> Date: Wed, 7 Feb 2024 22:04:05 -0600 Subject: [PATCH] fix: better error messages for publish --- src/create-publish.mts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/create-publish.mts b/src/create-publish.mts index 0a0fb0a..fbb62e5 100644 --- a/src/create-publish.mts +++ b/src/create-publish.mts @@ -196,7 +196,10 @@ if (res.ok) { console.error("Status Text ", res.statusText); switch(res.status) { case 400 : { - console.error('errors:', inspect(await res.json(), { depth: Infinity })); + const validation_errors = await res.json() + console.error('errors:', inspect(validation_errors, { depth: Infinity })); + console.error("Modules with validation errors:" + + inspect(Object.keys(validation_errors.errors).map(idx => globalCommands[idx as any]))) throw Error("400: Ensure your commands have proper fields and data with nothing left out"); } case 404 : { @@ -252,6 +255,9 @@ for (const [guildId, array] of guildCommandMap.entries()) { switch(response.status) { case 400 : { console.error(inspect(result, { depth: Infinity })) + console.error("Modules with validation errors:" + + inspect(Object.keys(result.errors).map(idx => array[idx as any]))) + throw Error("400: Ensure your commands have proper fields and data and nothing left out"); } case 404 : {