dzlib has no consistent error handling pattern: some functions return a Boolean, some raise an exception, some fail silently.
The library already has a convention in places, e.g. GetHdVolumeName / TryGetHdVolumeName in u_dzOsUtils: the Try function returns a Boolean with an out parameter, the other raises. A first worked example: GetModuleFilename in src/u_dzOsUtils.pas returns an empty string when Windows.GetModuleFileName fails, so the caller cannot tell failure from anything else. Adding TryGetModuleFilename and having GetModuleFilename raise EOSError would apply the convention; it changes what every consuming program sees on failure, so it should be done once the guideline is settled.
Also tracked as issue 11 in dzlib's ISSUES.md.
Changing what an existing function does on failure is too dangerous: a caller that does not expect an exception would break, and the compiler cannot warn it. So the convention is:
TryXxxreturns a Boolean with an out parameter,Xxxraises.TryXxxnext to it. Its doc comment says what it returns on failure.deprecated.For the example in the description, this means adding
TryGetModuleFilename, whileGetModuleFilenamekeeps returning an empty string instead of raisingEOSError.