made exception interfaces

This commit is contained in:
2026-02-04 19:50:24 +01:00
parent 0a65a47749
commit b9d4943ba4
8 changed files with 20 additions and 6 deletions

View File

@@ -0,0 +1,7 @@
package de.pnreichmuth.timekeep_backend.exceptions;
public class ExistsException extends RuntimeException {
public ExistsException(String message) {
super(message);
}
}

View File

@@ -0,0 +1,7 @@
package de.pnreichmuth.timekeep_backend.exceptions;
public class NotFoundException extends RuntimeException {
public NotFoundException(String message) {
super(message);
}
}

View File

@@ -5,7 +5,7 @@ import de.pnreichmuth.timekeep_backend.entities.Team;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class RacerExistsException extends RuntimeException {
public class RacerExistsException extends ExistsException {
public RacerExistsException(String message, Racer racer) {
super(message);
log.warn(message, racer.getFirstName(), racer.getLastName());

View File

@@ -5,7 +5,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@Slf4j
public class RacerNotFoundException extends RuntimeException {
public class RacerNotFoundException extends NotFoundException {
public RacerNotFoundException(String message) {
super(message);
log.error(message);

View File

@@ -4,7 +4,7 @@ import de.pnreichmuth.timekeep_backend.entities.Station;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class StationExistsException extends RuntimeException {
public class StationExistsException extends ExistsException {
public StationExistsException(String message, Station station) {
super(message);
log.warn(message, station.getName(), station.getLocation());

View File

@@ -3,7 +3,7 @@ package de.pnreichmuth.timekeep_backend.exceptions;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class StationNotFoundException extends RuntimeException {
public class StationNotFoundException extends NotFoundException {
public StationNotFoundException(String message) {
super(message);
log.error(message);

View File

@@ -6,7 +6,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@Slf4j
public class TeamExistsException extends RuntimeException {
public class TeamExistsException extends ExistsException {
public TeamExistsException(String message, Team team) {
super(message);
log.warn(message, team.getTeamName());

View File

@@ -5,7 +5,7 @@ import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@Slf4j
public class TeamNotFoundException extends RuntimeException {
public class TeamNotFoundException extends NotFoundException {
public TeamNotFoundException(String message) {
super(message);
log.error(message);