fixed exceptions

This commit is contained in:
Andrey Terentev 2024-05-27 02:44:08 +07:00 committed by Andrey Terentev
parent 33327d5296
commit 93760fd7b7
5 changed files with 13 additions and 0 deletions

View File

@ -1,5 +1,8 @@
package ru.dragonestia.picker.api.impl.exception;
import ru.dragonestia.picker.api.exception.ApiException;
@ApiException
public class AuthException extends RuntimeException {
public AuthException(String message) {

View File

@ -1,8 +1,11 @@
package ru.dragonestia.picker.api.impl.exception;
import ru.dragonestia.picker.api.exception.ApiException;
import java.util.Collections;
import java.util.Map;
@ApiException
public class GraphqlException extends RuntimeException {
private final Map<String, String> details;

View File

@ -1,5 +1,8 @@
package ru.dragonestia.picker.api.impl.exception;
import ru.dragonestia.picker.api.exception.ApiException;
@ApiException
public class NotEnoughPermissions extends RuntimeException {
public NotEnoughPermissions(String message) {

View File

@ -1,5 +1,8 @@
package ru.dragonestia.picker.api.impl.exception;
import ru.dragonestia.picker.api.exception.ApiException;
@ApiException
public class UnknownException extends RuntimeException {
public UnknownException(String message) {

View File

@ -184,6 +184,7 @@ public class RestTemplate {
var exceptionClass = response.header("X-Server-Exception");
var body = new String(Objects.requireNonNull(response.body()).bytes(), StandardCharsets.UTF_8);
System.out.println("EXCEPTION: " + exceptionClass + " " + body);
throw ExceptionService.prepare(exceptionClass, body);
}