Just to explain more about the context, this is how to reproduce:
- Delphi 7 (but perhaps more recent versions as well)
- Import Type Library “Microsoft VBScript Regular Expressions 5.5”
Write a program around this code:
var
re:RegExp;
try
re:=CoRegExp.Create;
re.Pattern:='(';//is an invalid regex, but see below
re.Test('');
except
on e:Exception do
Caption:=e.ClassName+' '+e.Message;
end;
This will throw an Exception EOleError OLE error 800A139C
It does so because SysErrorMessage returns an empty string on this code and the EOleSysError constructor defaults to the SOleError resource string to return something.
Is there a winapi alternative to SysErrorMessage to get a hold of a better error description? If I google around a bit, the code does stand for a ‘missing parentheses’ error, but if there is a way I could get a (localized) description from the system, I would prefer using it, over having to add an enumeration of error-description constants to my project.
That’s a COM error. To get a textual description call GetErrorInfo and then IErrorInfo.GetDescription. But don’t be surprised if you don’t get anything useful back.