Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/InsightAppSecClient.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const axios = require("axios");

const APPLICATION_JSON = "application/json";
const USER_AGENT_HEADER = "r7:insightappsec-github-actions/1.3.0";
const USER_AGENT_HEADER = "r7:insightappsec-github-actions/1.3.1";

class InsightAppSecClient {

Expand Down
26 changes: 24 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,32 @@ async function performAction() {
}
}
catch(e) {
core.error(`An error occurred with the scan: ${e}`);
printErrorMessage(e);
}
}

performAction().catch( (error) => {
core.error(`An error occurred during the action ${error}`);
});
});

function printErrorMessage(error){

let messagePrinted = false;

if(error.response && error.response.data) {

if(error.response.data.message) {
messagePrinted = true;

if(error.response.data.status) {
core.error(`An error occurred with the scan: ${error}. Status: ` + `${error.response.data.status} ` + `${error.response.data.message}`);
} else {
core.error(`An error occurred with the scan: ${error}. ` + `${error.response.data.message}`);
}
}
}

if(!messagePrinted) {
core.error(`An error occurred with the scan: ${error}. `);
}
}
7 changes: 6 additions & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@
"sourceUrl": "https://github.com/rapid7/insightappsec-scan-github-actions",
"licenseUrl": "https://github.com/rapid7/insightappsec-scan-github-actions/blob/master/LICENSE.txt"
},
"version": "1.3.0",
"version": "1.3.1",
"versionHistory": [
{
"version": "1.3.1",
"date": "",
"changes": "Improvement to error messages to allow user debugging."
},
{
"version": "1.3.0",
"date": "",
Expand Down