File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
src/main/java/com/bnc/sbjb/rest Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change 28
28
include :
29
29
- stage : test
30
30
- stage : deploy to development
31
+ if : env(DEV_ACCOUNT_ID) is present
31
32
jdk : openjdk8
32
33
env :
33
34
- CLUSTER_NAME=
44
45
on :
45
46
branch : master
46
47
- stage : deploy to production
48
+ if : env(PROD_ACCOUNT_ID) is present
47
49
jdk : openjdk8
48
50
env :
49
51
- CLUSTER_NAME=
Original file line number Diff line number Diff line change 1
1
package com .bnc .sbjb .rest ;
2
2
3
+ import com .bnc .sbjb .model .api .CustomError ;
4
+ import javax .servlet .http .HttpServletResponse ;
3
5
import org .springframework .boot .web .servlet .error .ErrorController ;
4
6
import org .springframework .http .HttpStatus ;
7
+ import org .springframework .http .ResponseEntity ;
5
8
import org .springframework .web .bind .annotation .RequestMapping ;
6
- import org .springframework .web .bind .annotation .ResponseStatus ;
7
9
import org .springframework .web .bind .annotation .RestController ;
8
10
9
11
@ RestController
10
12
public class DefaultErrorController implements ErrorController {
11
13
12
14
private static final String PATH = "/error" ;
13
15
14
- @ ResponseStatus (HttpStatus .NOT_FOUND )
15
16
@ RequestMapping (value = PATH )
16
- public void error () {
17
- // Blank method since we don't need to do anything to handle unknown paths.
18
- // Any forked service may choose to handle some requests differently.
17
+ public ResponseEntity < CustomError > error (HttpServletResponse response ) {
18
+ HttpStatus status = HttpStatus . valueOf ( response . getStatus ());
19
+ return ResponseEntity . status ( response . getStatus ()). body ( new CustomError ( status , status . getReasonPhrase ()));
19
20
}
20
21
21
22
@ Override
You can’t perform that action at this time.
0 commit comments