Skip to content

Commit

Permalink
Error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
aldoyh committed Jul 18, 2023
1 parent bd93038 commit 08f8b5f
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,30 @@ const exec = (cmd, args = [], options = {}) => new Promise((resolve, reject) =>
Object.assign(optionsToCLI, {stdio: ['inherit', 'inherit', 'inherit']});
}
const app = spawn(cmd, args, optionsToCLI);
app.on('close', (code) => {
app.on('close', code => {
if (code !== 0) {
const err = new Error(`Invalid status code: ${code}`);
err.code = code;
return reject(err);
reject(new Error(`Command "${cmd} ${args.join(' ')}" exited with code ${code}`));
return;
}
return resolve(code);
});
app.on('error', reject);
resolve();
}
);

app.on('error', error => {
reject(error);
}
);

app.on('exit', code => {
if (code !== 0) {
reject(new Error(`Command "${cmd} ${args.join(' ')}" exited with code ${code}`));
return;
}
resolve();
}
);


});

module.exports = exec;
Expand Down Expand Up @@ -6135,7 +6150,7 @@ const Humanize = __nccwpck_require__(667);
const fs = __nccwpck_require__(7147);
const exec = __nccwpck_require__(4841);

const TODOIST_API_KEY = core.getInput("TODOIST_API_KEY");
const TODOIST_API_KEY = core.getInput("TODOIST_API_KEY") || process.env.TODOIST_API_KEY;
const PREMIUM = core.getInput("PREMIUM");

async function main() {
Expand Down Expand Up @@ -6205,7 +6220,7 @@ async function updateReadme(data) {
}
}

// console.log(todoist.length);
console.log(todoist.length);

const buildReadme = (prevReadmeContent, newReadmeContent) => {
const tagToLookFor = "<!-- TODO-IST:";
Expand Down

0 comments on commit 08f8b5f

Please sign in to comment.