diff --git a/lib/testrail.js b/lib/testrail.js index e26c11a..4096ff6 100644 --- a/lib/testrail.js +++ b/lib/testrail.js @@ -53,6 +53,7 @@ class TestRail { } catch (error) { const parsedError = error && error.response && error.response.data ? error.response.data.error : error; output.error(`getCases: ERROR - cannot get results for projectId:${projectId} due to ${parsedError}`); + throw Error(parsedError); } } @@ -66,6 +67,7 @@ class TestRail { const parsedError = error && error.response && error.response.data ? error.response.data.error : error; output.error(`addPlan: ERROR - cannot add plan to projectId:${projectId} due to ${parsedError}`); output.error(`addPlan: ERROR - request data was ${JSON.stringify(data)}`); + throw Error(parsedError); } } @@ -79,6 +81,7 @@ class TestRail { const parsedError = error && error.response && error.response.data ? error.response.data.error : error; output.error(`addPlanEntry: ERROR - cannot add plan entry to planId:${planId} due to ${parsedError}`); output.error(`addPlanEntry: ERROR - request data was ${JSON.stringify(data)}`); + throw Error(parsedError); } } @@ -90,6 +93,7 @@ class TestRail { } catch (error) { const parsedError = error && error.response && error.response.data ? error.response.data.error : error; output.error(`getSuites: ERROR - cannot get suites for projectId:${projectId} due to ${parsedError}`); + throw Error(parsedError); } } @@ -101,6 +105,7 @@ class TestRail { } catch (error) { const parsedError = error && error.response && error.response.data ? error.response.data.error : error; output.error(`getConfigs: ERROR - cannot get configs for projectId:${projectId} due to ${parsedError}`); + throw Error(parsedError); } } @@ -114,6 +119,7 @@ class TestRail { const parsedError = error && error.response && error.response.data ? error.response.data.error : error; output.error(`addRun: ERROR - cannot add run to projectId:${projectId} due to ${parsedError}`); output.error(`addRun: ERROR - request data was ${JSON.stringify(data)}`); + throw Error(parsedError); } } @@ -127,6 +133,7 @@ class TestRail { const parsedError = error && error.response && error.response.data ? error.response.data.error : error; output.error(`updateRun: ERROR - cannot update run for runId:${runId} due to ${parsedError}`); output.error(`updateRun: ERROR - request data was ${JSON.stringify(data)}`); + throw Error(parsedError); } } @@ -139,6 +146,7 @@ class TestRail { } catch (error) { const parsedError = error && error.response && error.response.data ? error.response.data.error : error; output.error(`updateRun: ERROR - cannot get run for runId:${runId} due to ${parsedError}`); + throw Error(parsedError); } } @@ -149,6 +157,7 @@ class TestRail { }).catch(error => { const parsedError = error && error.response && error.response.data ? error.response.data.error : error; output.error(`getResultsForCase: ERROR - cannot get results for caseId:${caseId} on runId:${runId} due to ${parsedError}`); + throw Error(parsedError); }); } @@ -161,6 +170,7 @@ class TestRail { const parsedError = error && error.response && error.response.data ? error.response.data.error : error; output.error(`addResultsForCases: ERROR - cannot add result for case due to ${parsedError}`); output.error(`addResultsForCases: ERROR - request data was ${JSON.stringify(data)}`); + throw Error(parsedError); }); } @@ -177,6 +187,7 @@ class TestRail { const parsedError = error && error.response && error.response.data ? error.response.data.error : error; output.error(`addAttachmentToResult: ERROR - cannot add attachment due to ${parsedError}`); output.error(`addAttachmentToResult: ERROR - request data was ${JSON.stringify(form)}`); + throw Error(parsedError); }); } @@ -187,6 +198,7 @@ class TestRail { }).catch(error => { const parsedError = error && error.response && error.response.data ? error.response.data.error : error; output.error(`close run ${runId}: ERROR - cannot close run due to ${parsedError}`); + throw Error(parsedError); }); } }