-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #335 from vinho-notas/VIN-397-Refatorar-as-excecoe…
…s-de-todo-o-projeto-seguindo-o-padrao-do-pass-in Vin 397 refatorar as excecoes de todo o projeto seguindo o padrao do pass in
- Loading branch information
Showing
87 changed files
with
638 additions
and
251 deletions.
There are no files selected for viewing
12 changes: 0 additions & 12 deletions
12
...in/java/com/vinhonotas/avaliacao/application/services/exceptions/BadRequestException.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...acao/src/main/java/com/vinhonotas/avaliacao/configuration/PointScaleExceptionHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.vinhonotas.avaliacao.configuration; | ||
|
||
import com.vinhonotas.avaliacao.domain.entities.exceptions.BadRequestException; | ||
import com.vinhonotas.avaliacao.domain.entities.exceptions.PointScaleNotFoundException; | ||
import com.vinhonotas.avaliacao.interfaces.dtos.general.ErrorResponseDTO; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.ControllerAdvice; | ||
import org.springframework.web.bind.annotation.ExceptionHandler; | ||
|
||
@ControllerAdvice | ||
public class PointScaleExceptionHandler { | ||
|
||
@ExceptionHandler(PointScaleNotFoundException.class) | ||
public ResponseEntity<ErrorResponseDTO> handlePointScaleNotFoundException(PointScaleNotFoundException exception) { | ||
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(new ErrorResponseDTO(exception.getMessage())); | ||
} | ||
|
||
@ExceptionHandler(BadRequestException.class) | ||
public ResponseEntity<ErrorResponseDTO> handleBadRequestException(BadRequestException exception) { | ||
return ResponseEntity.badRequest().body(new ErrorResponseDTO(exception.getMessage())); | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
...rc/main/java/com/vinhonotas/avaliacao/domain/entities/exceptions/BadRequestException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.vinhonotas.avaliacao.domain.entities.exceptions; | ||
|
||
public class BadRequestException extends RuntimeException { | ||
|
||
public BadRequestException(String message) { | ||
super(message); | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
...java/com/vinhonotas/avaliacao/domain/entities/exceptions/PointScaleNotFoundException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.vinhonotas.avaliacao.domain.entities.exceptions; | ||
|
||
public class PointScaleNotFoundException extends RuntimeException { | ||
|
||
public PointScaleNotFoundException(String message) { | ||
super(message); | ||
} | ||
|
||
} |
4 changes: 4 additions & 0 deletions
4
...acao/src/main/java/com/vinhonotas/avaliacao/interfaces/dtos/general/ErrorResponseDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package com.vinhonotas.avaliacao.interfaces.dtos.general; | ||
|
||
public record ErrorResponseDTO(String message) { | ||
} |
2 changes: 1 addition & 1 deletion
2
...st/java/com/vinhonotas/avaliacao/application/services/impl/PointScaleServiceImplTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
...ain/java/com/vinhonotas/cadastro/application/services/exceptions/BadRequestException.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.