Skip to content

Commit ac91ef3

Browse files
committed
Remove general try except
1 parent 50f53ae commit ac91ef3

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

epictrack-api/src/api/resources/project.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,21 +39,18 @@ class Projects(Resource):
3939
@profiletime
4040
def get():
4141
"""Return all projects."""
42-
try:
43-
with_works = request.args.get(
44-
'with_works',
45-
default=False,
46-
type=lambda v: v.lower() == 'true'
47-
)
48-
projects = ProjectService.find_all(with_works)
49-
return_type = request.args.get("return_type", None)
50-
if return_type == "list_type":
51-
schema = res.ListTypeResponseSchema(many=True)
52-
else:
53-
schema = res.ProjectResponseSchema(many=True)
54-
return jsonify(schema.dump(projects)), HTTPStatus.OK
55-
except Exception as e:
56-
return jsonify({"message": str(e)}), HTTPStatus.INTERNAL_SERVER_ERROR
42+
with_works = request.args.get(
43+
'with_works',
44+
default=False,
45+
type=lambda v: v.lower() == 'true'
46+
)
47+
projects = ProjectService.find_all(with_works)
48+
return_type = request.args.get("return_type", None)
49+
if return_type == "list_type":
50+
schema = res.ListTypeResponseSchema(many=True)
51+
else:
52+
schema = res.ProjectResponseSchema(many=True)
53+
return jsonify(schema.dump(projects)), HTTPStatus.OK
5754

5855
@staticmethod
5956
@cors.crossdomain(origin="*")

0 commit comments

Comments
 (0)