This commit is contained in:
2026-11-20 22:48:28 +03:00
parent 276dbdad8a
commit 8e1f96b70b
46 changed files with 2345 additions and 49 deletions
@@ -0,0 +1,24 @@
package ru.mtusi.messenger;
public class ApiException extends RuntimeException {
private final int status;
private final String code;
public ApiException(int status, String code, String message) {
super(message);
this.status = status;
this.code = code;
}
public int status() { return status; }
public String code() { return code; }
public static ApiException invalid(String message) {
return new ApiException(400, "invalid_request", message);
}
public static ApiException unauthorized() {
return new ApiException(401, "unauthorized", "Требуется действующая Bearer-сессия");
}
public static ApiException notFound() {
return new ApiException(404, "not_found", "Объект не найден");
}
}