fix(aipass): surface module errors instead of masking as 'Unknown command'
route_command swallowed any handle_command exception and let main() print a misleading 'Unknown command', hiding real failures (e.g. the Windows aipass-init error the e2e harness hit). It now also prints the failing module + traceback to stderr. Bool contract unchanged; 24/24 aipass unit tests pass. This makes the masked Windows init failure diagnosable. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
f3b3ebad9b
commit
89fa2c1db2
@@ -17,6 +17,7 @@ Auto-discovery architecture:
|
||||
|
||||
import sys
|
||||
import importlib
|
||||
import traceback
|
||||
from pathlib import Path
|
||||
from typing import List, Any
|
||||
|
||||
@@ -59,7 +60,12 @@ def route_command(command: str, args: List[str], modules: List[Any]) -> bool:
|
||||
if module.handle_command(command, args):
|
||||
return True
|
||||
except Exception as e:
|
||||
# A module that owns this command but fails must not be masked as
|
||||
# "Unknown command" — surface the real error (and traceback) to
|
||||
# stderr so failures are diagnosable instead of silently swallowed.
|
||||
logger.error(f"[AIPASS] Module {module.__name__} error: {e}")
|
||||
print(f"[AIPASS] {module.__name__.split('.')[-1]} failed: {e}", file=sys.stderr)
|
||||
traceback.print_exc(file=sys.stderr)
|
||||
return False
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user