--- /dev/null
+package com.supwisdom.dlpay.exception;
+
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.ResponseStatus;
+
+@ResponseStatus(HttpStatus.BAD_REQUEST)
+public class BadRequestError extends RuntimeException {
+ public BadRequestError() {
+ }
+
+ public BadRequestError(String message) {
+ super(message);
+ }
+
+ public BadRequestError(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public BadRequestError(Throwable cause) {
+ super(cause);
+ }
+
+ public BadRequestError(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
+}
--- /dev/null
+package com.supwisdom.dlpay.exception;
+
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.ResponseStatus;
+
+@ResponseStatus(HttpStatus.CONFLICT)
+public class ConflictError extends RuntimeException {
+ public ConflictError() {
+ }
+
+ public ConflictError(String message) {
+ super(message);
+ }
+
+ public ConflictError(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ConflictError(Throwable cause) {
+ super(cause);
+ }
+
+ public ConflictError(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
+}
--- /dev/null
+package com.supwisdom.dlpay.exception;
+
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.ResponseStatus;
+
+@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
+public class InternalServerError extends RuntimeException {
+ public InternalServerError() {
+ }
+
+ public InternalServerError(String message) {
+ super(message);
+ }
+
+ public InternalServerError(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public InternalServerError(Throwable cause) {
+ super(cause);
+ }
+
+ public InternalServerError(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
+}
return ResponseEntity.ok(create().fail(bean, code, msg))
}
+ fun <T> ok(bean: T): ResponseEntity<T> {
+ return ResponseEntity.ok(bean)
+ }
+
fun <T> fail(status: HttpStatus, bean: T): ResponseEntity<T> {
return ResponseEntity.status(status).body(bean)
}
return fail(HttpStatus.NOT_FOUND, msg)
}
- fun notFound(error: ErrorResponse) : ResponseEntity<ErrorResponse> {
+ fun notFound(error: ErrorResponse): ResponseEntity<ErrorResponse> {
return fail(HttpStatus.NOT_FOUND, error)
}