From fc0e9fde506a91019d85b5488ac15783602a7057 Mon Sep 17 00:00:00 2001 From: ibrahim0814 Date: Thu, 5 Dec 2019 13:46:50 -0800 Subject: [PATCH] add catch block --- dist/index.js | 18 +++++++++++++----- index.js | 18 +++++++++++++----- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/dist/index.js b/dist/index.js index f5d1c54..2c1bc5f 100644 --- a/dist/index.js +++ b/dist/index.js @@ -331,10 +331,12 @@ try { "-Z" ], options - ) + ).catch((err)=>{ + core.setFailed(`Action failed with error ${err}`); + }) .then(() => { unlinkFile(); - }); + }) } else { exec .exec( @@ -351,7 +353,9 @@ try { `${yml}` ], options - ) + ).catch((err)=>{ + core.setFailed(`Action failed with error ${err}`); + }) .then(() => { unlinkFile(); }); @@ -372,7 +376,9 @@ try { "-Z" ], options - ) + ).catch((err)=>{ + core.setFailed(`Action failed with error ${err}`); + }) .then(() => { unlinkFile(); }); @@ -382,7 +388,9 @@ try { "bash", ["codecov.sh", "-n", `${name}`, "-F", `${flags}`, "-y", `${yml}`], options - ) + ).catch((err)=>{ + core.setFailed(`Action failed with error ${err}`); + }) .then(() => { unlinkFile(); }); diff --git a/index.js b/index.js index 49ca5e0..b4deac4 100644 --- a/index.js +++ b/index.js @@ -68,10 +68,12 @@ try { "-Z" ], options - ) + ).catch((err)=>{ + core.setFailed(`Action failed with error ${err}`); + }) .then(() => { unlinkFile(); - }); + }) } else { exec .exec( @@ -88,7 +90,9 @@ try { `${yml}` ], options - ) + ).catch((err)=>{ + core.setFailed(`Action failed with error ${err}`); + }) .then(() => { unlinkFile(); }); @@ -109,7 +113,9 @@ try { "-Z" ], options - ) + ).catch((err)=>{ + core.setFailed(`Action failed with error ${err}`); + }) .then(() => { unlinkFile(); }); @@ -119,7 +125,9 @@ try { "bash", ["codecov.sh", "-n", `${name}`, "-F", `${flags}`, "-y", `${yml}`], options - ) + ).catch((err)=>{ + core.setFailed(`Action failed with error ${err}`); + }) .then(() => { unlinkFile(); });