1
0

refactoring packages, moving Hostsharing related entities etc. to hs package

This commit is contained in:
Michael Hoennig
2022-08-03 06:11:39 +02:00
parent 142aac2bce
commit bb05eb4ac4
14 changed files with 35 additions and 27 deletions

View File

@ -23,7 +23,7 @@ public class RestResponseEntityExceptionHandler
final RuntimeException exc, final WebRequest request) {
return new ResponseEntity<>(
new CustomErrorResponse(exc, HttpStatus.CONFLICT), HttpStatus.CONFLICT);
new CustomErrorResponse(request.getContextPath(), exc, HttpStatus.CONFLICT), HttpStatus.CONFLICT);
}
@ExceptionHandler(JpaSystemException.class)
@ -31,7 +31,7 @@ public class RestResponseEntityExceptionHandler
final RuntimeException exc, final WebRequest request) {
return new ResponseEntity<>(
new CustomErrorResponse(exc, HttpStatus.FORBIDDEN), HttpStatus.FORBIDDEN);
new CustomErrorResponse(request.getContextPath(), exc, HttpStatus.FORBIDDEN), HttpStatus.FORBIDDEN);
}
}
@ -41,13 +41,19 @@ class CustomErrorResponse {
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd hh:mm:ss")
private final LocalDateTime timestamp;
private final HttpStatus status;
private final String path;
private final int status;
private final String error;
private final String message;
public CustomErrorResponse(final RuntimeException exc, final HttpStatus status) {
public CustomErrorResponse(final String path, final RuntimeException exc, final HttpStatus status) {
this.timestamp = LocalDateTime.now();
this.status = status;
this.path = path;
this.status = status.value();
this.error = status.getReasonPhrase();
this.message = firstLine(NestedExceptionUtils.getMostSpecificCause(exc).getMessage());
}

View File

@ -1,4 +1,4 @@
package net.hostsharing.hsadminng.hscustomer;
package net.hostsharing.hsadminng.hs.hscustomer;
import net.hostsharing.hsadminng.context.Context;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,4 +1,4 @@
package net.hostsharing.hsadminng.hscustomer;
package net.hostsharing.hsadminng.hs.hscustomer;
import lombok.AllArgsConstructor;
import lombok.Getter;

View File

@ -1,4 +1,4 @@
package net.hostsharing.hsadminng.hscustomer;
package net.hostsharing.hsadminng.hs.hscustomer;
import org.springframework.data.jpa.repository.JpaRepository;

View File

@ -1,4 +1,4 @@
package net.hostsharing.hsadminng.hspackage;
package net.hostsharing.hsadminng.hs.hspackage;
import net.hostsharing.hsadminng.context.Context;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,9 +1,9 @@
package net.hostsharing.hsadminng.hspackage;
package net.hostsharing.hsadminng.hs.hspackage;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import net.hostsharing.hsadminng.hscustomer.CustomerEntity;
import net.hostsharing.hsadminng.hs.hscustomer.CustomerEntity;
import javax.persistence.*;
import java.util.UUID;

View File

@ -1,4 +1,4 @@
package net.hostsharing.hsadminng.hspackage;
package net.hostsharing.hsadminng.hs.hspackage;
import org.springframework.data.jpa.repository.JpaRepository;