mirror of
https://github.com/peter-evans/dockerhub-description.git
synced 2024-11-25 13:39:33 +01:00
Merge pull request #23 from peter-evans/fix-error-handling
fix: throw errors on request failure
This commit is contained in:
commit
1d0dd5623c
2 changed files with 8 additions and 0 deletions
4
dist/index.js
vendored
4
dist/index.js
vendored
|
@ -72,6 +72,10 @@ function updateRepositoryDescription(token, repository, description, fullDescrip
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
Authorization: `JWT ${token}`
|
Authorization: `JWT ${token}`
|
||||||
}
|
}
|
||||||
|
}).then(res => {
|
||||||
|
if (!res.ok) {
|
||||||
|
throw new Error(res.statusText);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,5 +40,9 @@ export async function updateRepositoryDescription(
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
Authorization: `JWT ${token}`
|
Authorization: `JWT ${token}`
|
||||||
}
|
}
|
||||||
|
}).then(res => {
|
||||||
|
if (!res.ok) {
|
||||||
|
throw new Error(res.statusText)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue