Error Codes

ForkYeahProblemCode defines the library’s error catalogue. Every code maps to HTTP 400 Bad Request.

Code Name When it’s raised

1041

InvalidForkOperation

Generic fork failure — used as a fallback when the fork mode is missing or unknown.

1042

InvalidForkToCopyOperation

A ToCopy fork was requested but the source/target relationship is invalid (e.g. years don’t match).

1043

InvalidForkToNextOperation

A ToNext fork was requested but target != source + 1, or the source could not be loaded.

1044

InvalidForkToPreviousOperation

A ToPrevious fork was requested but target != source - 1, or the operation isn’t supported for that entity.

The right code for a given situation is selected via the helpers on ForkMode:

throw Problem.of(ForkMode.toProblemCode(forkSource))
    .withInfo("forkFrom", forkSource, "targetPeriod", target.getSeason())
    .toThrowable();

ForkMode.toProblemCode(…​) accepts either a ForkSource or a raw ForkMode and falls back to InvalidForkOperation when the input is null. Always prefer this over hard-coding a specific code — it keeps the response aligned with the mode that was actually attempted.

The codes register themselves automatically with conta-problem-json via the static initialiser on ForkYeahProblemCode, so they show up in the generated problem JSON catalogue without further wiring.