Does anyone know of a situation in which the Database.convertLead() method fails by returning errors in the LeadConvertResult object that it returns, rather than throwing an exception? I'm trying to handle that situation like this:
Database.LeadConvertResult lcr = Database.convertLead(lc);
if (!lcr.IsSuccess()) {
errormsg = lcr.errors.get(0).message;
return null;
}
but all of the approaches I've tried in my test cases to force an error on convertLead result in an exception being thrown instead of returning an object where IsSuccess() returns false.
Maybe I shouldn't worry so much about being at 98% test coverage rather than 100%, but it's bugging me, and I'm wondering if the proper approach to handling these errors is try/catch rather than checking the result. Can anyone offer some suggestions? Thanks!