refactor TryCatch implementation for improved error handling #46
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request refactors and enhances the
plus.TryCatch
function ingame/packages/thlib-scripts/plus/Utility.lua
. The changes improve maintainability, readability, and error handling by restructuring the implementation and adding detailed type annotations.Refactoring and Enhancements to
plus.TryCatch
:plus.TryCatch
function with a more modular and structured approach, utilizing helper functions (innerFunc
,innerCatchFunc
, andpackageResult
) for better readability and maintainability.plus.TryCatch.Data
class with type annotations fortry
,catch
, andfinally
functions, ensuring clearer documentation and stricter type checking.try
andcatch
blocks, and ensured proper propagation of unhandled errors.finally
blocks aftertry
orcatch
blocks, ensuring compatibility with existing usage.These changes make the
plus.TryCatch
function more robust and easier to understand while preserving its core functionality.