-
Notifications
You must be signed in to change notification settings - Fork 3
[Refactor]: Better error messages and experience #159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Implement error reporter module with PostHog client - Configure for short-running CLI tools (immediate flush, no batching) - Integrate error reporting in bin/run.js with proper shutdown - Add environment variable configuration (POSTHOG_API_KEY, POSTHOG_HOST) - Include error context (command, Node version, platform) - Add unit tests for error reporter - Graceful degradation when PostHog is not configured Resolves #55 Co-authored-by: Kfir Stri <kfirstri@users.noreply.github.com>
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/cli@0.0.25-pr.159.7480a31Prefer not to change any import paths? Install using npm alias so your code still imports npm i "base44@npm:@base44-preview/cli@0.0.25-pr.159.7480a31"Or add it to your {
"dependencies": {
"base44": "npm:@base44-preview/cli@0.0.25-pr.159.7480a31"
}
}
Preview published to npm registry — try new features instantly! |
f2e9cd8 to
9a8c9ae
Compare
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
|
This PR Still doesn't add better errors for API client, we will add it after #135 is merged, then we can throw the nicer errors |
Description
This PR introduces a comprehensive error handling system that replaces generic error throws with a structured error hierarchy. The new system distinguishes between user-fixable errors (
UserError) and system errors (SystemError), provides actionable hints with optional commands for AI agents, and improves telemetry tracking with error codes and classification. This refactor enhances developer experience by making errors clearer and more actionable across the entire codebase.Related Issue
None
Type of Change
Changes Made
CLIErrorbase class with two main branches:UserError(user-fixable issues like auth/config problems) andSystemError(system issues like API/file failures)AuthRequiredError,AuthExpiredError,ConfigNotFoundError,ConfigInvalidError,ConfigExistsError,SchemaValidationError,InvalidInputError,ApiError,FileNotFoundError,FileReadError,InternalError{ message: "Run 'base44 login'", command: "base44 login" }) to guide users and AI agentsSchemaValidationErrorautomatically formats validation errors usingz.prettifyError()for better readabilityerror_codeandis_user_errorproperties in PostHog for better analytics and debugging (src/cli/telemetry/error-reporter.ts:366-377)throw new Error()isCLIError(),isUserError(), andisSystemError()type guards for error handlingAuthApiErrorandAuthValidationErrorwith new structured errorsTesting
npm test)Checklist
Additional Notes
This refactor significantly improves the developer experience by providing clear, actionable feedback when errors occur. The distinction between
UserErrorandSystemErrorhelps with debugging, prioritizing fixes, and providing better user guidance. The structured hints system is particularly valuable for AI agents that can now automatically suggest and execute recovery commands. All error messages now follow consistent patterns and include helpful context for resolution.Key architectural improvements:
🤖 Generated by Claude | 2026-01-31 09:54 UTC