diff --git a/TES/tes/apiendpoints.py b/TES/tes/apiendpoints.py
index a4a7959b360ba29ca747b12b930202413638117d..63aca00db98bd6b37caf4a4a3a81f7aea82ebf01 100644
--- a/TES/tes/apiendpoints.py
+++ b/TES/tes/apiendpoints.py
@@ -391,7 +391,9 @@ class JobSubmit(Resource):
             except SshCtrlException as e:
                 #return json.dumps({'message':"We're having difficultly contacting {}. We failed with the message {}".format(params['identity']['site']['host'],e)}), 400
                 #flask_restful.abort(400,message="We're having difficultly contacting {}. We failed with the message {}".format(params['identity']['site']['host'],e))
-                return apiabort(400,message="We're having difficultly contacting {}. We failed with the message {}".format(params['identity']['site']['host'],e))
+                return apiabort(400, message="We're having difficultly contacting {}. We failed with the message {}".format(params['identity']['site']['host'],e))
+            except SshExecException as e:
+                return apiabort(400, message="{}".format(e))
             if not (res['stderr'] == '' or res['stderr'] is None or res['stderr'] == b''):
                 #return json.dumps({'message':res['stderr'].decode()}), 400
                 #flask_restful.abort(400, message=res['stderr'].decode())