Skip to content

feat: improve error messages with more context #22

@EmperorOrokuSaki

Description

@EmperorOrokuSaki

Issue

Several error messages throughout the codebase lack sufficient context to help users understand what went wrong and how to fix it.

Current State

Examples of generic error messages:

  • "no valid entry block found" - doesn't explain why
  • InvalidJumpTarget(usize) - only shows PC without context
  • Generic parsing errors without position information

Proposed Solution

Enhance error messages with:

  • More descriptive explanations
  • Context about what was expected vs what was found
  • Suggestions for resolution where applicable
  • Position information for parsing errors

Examples:

"No valid entry block found: instruction sequence may be empty or contains only terminal instructions"
"Invalid jump target 0x{:x}: target must point to a JUMPDEST instruction within bounds [0x0, 0x{:x}]"

Benefits

  • Better user experience
  • Easier debugging
  • More helpful error reporting
  • Reduced support overhead
  • Self-documenting error conditions

Files to Modify

  • crates/core/src/cfg_ir.rs
  • crates/transforms/src/util.rs
  • crates/core/src/decoder.rs

Priority

Medium - User experience improvement

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions