Commit 5b20727b authored by Jerome Touvier's avatar Jerome Touvier
Browse files

fix error message

parent d2559da1
......@@ -15,6 +15,7 @@ build:
IMAGE_NAME: $CI_REGISTRY_IMAGE/ws-timeseries:$CI_COMMIT_SHORT_SHA
script:
- $REGISTRY_LOGIN $CI_REGISTRY
- echo $CI_COMMIT_SHORT_SHA > ./static/commit.txt
- $IMAGE_BUILD --file $DOCKERFILE $BUILD_ARG --tag $IMAGE_NAME .
- $IMAGE_PUSH $IMAGE_NAME $IMAGE_NAME
- $REGISTRY_LOGOUT $CI_REGISTRY
......
......@@ -155,13 +155,14 @@ def error_request(msg="", details="", code=500):
message_error = f"""Error {code}: {msg}\n
{details}\n
Request:
{request.url}\n
{request.full_path}\n
Request Submitted:
{request_date}\n
Service version:
version:{VERSION}"""
return Response(message_error, status=code, mimetype="text/plain")
# No data response alias
def error_nodata(params, dmesg=Error.NODATA):
code = int(params["nodata"])
......
......@@ -43,6 +43,18 @@ def version():
return response
@app.route("/commit", strict_slashes=False)
def commit():
try:
with open("./static/commit.txt") as commit_file:
COMMIT_SHORT_SHA = commit_file.readline()
except Exception:
COMMIT_SHORT_SHA = "unspecified"
response = make_response(COMMIT_SHORT_SHA)
response.headers["Content-Type"] = "text/plain"
return response
@app.route("/")
@app.route("/local=fr")
def doc():
......
......@@ -43,6 +43,18 @@ def version():
return response
@app.route("/commit", strict_slashes=False)
def commit():
try:
with open("./static/commit.txt") as commit_file:
COMMIT_SHORT_SHA = commit_file.readline()
except Exception:
COMMIT_SHORT_SHA = "unspecified"
response = make_response(COMMIT_SHORT_SHA)
response.headers["Content-Type"] = "text/plain"
return response
@app.route("/")
@app.route("/local=fr")
def doc():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment