From 0ee6390c810b070e5f0e78aff853533faae04652 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torma=20Krist=C3=B3f?= Date: Sun, 6 Dec 2020 03:18:57 +0100 Subject: [PATCH] better distinguished error codes --- src/resources.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/resources.py b/src/resources.py index 1c9d74b..4890fee 100644 --- a/src/resources.py +++ b/src/resources.py @@ -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: