I don’t think this is a ColdBox problem, but I am asking here to see if anyone has any suggestions to get around this, or even what the problem is.
try {
var objUser = ORMService.new(‘User’);
ORMService.populate(target = objUser, memento=rc);
var validationResults = ValidationService.validate(objUser);
if(!validationResults.hasErrors()) {
ORMService.save(objUser, true);
}
return validationResults.getErrors();
}
catch(Any e) {
if (e.message contains ‘could not insert’) {
return [‘Duplicate Entry’];
} else {
rethrow;
}
}
In the catch I am checking to see what the specific error might be, so in this case I am checking to see if it is a duplicate entry. Now the return array works, but it seems that the exception is continuing further on because it is again throwing the message somewhere else. I have no clues where to even look at this stage, I am almost thinking that the error is being captured here, and again when the request is flushed.
Regards,
Andrew Scott