handleException static method

void handleException(
  1. ProjectCommandError type,
  2. dynamic exception,
  3. String context, {
  4. bool isExit = true,
})

Handles exceptions with contextual error information.

Parameters:

  • type: Error category
  • exception: The caught exception
  • context: Additional context about the operation
  • isExit: Whether to exit the process (default: true)

Implementation

static void handleException(
  ProjectCommandError type,
  dynamic exception,
  String context, {
  bool isExit = true,
}) {
  final errorInfo = _getErrorInfo(type);

  StatusHelper.failed(
    '$context: ${exception.toString()}',
    suggestion: errorInfo['suggestion'],
    examples: errorInfo['examples'],
    isExit: isExit,
  );
}