Slime-Dev / SlimeProject

SlimeEngine is my personal playground for learning modern Vulkan and its 1.3 features. This project serves as both a learning tool and a growing graphics framework, focusing on clean, understandable implementation of advanced Vulkan concepts. It's a work in progress, evolving as I explore and understand more about low-level graphics programming.
3 stars 0 forks source link

Implement SLIME_RESULT #43

Closed ConnorY97 closed 3 months ago

ConnorY97 commented 4 months ago

Implement SLIME_RESULT Error Handling System

Objective

Implement a consistent error handling system using SLIME_RESULT throughout the engine to improve error reporting, debugging, and overall code robustness.

Description

We need to replace the current error handling system with a new SLIME_RESULT enum-based approach. This will provide more detailed error information and allow for consistent error handling across the entire codebase.

Tasks

  1. Update slime_common.h:

    • Define the SLIME_RESULT enum with appropriate error codes.
    • Add include guards or #pragma once to prevent redefinition errors.
  2. Create SlimeErrorUtils.h:

    • Implement the errcheck function template for standardized error checking and logging.
    • Ensure the function is marked as inline to prevent multiple definition errors.
  3. Update existing functions:

    • Modify function signatures to return SLIME_RESULT instead of bool/void where appropriate.
    • Replace error-prone patterns (e.g., returning nullptr) with SLIME_RESULT.
    • Update function bodies to use the new SLIME_RESULT system.
  4. Update ModelManager:

    • Modify LoadModel to return SLIME_RESULT and use an out parameter for the model resource.
  5. Update Resource Loading Functions:

    • Modify LoadBunny, LoadMonkey, LoadCube, and similar functions to use SLIME_RESULT and errcheck.
  6. Error Logging:

    • Ensure spdlog is properly integrated for error logging.
    • Review and update error messages for clarity and consistency.
  7. Documentation:

    • Update documentation to reflect the new error handling system.
    • Provide examples of how to use SLIME_RESULT and errcheck in the codebase.
  8. Testing:

    • Create unit tests for the new error handling system.
    • Update existing tests to work with SLIME_RESULT.
  9. Code Review:

    • Conduct a thorough code review to ensure consistent implementation across the codebase.

Acceptance Criteria

Additional Notes

Related Issues

Please update this issue with any additional tasks or considerations as the implementation progresses.

ConnorY97 commented 3 months ago

Ive decided that I dont want it to return a result, I think we should make it crash nicely and log it better instead For this specific case you could just check the string if its empty and then fail the test, Then check your logs as to why Returning a result to something like this just adds so much boiler plate for every function call that will be identical in every call I just dont like the idea of being like, "I want this shader file, Sweet now let me wrap all of this call in a if check, and add different outputs for each result case" where you could do all of this from inside the manager it self