Exception handling #82

Merged
stne3960 merged 6 commits from feature/exception-handling into main 2026-02-02 11:18:37 +01:00
Showing only changes of commit 42abc19ffa - Show all commits

View File

@ -0,0 +1,33 @@
package se.su.dsv.studentportalen.bff.exception;
import org.springframework.http.HttpStatus;
/**
* Exception for authorization failures.
* Thrown when the user is authenticated but not allowed to perform the action.
*/
public class ForbiddenException extends StudentportalenException {
public ForbiddenException(String message) {
super(message);
}
public ForbiddenException(String message, Throwable cause) {
super(message, cause);
}
@Override
public String getType() {
return "studentportalen:forbidden";
}
@Override
public String getTitle() {
return "Access denied";
}
@Override
public HttpStatus getStatus() {
return HttpStatus.FORBIDDEN;
}
}