libmem icon indicating copy to clipboard operation
libmem copied to clipboard

Add debugging logs and more specific error return values

Open rdbo opened this issue 2 years ago • 4 comments

There should be some debug logs on libmem so that it gets easier to debug, and error values that can help the user to understand why that error was caused in the first place. These things could be disabled using preprocessor definitions.

rdbo avatar Dec 26 '22 15:12 rdbo

I don't think this is going to happen - it would need a lot of restructuring on libmem. Besides, errors are different depending on the OS, so it would become a bit messy anyways.

rdbo avatar Jan 21 '23 16:01 rdbo

The best way for this to happen would probably be using something like LM_GetLastError, or LM_GetLastErrorStr I'm not sure how this would be implemented though; the errors are different depending on the OS

rdbo avatar Jan 22 '23 09:01 rdbo

This is not coming out soon. For now, things either work or don't, and libmem lets you know that. No specific errors.

rdbo avatar Nov 22 '23 17:11 rdbo

For Rust, the obvious choice is using Results with a libmem-specific error type. For C++, there is a feature in C++ 23 which is similar to Rust's Result, called std::expected C++ alternate suggestions by @illegal-instruction-co

template <typename T>
struct Result{
    lm_error_result_t
    T actualResult;
}

Or std::pair

rdbo avatar Dec 14 '23 13:12 rdbo