You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.1 KiB
34 lines
1.1 KiB
package app.exceptions.handler;
|
|
|
|
import app.annotations.exceptions.InvalidCookie;
|
|
import app.annotations.exceptions.LowPermition;
|
|
import app.annotations.exceptions.NeedCookie;
|
|
import app.exceptions.steam.InvalidSteamID;
|
|
import org.springframework.http.HttpEntity;
|
|
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 GlobalExceptionAdvice {
|
|
@ExceptionHandler(NeedCookie.class)
|
|
public ResponseEntity handNeedCookie() {
|
|
return new ResponseEntity(HttpStatus.UNAUTHORIZED);
|
|
}
|
|
|
|
@ExceptionHandler(InvalidCookie.class)
|
|
public ResponseEntity handInvalidCookie() {
|
|
return new ResponseEntity(HttpStatus.UNAUTHORIZED);
|
|
}
|
|
|
|
@ExceptionHandler(LowPermition.class)
|
|
public ResponseEntity handLowPermition(){
|
|
return new ResponseEntity<>(HttpStatus.FORBIDDEN);
|
|
}
|
|
|
|
@ExceptionHandler(InvalidSteamID.class)
|
|
public ResponseEntity handInvalidSteamID() {
|
|
return new ResponseEntity(HttpStatus.NOT_FOUND);
|
|
}
|
|
}
|
|
|