main
|
Last change
on this file was 700e2f9, checked in by 186079 <matej.milevski@…>, 5 days ago |
|
Init
|
-
Property mode
set to
100644
|
|
File size:
1006 bytes
|
| Line | |
|---|
| 1 | package com.finki.icare.exceptions;
|
|---|
| 2 |
|
|---|
| 3 | import lombok.Getter;
|
|---|
| 4 | import org.springframework.http.HttpStatus;
|
|---|
| 5 |
|
|---|
| 6 | @Getter
|
|---|
| 7 | public class ICareException extends RuntimeException {
|
|---|
| 8 | private final HttpStatus status;
|
|---|
| 9 |
|
|---|
| 10 | public ICareException(String message, HttpStatus status) {
|
|---|
| 11 | super(message);
|
|---|
| 12 | this.status = status;
|
|---|
| 13 | }
|
|---|
| 14 |
|
|---|
| 15 | public static ICareException notFound(String message) {
|
|---|
| 16 | return new ICareException(message, HttpStatus.NOT_FOUND);
|
|---|
| 17 | }
|
|---|
| 18 |
|
|---|
| 19 | public static ICareException forbidden(String message) {
|
|---|
| 20 | return new ICareException(message, HttpStatus.FORBIDDEN);
|
|---|
| 21 | }
|
|---|
| 22 |
|
|---|
| 23 | public static ICareException unauthorized(String message) {
|
|---|
| 24 | return new ICareException(message, HttpStatus.UNAUTHORIZED);
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | public static ICareException badRequest(String message) {
|
|---|
| 28 | return new ICareException(message, HttpStatus.BAD_REQUEST);
|
|---|
| 29 | }
|
|---|
| 30 |
|
|---|
| 31 | public static ICareException conflict(String message) {
|
|---|
| 32 | return new ICareException(message, HttpStatus.CONFLICT);
|
|---|
| 33 | }
|
|---|
| 34 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.