diff --git a/gitlab/functions.sh b/gitlab/functions.sh
index 6e8dcdefe578b5497710e147b98ec77a04726b90..f0264be55b84d76cf6e669e8edf1f42fd4c6a113 100644
--- a/gitlab/functions.sh
+++ b/gitlab/functions.sh
@@ -171,7 +171,7 @@ doc_upload() {
   else
     log_error "Curl command finished with an error condition (code=${code}):"
     curl --location --silent --user "${DOCUSER}:${DOCPASS}" --upload-file ${1} ${DOCSERVER}/${2}
-    exit ${status}
+    exit ${code}
   fi
 }