Skip to content

Commit 1865d24

Browse files
fix(release): do not throw 500 when release is not found. (#605)
* Throw error if release not found for project Adds a check to throw a UserInputError when the specified release does not exist for the given project, improving error handling and feedback for invalid release queries. * Bump version up to 1.2.31 * Update project.js --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
1 parent b60c51b commit 1865d24

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hawk.api",
3-
"version": "1.2.30",
3+
"version": "1.2.31",
44
"main": "index.ts",
55
"license": "BUSL-1.1",
66
"scripts": {

src/resolvers/project.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,10 @@ module.exports = {
575575
const releasesFactory = factories.releasesFactory;
576576
const releaseDoc = await releasesFactory.findByProjectAndRelease(project._id, release);
577577

578+
if (!releaseDoc) {
579+
throw new UserInputError(`Release "${release}" not found for project (id: ${project._id})`);
580+
}
581+
578582
let enrichedFiles = Array.isArray(releaseDoc.files) ? releaseDoc.files : [];
579583

580584
// If there are files to enrich, try to get their metadata

0 commit comments

Comments
 (0)