diff --git a/lib/docassemble/docassemble_api_interface.js b/lib/docassemble/docassemble_api_interface.js index 250456e7..8ed7b35e 100644 --- a/lib/docassemble/docassemble_api_interface.js +++ b/lib/docassemble/docassemble_api_interface.js @@ -116,7 +116,7 @@ da_i.throw_an_error_if_server_is_not_responding = async function ( options ) { }); } - throw error; + throw error.toJSON(); } }; // Ends da_i.throw_an_error_if_server_is_not_responding() @@ -186,7 +186,7 @@ da_i.validate_api_key = async function ( api_key_options ) { + `organization's secrets.` }); } // ends 403 message - throw error; + throw error.toJSON(); } // ends try to get dev_id }; // Ends da_i.validate_api_key() @@ -267,7 +267,7 @@ da_i.loop_to_create_project = async function( creation_options ) { // A non-timeout, non-server error should just be thrown } else { log.error({ pre: `Ran into unexpected error when trying to create the Project.` }); - throw error; + throw error.toJSON(); } // ends type of non-response error } // ends type of response error @@ -305,7 +305,7 @@ da_i.pull = async function ( pull_options ) { // Pulling should not error log.error({ pre: `Pulling into the docassemble Project ran into an unexpected error.` }); log.debug({ pre: `See https://docassemble.org/docs/api.html#playground_pull.` }); - throw error; + throw error.toJSON(); } }; // Ends da_i.pull() @@ -435,15 +435,12 @@ da_i.delete_project = async function ( delete_options ) { log.info({ pre: `Trying to delete Project ${ project_name }` }); try { - let response = await _da_REST.delete_project( timeout ); log.info({ pre: `Deleted Project "${ project_name }"` }); - } catch ( error ) { - // Status 400 log.error({ pre: `Ran into an error when deleting Project "${ project_name }"` }); log.debug({ pre: `See https://docassemble.org/docs/api.html#playground_delete_project.` }); - throw error; + throw error.toJSON(); } }; // Ends da_i.delete_project()