SamilG2 commited on
Commit
4e367b2
路
1 Parent(s): 47e31dd

fix: handle /api probe route and fix error handler path check

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -19,6 +19,7 @@ app.register_blueprint(analyze_bp, url_prefix='/api')
19
  app.register_blueprint(comment_bp, url_prefix='/api')
20
 
21
  @app.route('/')
 
22
  def index():
23
  return {'status': 'ok', 'service': 'CheckScan API', 'docs': '/api/health'}
24
 
@@ -30,13 +31,13 @@ def health():
30
  @app.errorhandler(Exception)
31
  def handle_any_error(err):
32
  """Convierte cualquier excepci贸n en JSON limpio para /api/*."""
33
- if request.path.startswith('/api/'):
34
- traceback.print_exc() # log completo en la consola
35
  return jsonify({
36
  'error': str(err) or err.__class__.__name__,
37
  'type': err.__class__.__name__,
38
  }), 500
39
- raise err # rutas no-API mantienen el debugger HTML
40
 
41
 
42
  if __name__ == '__main__':
 
19
  app.register_blueprint(comment_bp, url_prefix='/api')
20
 
21
  @app.route('/')
22
+ @app.route('/api')
23
  def index():
24
  return {'status': 'ok', 'service': 'CheckScan API', 'docs': '/api/health'}
25
 
 
31
  @app.errorhandler(Exception)
32
  def handle_any_error(err):
33
  """Convierte cualquier excepci贸n en JSON limpio para /api/*."""
34
+ if request.path.startswith('/api'):
35
+ traceback.print_exc()
36
  return jsonify({
37
  'error': str(err) or err.__class__.__name__,
38
  'type': err.__class__.__name__,
39
  }), 500
40
+ raise err
41
 
42
 
43
  if __name__ == '__main__':