Skip to content

refactor: Standardize error messages #29

@greynewell

Description

@greynewell

Problem

Error messages throughout the codebase are inconsistent. Some are user-friendly, others expose internal details that users don't need to see.

Examples

Good - User-friendly:

return asErrorResult('Directory argument is required and must be a string path');

Inconsistent - Internal details:

return asErrorResult(\`API call failed: \${error.message || String(error)}. Check server logs for details.\`);

Proposed Standards

  1. User-facing errors should:

    • Be actionable (tell user what to fix)
    • Not expose internal stack traces
    • Use consistent format
  2. Internal errors should:

    • Log full details to console
    • Return simplified message to user
    • Include error codes for debugging

Example Pattern

try {
  // operation
} catch (error) {
  console.error('[ERROR] Internal details:', error);
  return asErrorResult('Failed to process request. Please check your inputs.');
}

Files Affected

  • src/tools/create-supermodel-graph.ts
  • Query handlers in src/queries/
  • Utility functions in src/utils/

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions