basic error handling skeleton is up

This commit is contained in:
worm 2023-01-02 15:26:52 -08:00
parent 1d8db59738
commit c0be5218db
2 changed files with 13 additions and 1 deletions

View file

@ -27,5 +27,9 @@ if(runidNotProvided(my_config.run_id) || !startsWithRun(my_config.run_id)){
const run_details = await get_run_details(my_config.base_url, process.argv.slice(2), my_config.token); const run_details = await get_run_details(my_config.base_url, process.argv.slice(2), my_config.token);
const plan_id = run_details.data.data.relationships.plan.data.id; const plan_id = run_details.data.data.relationships.plan.data.id;
console.log(`The plan ID is ${plan_id}`);
console.log(await create_plan_export(my_config.base_url, plan_id, my_config.token)); const export_response = await create_plan_export(my_config.base_url, plan_id, my_config.token);
const plan_export_id = export_response.data.data.id;
console.log(`The plan export ID is ${plan_export_id}`);

View file

@ -55,3 +55,11 @@ const config = {
config config
) )
} }
// This will check the API response for an error.
// If one is detected, it will display the code and detail, then throw a node error.
export const check_for_error = (response_object, api_call_type) => {
if(response_object.data.errors) {
}
}