Merging origin/dev into feat/assignment-page correctie

This commit is contained in:
Joyelle Ndagijimana 2025-04-07 18:21:24 +02:00
commit baea0051e6
249 changed files with 6754 additions and 3612 deletions

View file

@ -0,0 +1,14 @@
import { NotFoundException } from "@/exception/not-found-exception.ts";
import { InvalidResponseException } from "@/exception/invalid-response-exception.ts";
export function single<T>(list: T[]): T {
if (list.length === 1) {
return list[0];
} else if (list.length === 0) {
throw new NotFoundException("Expected list with exactly one element, but got an empty list.");
} else {
throw new InvalidResponseException(
`Expected list with exactly one element, but got one with ${list.length} elements.`,
);
}
}