[
https://jira.jboss.org/jira/browse/JBRULES-2079?page=com.atlassian.jira.p...
]
Geoffrey De Smet commented on JBRULES-2079:
-------------------------------------------
This could be a pseudo code implementation on ReteooRuleBase:
public void addPackage(final Package newPkg) {
if (newPkg.hasErrors()) {
throw new InvalidPackageException(newPkg.getErrors());
}
// existing code
List<Package> list = new ArrayList<Package>();
list.add( newPkg );
super.addPackages( list );
if ( this.getConfig().isSequential() ) {
this.reteooBuilder.setOrdered( false );
}
}
class InvalidPackageException {
InvalidPackageException(List<Error> errors) {
super("The first error is " +error.get(0).toString());
this.errors = errors;
}
ruleBase.addPackage(packageBuilder.getPackage()); should fail-fast
with a clear error message if the packageBuilder has any errors
----------------------------------------------------------------------------------------------------------------------------------
Key: JBRULES-2079
URL:
https://jira.jboss.org/jira/browse/JBRULES-2079
Project: JBoss Drools
Issue Type: Feature Request
Security Level: Public(Everyone can see)
Components: drools-core
Affects Versions: 5.0.0.CR1
Reporter: Geoffrey De Smet
Assignee: Mark Proctor
Priority: Minor
Fix For: 5.1.0.M1
After you 've build your package with packageBuilder,
you've either called the hasErrors() method and done something about it
or you didn't check the hasErrors() method because you didn't know (or want to
know) it existed and you expect it to throw an exception because hasErrors() returns
true.
The principle of least surpise. You don't expect that it continues like everything is
cool (while it's not) and crashes the moment you fire your first rules.
The exception should be a runtime exception and the message should at least mention the
first of the errors.
The exception should probably contain a list of all errors of course too as a property.
See InvalidStateException in hibernate-validator.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira