Skip to content

Commit 355cf0b

Browse files
committed
fix(web): crash on unsupported derivative build
Fatbuildrweb crashed with HTTP/500 when builds were submitted with a derivative that is not declared in build pipelines, without clear error message sent to client. This is fixed by this commit. In this case, HTTP/404 error is sent with a clear error message that is displayed by fatbuildrctl. fix #149
1 parent 7f03182 commit 355cf0b

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
9393
when authenticating with JWT token on unexisting remote HTTP instance (#137).
9494
- Fix crash with when watching streamed tasks output with HTTP REST API (#138).
9595
- Avoid buffering with HTTP response headers on reverse proxies (#139).
96+
- Fix crash of fatbuildrweb on builds with unsupported derivative (#149).
9697
- docs: Add missing path parameter in REST API to retrieve artifact information.
9798

9899
## [2.0.0] - 2023-05-05

fatbuildr/protocols/http/server/views.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,12 @@ def pipelines_formats(instance):
216216
filter_derivative = request.args.get('derivative')
217217

218218
if filter_derivative:
219-
formats = connection.pipelines_derivative_formats(filter_derivative)
219+
# May raise FatbuildrServerError if derivative is not declared in build
220+
# pipelines. In this case, forward as a 404.
221+
try:
222+
formats = connection.pipelines_derivative_formats(filter_derivative)
223+
except FatbuildrServerError as err:
224+
abort(404, str(err))
220225
else:
221226
formats = connection.pipelines_formats()
222227
for format in formats:

0 commit comments

Comments
 (0)