implemented fetch qr code scanned details

This commit is contained in:
ltiongku
2024-07-19 20:32:55 +08:00
parent 0af328977b
commit a236eb13f8
36 changed files with 148 additions and 82 deletions

View File

@@ -0,0 +1,16 @@
package com.safeqr.app.exceptions;
import lombok.Builder;
import lombok.Data;
@Builder
@Data
public class ErrorResponse {
private String error;
private int status;
public ErrorResponse(String message, int status){
this.error = message;
this.status = status;
}
}

View File

@@ -0,0 +1,15 @@
package com.safeqr.app.exceptions;
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 GlobalExceptionHandler {
@ExceptionHandler(QRCodeExceptions.class)
public ResponseEntity<ErrorResponse> handleQRCodeNotFoundException(QRCodeExceptions e) {
return new ResponseEntity<>(new ErrorResponse(e.getMessage(), HttpStatus.NOT_FOUND.value()), HttpStatus.NOT_FOUND);
}
}

View File

@@ -0,0 +1,7 @@
package com.safeqr.app.exceptions;
public class QRCodeExceptions extends RuntimeException {
public QRCodeExceptions(String message){
super(message);
}
}