Tweaks and error handling
All checks were successful
/ Upload and download test (push) Successful in 24s

This commit is contained in:
Kodi Craft 2024-06-15 11:57:26 +02:00
parent c084c40288
commit be8432c7dd
Signed by: kodi
GPG Key ID: 69D9EED60B242822
2 changed files with 8 additions and 2 deletions

View File

@ -7,7 +7,7 @@ on:
jobs: jobs:
test-action: test-action:
runs-on: nix runs-on: nix
name: Tests that the action works as expected name: Upload and download test
steps: steps:
- name: Create sample file - name: Create sample file
run: echo "Hello, world!" > test.txt run: echo "Hello, world!" > test.txt

View File

@ -42,7 +42,13 @@ try {
'x-salt-name': use_salt ? 'true' : 'false', 'x-salt-name': use_salt ? 'true' : 'false',
'authorization': `Bearer ${token}` 'authorization': `Bearer ${token}`
} }
}).then(response => { return response.text() }) }).then(response => {
if (!response.ok) {
console.log("Got response: ", response)
throw new Error(`HTTP error! status: ${response.status}`);
}
return response.text()
})
.then(uri => { .then(uri => {
console.log("Uploaded to: ", uri) console.log("Uploaded to: ", uri)
core.setOutput('uri', uri) core.setOutput('uri', uri)