Skip to content

Structured Error Types #10

Description

@nloding

Problem

Error handling could be improved:

  • Error::Decode uses generic String messages
  • No specific errors for: corrupted move bytes, index corruption, namebase corruption, buffer overflow
  • Some unwrap() and panic! calls in encoding that could be handled gracefully

Solution

  1. Add specific error variants for different failure modes
  2. Replace panics with proper error handling
  3. Include context in errors (e.g., game number, byte offset)

Potential Panics to Address

  • game.rs:200 - unwrap() on start_board
  • mov.rs:82,84,108,110 - assert! calls in encode functions
  • mov.rs:217,226 - panic! for invalid pawn moves

File

src/error.rs

Priority

High - improves reliability and debugging

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions