From aff8b23be8fd24077a9725d1d3eb643cf47765b7 Mon Sep 17 00:00:00 2001 From: Anand Chowdhary Date: Sat, 29 Aug 2020 06:36:49 +0530 Subject: [PATCH] Add support for failing check on HTTP error responses (#23) --- src/main.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main.ts b/src/main.ts index aa8fd55c..21f59776 100644 --- a/src/main.ts +++ b/src/main.ts @@ -23,6 +23,9 @@ async function run() { .then((res) => { // output the status core.setOutput('statusCode', res.status); + // throw error on error status codes + if (res.status >= 400) + throw new Error(`Failing with code: ${res.status}`) // report on the status code core.info(`Received status code: ${res.status}`); // debug end