Commit 0ceb032c by Rubén Ramírez

fix: [GlobalExceptionHandler]: Modificado y añadido un método para manejar las…

fix: [GlobalExceptionHandler]: Modificado y añadido un método para manejar las excepciones para el front
parent ba747566
...@@ -19,6 +19,13 @@ public class GlobalExceptionHandler { ...@@ -19,6 +19,13 @@ public class GlobalExceptionHandler {
.body("correo"); .body("correo");
} }
@ExceptionHandler(NombreUsuarioYaCogido.class)
public ResponseEntity<String> handleNombreUsuarioYaCogido(NombreUsuarioYaCogido ex) {
return ResponseEntity.status(HttpStatus.CONFLICT)
.contentType(org.springframework.http.MediaType.TEXT_PLAIN)
.body("nombre de usuario");
}
@ExceptionHandler(NombreUsuarioYaRegistrado.class) @ExceptionHandler(NombreUsuarioYaRegistrado.class)
public ResponseEntity<String> handleNombreUsuarioYaRegistrado(NombreUsuarioYaRegistrado ex) { public ResponseEntity<String> handleNombreUsuarioYaRegistrado(NombreUsuarioYaRegistrado ex) {
return ResponseEntity.status(HttpStatus.CONFLICT) return ResponseEntity.status(HttpStatus.CONFLICT)
...@@ -32,4 +39,5 @@ public class GlobalExceptionHandler { ...@@ -32,4 +39,5 @@ public class GlobalExceptionHandler {
.contentType(org.springframework.http.MediaType.TEXT_PLAIN) .contentType(org.springframework.http.MediaType.TEXT_PLAIN)
.body("Error inesperado."); .body("Error inesperado.");
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment