MatchException#
The exception thrown by SkillLayer.slots and SkillLayer.validatePool. It reports an invalid item in the pool or the requirements, or a project state that doesn't allow building slots. It's an unchecked RuntimeException but not a PlenException, so catch (PlenException e) doesn't catch it. toPlenException() converts it to one.
Declaration#
;
The class is abstract. Every thrown value is one of the two nested subclasses. Catch them separately, or catch MatchException and test with instanceof.
Java 21 also defines java.lang.MatchException. With only import org.dhtmlx.plen.*;, the simple name MatchException is ambiguous and doesn't compile. Import the class by name:
;
;
Methods#
toPlenException#
public abstract PlenException
Returns the equivalent engine exception, so a method that calls both slots and Project#suggestAssignments can rethrow it and handle one exception type.
| Subclass | Returns |
|---|---|
Invalid |
A new InputException of kind VALIDATION, with the same path and detail as its message |
Project |
The wrapped ProjectException (error), not a copy |
Variants#
| Variant | When it occurs |
|---|---|
Invalid |
An item of the pool or a requirement is invalid. path names the item, detail says what's wrong |
Project |
The project has no accepted baseline: it's unsolved, or it has unsolved edits after apply. code() returns ProjectError.NO_BASELINE |
Invalid#
An invalid pool or requirement. Thrown by slots and validatePool; validatePool throws it only for pool.workers[...] paths.
| Member | Type | Description |
|---|---|---|
path |
String |
The invalid item, for example requirements[2].assignments[0] |
detail |
String |
What's wrong with the item |
getMessage() |
String |
"<path>: <detail>", built by the constructor. Not updated by withPath / withDetail |
getCause() |
Throwable |
null |
path values:
| Path | When it occurs |
|---|---|
pool.workers[i].resource |
Unknown resource, or the same resource listed as two workers |
pool.workers[i].skills[j].id |
The same skill listed twice on one worker |
pool.workers[i].skills[j].value |
Not finite |
requirements[i].id |
Duplicate requirement id, or one of its slot ids is an active assignment on another task |
requirements[i].task |
Unknown or unscheduled task |
requirements[i].count |
0 |
requirements[i].units |
Not finite, or <= 0 |
requirements[i].matches[j].value |
Not finite |
requirements[i].assignments |
More entries than count, or an assignment with one of this requirement's slot ids is left out of the list |
requirements[i].assignments[k] |
Unknown or inactive assignment, an assignment on another task, or an assignment bound twice |
Project#
The project state doesn't allow building slots. slots throws it with a ProjectException of code NO_BASELINE.
| Member | Type | Description |
|---|---|---|
error |
ProjectException |
The wrapped project-state exception |
code() |
ProjectError |
error.code |
getMessage() |
String |
The message of error, the kebab-case code, for example no-baseline |
getCause() |
Throwable |
error |
The constructor throws NullPointerException when error is null.
Example#
;
;
;
Related#
SkillLayer.slots- the call that throws itInputException- whatInvalidconverts toProjectException- whatProjectwraps- Error handling - handling slot and suggestion errors through one type
- Skills and requirements - the checks run on pools and requirements