1.0.0 • Published 2 months ago
error-solver-ai v1.0.0
Error Solver AI
Error Solver AI is an intelligent error handling package that leverages Google's Gemini API to automatically analyze and provide solutions for JavaScript/TypeScript errors in real-time. It transforms cryptic error messages into clear, actionable solutions with optional visual feedback.
Key Features
🤖 AI-Powered Error Analysis
- Utilizes Google's advanced Gemini AI to analyze error stack traces
- Provides human-readable explanations of complex errors
- Suggests practical solutions with example code snippets
- Offers context-aware debugging recommendations
🎯 Smart Toast Notifications
- Fully configurable toast messages for instant feedback
- Customizable styling and positioning
- Adjustable display duration
- Responsive design that works across all screen sizes
💪 Developer-Friendly
- Written in TypeScript with full type definitions
- Zero configuration required to get started
- Extensive customization options
- Comprehensive error handling
🔧 Flexible Integration
- Works in both browser and Node.js environments
- Simple promise-based API
- Minimal dependencies
- Easy to integrate with existing error handling
Installation
npm install error-solver-ai
Quick Start
import { ErrorSolver } from 'error-solver-ai';
// Initialize with your Gemini API key
const errorSolver = new ErrorSolver({
apiKey: 'your-gemini-api-key',
showToast: true
});
// Use in try-catch blocks
try {
// Your code here
} catch (error) {
const solution = await errorSolver.solve(error);
console.log(solution.possibleSolution);
}
Advanced Configuration
const errorSolver = new ErrorSolver({
apiKey: 'your-gemini-api-key',
showToast: true,
toastConfig: {
duration: 5000,
position: 'top-right',
style: {
backgroundColor: '#2196F3',
textColor: '#ffffff',
fontSize: '16px'
}
}
});
Features in Detail
Error Analysis
The package provides structured error solutions containing:
- Clear error message explanation
- Step-by-step solution guide
- Relevant code examples when applicable
- Context-specific debugging tips
Toast Customization
Configure toast notifications with:
- 6 different positioning options
- Custom colors and styling
- Flexible timing controls
- Responsive design adaptation
Type Safety
- Full TypeScript support
- Comprehensive type definitions
- Strict type checking
- IntelliSense support in modern IDEs
Use Cases
- Development Debugging: Get instant solutions during development
- Production Error Monitoring: Analyze and understand production errors
- Learning Tool: Help junior developers understand and fix errors
- Error Documentation: Build a knowledge base of common errors and solutions
Benefits
- Time Savings: Reduce debugging time with instant AI-powered solutions
- Learning Opportunity: Understand errors better with clear explanations
- Code Quality: Implement better solutions with AI-suggested fixes
- Developer Experience: Enhance development workflow with visual feedback
- Error Prevention: Learn from past errors to prevent future occurrences
Technical Details
- Built with TypeScript
- Uses Google's Gemini API
- Supports modern JavaScript environments
- Minimal external dependencies
- Regular updates and maintenance
Requirements
- Node.js 14.x or higher
- Google Gemini API key
- TypeScript 4.x or higher (for TypeScript users)
Best Practices
- Always initialize with a valid API key
- Handle potential network errors when calling
solve()
- Consider rate limits of the Gemini API
- Use type definitions for better code safety
- Customize toast notifications for your use case
Support
- GitHub Issues for bug reports and feature requests
- Comprehensive documentation
- Regular updates and maintenance
- Active community support
This package is ideal for developers who want to streamline their debugging process and get intelligent, context-aware solutions to their coding errors. Whether you're a solo developer or part of a large team, Error Solver AI can significantly improve your error handling workflow.
1.0.0
2 months ago