ProjectException#
Thrown when a call doesn't fit the current state of a Project: the project has no solved baseline, a baseline token is out of date, or an earlier apply rejected operations. The code field says which.
Declaration#
;
Unchecked: it extends PlenException, a RuntimeException, and no method declares it in throws. catch (PlenException e) also catches it.
Constructors#
ProjectException(ProjectError)#
public
Creates the exception with the given code. The message is the code's kebab-case spelling.
Parameters
| Name | Type | Description |
|---|---|---|
code |
ProjectError |
The error code |
Fields#
code#
public ProjectError code
The error code. Branch on it to pick the recovery.
Methods#
withCode#
public ProjectException
Sets code and returns this exception. The message keeps the spelling of the code passed to the constructor.
getMessage#
public String
Inherited from Throwable. Returns the kebab-case code: "no-baseline", "stale-baseline" or "needs-resync".
ProjectError#
The code of a ProjectException.
;
| Value | Message | When it occurs | Thrown by |
|---|---|---|---|
NO_BASELINE |
no-baseline |
The project has no solved baseline: it was never solved, or it has unsolved edits after apply |
preview, loadProfile, evaluate, suggestAssignments, roster |
STALE_BASELINE |
stale-baseline |
A baselineId in the options or in SchedulingChanges doesn't name the current baseline. A null baselineId is never checked |
preview, apply, loadProfile, evaluate, suggestAssignments |
NEEDS_RESYNC |
needs-resync |
An earlier apply rejected an operation, and no full solve(data, …) has followed. Only a solve with non-null data clears it |
solve with null data, apply, level |
SkillLayer.slots reports NO_BASELINE as a MatchException.Project that wraps a ProjectException.
For how to recover from each code, see Error handling.
Example#
;
Related#
PlenException- the base classInputException- the error for invalid inputProject- the stateful project whose state is checked- Error handling - telling the codes apart and recovering
- Recover from rejected changes - clearing
NEEDS_RESYNC