mirror of
https://github.com/PaulReichmuth/timekeep-backend.git
synced 2026-02-06 04:53:25 +00:00
made exception interfaces
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
package de.pnreichmuth.timekeep_backend.exceptions;
|
||||||
|
|
||||||
|
public class ExistsException extends RuntimeException {
|
||||||
|
public ExistsException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package de.pnreichmuth.timekeep_backend.exceptions;
|
||||||
|
|
||||||
|
public class NotFoundException extends RuntimeException {
|
||||||
|
public NotFoundException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@ import de.pnreichmuth.timekeep_backend.entities.Team;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class RacerExistsException extends RuntimeException {
|
public class RacerExistsException extends ExistsException {
|
||||||
public RacerExistsException(String message, Racer racer) {
|
public RacerExistsException(String message, Racer racer) {
|
||||||
super(message);
|
super(message);
|
||||||
log.warn(message, racer.getFirstName(), racer.getLastName());
|
log.warn(message, racer.getFirstName(), racer.getLastName());
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import org.springframework.http.HttpStatus;
|
|||||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class RacerNotFoundException extends RuntimeException {
|
public class RacerNotFoundException extends NotFoundException {
|
||||||
public RacerNotFoundException(String message) {
|
public RacerNotFoundException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
log.error(message);
|
log.error(message);
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import de.pnreichmuth.timekeep_backend.entities.Station;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class StationExistsException extends RuntimeException {
|
public class StationExistsException extends ExistsException {
|
||||||
public StationExistsException(String message, Station station) {
|
public StationExistsException(String message, Station station) {
|
||||||
super(message);
|
super(message);
|
||||||
log.warn(message, station.getName(), station.getLocation());
|
log.warn(message, station.getName(), station.getLocation());
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package de.pnreichmuth.timekeep_backend.exceptions;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class StationNotFoundException extends RuntimeException {
|
public class StationNotFoundException extends NotFoundException {
|
||||||
public StationNotFoundException(String message) {
|
public StationNotFoundException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
log.error(message);
|
log.error(message);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import org.springframework.http.HttpStatus;
|
|||||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class TeamExistsException extends RuntimeException {
|
public class TeamExistsException extends ExistsException {
|
||||||
public TeamExistsException(String message, Team team) {
|
public TeamExistsException(String message, Team team) {
|
||||||
super(message);
|
super(message);
|
||||||
log.warn(message, team.getTeamName());
|
log.warn(message, team.getTeamName());
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import org.springframework.http.HttpStatus;
|
|||||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class TeamNotFoundException extends RuntimeException {
|
public class TeamNotFoundException extends NotFoundException {
|
||||||
public TeamNotFoundException(String message) {
|
public TeamNotFoundException(String message) {
|
||||||
super(message);
|
super(message);
|
||||||
log.error(message);
|
log.error(message);
|
||||||
|
|||||||
Reference in New Issue
Block a user