Skip to content

Commit

Permalink
fix: error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
F33RNI committed Apr 19, 2024
1 parent 056f53f commit 42ae611
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lmao/external_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def init() -> tuple[Response, Literal]:
return jsonify({}), 200
except Exception as e:
logging.error(f"/init error: {e}")
return jsonify({"error": e}), 500
return jsonify({"error": str(e)}), 500

@self.app.route("/", methods=["POST"])
@self.app.route("/index", methods=["POST"])
Expand Down Expand Up @@ -248,7 +248,7 @@ def status() -> tuple[Response, Literal]:
return jsonify(statuses), 200
except Exception as e:
logging.error(f"/status error: {e}")
return jsonify({"error": e}), 500
return jsonify({"error": str(e)}), 500

@self.app.route("/api/ask", methods=["POST"])
@limit_content_length(3 * 1024 * 1024)
Expand Down Expand Up @@ -342,7 +342,7 @@ def _stream_response():

except Exception as e:
logging.error(f"/ask error: {e}")
return jsonify({"error": e}), 500
return jsonify({"error": str(e)}), 500

@self.app.route("/api/stop", methods=["POST"])
@self.limiter.limit(self.rate_limit_fast)
Expand Down

0 comments on commit 42ae611

Please sign in to comment.