Skip to content

Conversation

@arshia-eskandari
Copy link
Owner

@arshia-eskandari arshia-eskandari commented Jun 5, 2025

🚀 Add Enhanced Error Reporting, Hook Example, and Code Refactors

Summary:

This PR introduces several improvements to developer experience, error clarity, and code maintainability in OxiMod.

✨ Features Added:

  • Enhanced Error Output with Suggestions and Backtraces

    • Errors now print:
      • A colored and bolded "Backtrace" section
      • A colored and bolded "Suggestion" section (if applicable)
    • Helps identify the source of validation or runtime issues more quickly
    • Activated via:
      RUST_BACKTRACE=full cargo run --example your_example
  • New hook_usage Example

    • Demonstrates how to define custom behavior in an impl block
    • Log model shows how a pre-save action can be combined with save().await?
    • Encourages adding domain-specific pre-processing logic using idiomatic Rust

🧪 Examples Updated:

  • Added: examples/hook_usage.rs
    • Prints log messages before saving and demonstrates hook-style usage

📚 Docs:

  • Updated README.md:
    • Added section about enabling backtraces using RUST_BACKTRACE
    • Listed hook_usage in the runnable examples
    • Clarified validation feedback and error formatting

🛠️ Refactored Code:

  • Refactored validate, index, and default code
  • Improved modularity and reuse of formatting helpers

Closes #10

@arshia-eskandari arshia-eskandari merged commit 73a5e33 into main Jun 5, 2025
1 check passed
@arshia-eskandari arshia-eskandari deleted the refactor/10/cleanup-and-optimization branch June 5, 2025 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor: Streamline and Clean Up Codebase

2 participants