asar icon indicating copy to clipboard operation
asar copied to clipboard

DLL Binding Needs Better Error Checking

Open RPGHacker opened this issue 5 years ago • 3 comments
trafficstars

The current error checking in the C DLL binding is really bad (as in: non-existent). It only checks whether the DLL was loaded or not, but if it wasn't loaded, it doesn't give any info on why it failed. Basically, at least an HRESULT_FROM_WIN32(GetLastError()) should be there somewhere, maybe coupled with a simple API function to retrieve an error string in the case of failure.

RPGHacker avatar Jul 05 '20 16:07 RPGHacker

Added a printf() and a debug print in fc023f4c048fbb2699dffe1e87223434e4be3467. However, I still think this needs more work. People who use Asar in a GUI application will likely not see any error traces. The interface itself should be updated to support returning an error string.

RPGHacker avatar Jul 05 '20 17:07 RPGHacker

Doesn't that kinda stuff fit better in stderr than stdout?

Alcaro avatar Jul 05 '20 17:07 Alcaro

Whoops, you're right, I didn't even think about that difference. That being said, I think the Linux implementation currently also just uses puts() for this, so we should change it there as well. Well, of course only if we don't implement a different form of error reporting altogether.

RPGHacker avatar Jul 05 '20 17:07 RPGHacker