It looks like a export request is successfully made, but I get an error. Might need to introduce delay
This commit is contained in:
parent
c0be5218db
commit
91f4fb3058
19
main.js
19
main.js
|
@ -1,25 +1,10 @@
|
|||
import { normalized_config } from "./normalize-config.js";
|
||||
import { get_run_details, create_plan_export } from "./tfc-api-functions.mjs";
|
||||
import { runidNotProvided, runIdPrefixCheckFail } from "./validate-user-input.mjs";
|
||||
|
||||
const my_config = await normalized_config;
|
||||
|
||||
// TODO: Split all this run verification clutter out into a separate module
|
||||
// verify that a run_id was provided to the program
|
||||
const runid_provided = run_id => {
|
||||
return (run_id ? true : false);
|
||||
}
|
||||
|
||||
// Add negation function for readability (no 'unless' in js)
|
||||
const runidNotProvided = run_id => {
|
||||
return !runid_provided(run_id);
|
||||
}
|
||||
|
||||
// Check for prefix indicating a valid run id
|
||||
const startsWithRun = run_id => {
|
||||
return run_id.startsWith("run-");
|
||||
}
|
||||
|
||||
if(runidNotProvided(my_config.run_id) || !startsWithRun(my_config.run_id)){
|
||||
if(runidNotProvided(my_config.run_id) || runIdPrefixCheckFail(my_config.run_id)){
|
||||
throw new Error("A valid RunID must be provided. Please check that the supplied runID is valid");
|
||||
}
|
||||
|
||||
|
|
19
validate-user-input.mjs
Normal file
19
validate-user-input.mjs
Normal file
|
@ -0,0 +1,19 @@
|
|||
// verify that a run_id was provided to the program
|
||||
const runid_provided = run_id => {
|
||||
return (run_id ? true : false);
|
||||
}
|
||||
|
||||
// Add negation function for readability (no 'unless' in js)
|
||||
export const runidNotProvided = run_id => {
|
||||
return !runid_provided(run_id);
|
||||
}
|
||||
|
||||
// Check for prefix indicating a valid run id
|
||||
const startsWithRun = run_id => {
|
||||
return run_id.startsWith("run-");
|
||||
}
|
||||
|
||||
// Add negation function for readability (no 'unless' in js)
|
||||
export const runIdPrefixCheckFail = run_id => {
|
||||
return !startsWithRun(run_id);
|
||||
}
|
Loading…
Reference in a new issue