-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from moritzvieli/feature/backup
Feature/backup
- Loading branch information
Showing
74 changed files
with
14,268 additions
and
13,691 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/main/java/com/ascargon/rocketshow/api/ControllerService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.ascargon.rocketshow.api; | ||
|
||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public interface ControllerService { | ||
|
||
ResponseEntity<ErrorResponse> handleException(Exception exception); | ||
|
||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/com/ascargon/rocketshow/api/DefaultControllerService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.ascargon.rocketshow.api; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
public class DefaultControllerService implements ControllerService { | ||
|
||
private final static Logger logger = LoggerFactory.getLogger(DefaultControllerService.class); | ||
|
||
@Override | ||
public ResponseEntity<ErrorResponse> handleException(Exception exception) { | ||
HttpStatus httpStatus = HttpStatus.INTERNAL_SERVER_ERROR; | ||
ErrorResponse errorResponse = new ErrorResponse(); | ||
errorResponse.setMessage(exception.getMessage()); | ||
errorResponse.setCode("unknown"); | ||
|
||
// specific mapping | ||
// if (exception instanceof NotFoundException) { | ||
// httpStatus = HttpStatus.NOT_FOUND; | ||
// errorResponse.setCode("not-found"); | ||
// } else { | ||
logger.error("An exception has been thrown in the controller", exception); | ||
// } | ||
|
||
return new ResponseEntity<>(errorResponse, httpStatus); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/com/ascargon/rocketshow/api/ErrorResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.ascargon.rocketshow.api; | ||
|
||
public class ErrorResponse { | ||
private String message; | ||
private String code; | ||
|
||
public String getMessage() { | ||
return message; | ||
} | ||
|
||
public void setMessage(String message) { | ||
this.message = message; | ||
} | ||
|
||
public String getCode() { | ||
return code; | ||
} | ||
|
||
public void setCode(String code) { | ||
this.code = code; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.