michaeljabbour / michaeljabbour/altairbasic

Improve Error Handling and Reporting

Open
#3 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

# Improve Error Handling and Reporting

## Issue Description
The current error handling in the interpreter is basic and sometimes unhelpful. When errors occur during parsing or execution, the messages can be cryptic or lack sufficient context for debugging.

## Current Limitations
1. Error messages don't always include the line number where the error occurred
2. Some runtime errors result in generic exceptions
3. Syntax errors may not clearly indicate what was expected
4. The interpreter sometimes crashes on certain errors instead of gracefully handling them

## Expected Behavior
- Clear error messages with line and column information
- Specific error types for different categories of errors
- Suggestions for how to fix common errors
- Recovery from errors in interactive mode without crashing

## Technical Details
The error handling system should be enhanced to:
1. Maintain more context during parsing/execution
2. Use specific exception types for different error categories
3. Format error messages with more information
4. Handle errors properly in interactive mode

## Proposed Solution
1. Create a structured Error class with different types and severity levels
2. Enhance the parser to provide better context in error messages
3. Improve the interpreter's exception handling
4. Add recovery mechanisms for interactive mode errors
5. Consider adding a debug mode with more verbose error information

## Related Components
- src/core/parser.cpp - Parsing errors
- src/core/interpreter.cpp - Runtime errors
- src/main.cpp - Error reporting to the user

## Priority
Medium - This improves user experience but doesn't block core functionality

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading src/core/parser.cpp, src/core/interpreter.cpp, and src/main.cpp to trace how parsing, runtime, and interactive-mode errors currently flow. Compare the existing behavior with the requested structured errors, contextual messages, and recovery requirements. Done should include the relevant error categories, line and column context, improved reporting, and graceful interactive-mode handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.