better distinguished error codes
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Torma Kristóf 2020-12-06 03:18:57 +01:00
parent 84d307a8e6
commit 0ee6390c81

View File

@ -169,7 +169,7 @@ class UserParameterApi(Resource):
user = VideonUser.query.filter_by(name=username).first_or_404()
except Exception as e:
current_app.logger.warning(e)
abort(404, "could not find user")
abort(428, "could not find user")
try:
userobj = self.userschema.load(body)
except Exception as e:
@ -214,7 +214,7 @@ class CreateIngestResource(Resource):
user = VideonUser.query.filter_by(name=username).first_or_404()
except Exception as e:
current_app.logger.warning(e)
abort(404, "could not find user")
abort(428, "could not find user")
ingest.owner_id = user.id
ingest.stream_key = str(uuid4())
try:
@ -266,7 +266,7 @@ class CreateRestreamResource(Resource):
user = VideonUser.query.filter_by(name=username).first_or_404()
except Exception as e:
current_app.logger.warning(e)
abort(404, "could not find user")
abort(428, "could not find user")
restream.owner_id = user.id
restream.stream_key = str(uuid4())
if 'inputNeighbour' in restreamobj:
@ -317,7 +317,7 @@ class CreateEncodeResource(Resource):
user = VideonUser.query.filter_by(name=username).first_or_404()
except Exception as e:
current_app.logger.warning(e)
abort(404, "could not find user")
abort(428, "could not find user")
encoder.owner_id = user.id
encoder.stream_key = str(uuid4())
if 'inputNeighbour' in encoderobj:
@ -369,7 +369,7 @@ class GetAllStreamResources(Resource):
user = VideonUser.query.filter_by(name=username).first_or_404()
except Exception as e:
current_app.logger.warning(e)
abort(404, "could not find user")
abort(428, "could not find user")
try:
streamreousrces = StreamResource.query.filter_by(owner_id=user.id).all()
except Exception as e:
@ -394,7 +394,7 @@ class ManipulateStreamResource(Resource):
user = VideonUser.query.filter_by(name=username).first_or_404()
except Exception as e:
current_app.logger.warning(e)
abort(404, "could not find user")
abort(428, "could not find user")
try:
streamreousrce = StreamResource.query.filter_by(id=UUID(resourceid), owner_id=user.id).first_or_404()
except Exception as e:
@ -415,7 +415,7 @@ class ManipulateStreamResource(Resource):
user = VideonUser.query.filter_by(name=username).first_or_404()
except Exception as e:
current_app.logger.warning(e)
abort(404, "could not find user")
abort(428, "could not find user")
try:
streamreousrce = StreamResource.query.filter_by(id=UUID(resourceid), owner_id=user.id).first_or_404()
except Exception as e:
@ -455,7 +455,7 @@ class ModifyIngressResource(Resource):
user = VideonUser.query.filter_by(name=username).first_or_404()
except Exception as e:
current_app.logger.warning(e)
abort(404, "could not find user")
abort(428, "could not find user")
try:
ingest = StreamResource.query.filter_by(id=resourceid, owner_id=user.id).first_or_404()
except Exception as e:
@ -524,7 +524,7 @@ class ModifyRestreamResource(Resource):
user = VideonUser.query.filter_by(name=username).first_or_404()
except Exception as e:
current_app.logger.warning(e)
abort(404, "could not find user")
abort(428, "could not find user")
try:
restream = StreamResource.query.filter_by(id=resourceid, owner_id=user.id).first_or_404()
except Exception as e:
@ -592,7 +592,7 @@ class ModifyEncodeResource(Resource):
user = VideonUser.query.filter_by(name=username).first_or_404()
except Exception as e:
current_app.logger.warning(e)
abort(404, "could not find user")
abort(428, "could not find user")
try:
encode = StreamResource.query.filter_by(id=resourceid, owner_id=user.id).first_or_404()
except Exception as e:
@ -673,7 +673,7 @@ class CoordModifyResource(Resource):
user = VideonUser.query.filter_by(name=username).first_or_404()
except Exception as e:
current_app.logger.warning(e)
abort(404, "could not find user")
abort(428, "could not find user")
try:
resource = StreamResource.query.filter_by(id=resourceid, owner_id=user.id).first_or_404()
except Exception as e: