File tree Expand file tree Collapse file tree 5 files changed +54
-7
lines changed
java/com/olegshan/controllers Expand file tree Collapse file tree 5 files changed +54
-7
lines changed Original file line number Diff line number Diff line change
1
+ package com .olegshan .controllers ;
2
+
3
+ import org .springframework .ui .Model ;
4
+ import org .springframework .web .bind .annotation .ControllerAdvice ;
5
+ import org .springframework .web .bind .annotation .ExceptionHandler ;
6
+
7
+ /**
8
+ * Created by olegshan on 20.10.2016.
9
+ */
10
+ @ ControllerAdvice
11
+ public class ErrorHandler {
12
+
13
+ @ ExceptionHandler (Exception .class )
14
+ public String exception (Exception e , Model model ) {
15
+ model .addAttribute ("errorMessage" , e .getMessage ());
16
+ return "exception" ;
17
+ }
18
+ }
Original file line number Diff line number Diff line change @@ -2,13 +2,14 @@ spring.datasource.url = jdbc:postgresql://localhost:5432/jparser
2
2
spring.datasource.username = postgres
3
3
spring.datasource.password = root
4
4
spring.jpa.show-sql = true
5
- spring.jpa.hibernate.ddl-auto = update
6
5
6
+ spring.jpa.hibernate.ddl-auto = update
7
+ spring.mvc.throw-exception-if-no-handler-found =true
8
+ # spring.resources.add-mappings=false
7
9
8
10
# Amazon Elastic Beanstalk database settings, used in production mode:
9
11
10
12
# spring.datasource.url = jdbc:postgresql://${RDS_HOSTNAME}:${RDS_PORT}/${RDS_DB_NAME}
11
13
# spring.datasource.username = ${RDS_USERNAME}
12
14
# spring.datasource.password = ${RDS_PASSWORD}
13
- # spring.thymeleaf.encoding=UTF-8
14
- # spring.jpa.hibernate.ddl-auto = update
15
+ # spring.thymeleaf.encoding=UTF-8
Original file line number Diff line number Diff line change 1
1
.logo {
2
- margin : 20px 0 px 40px 10px ;
2
+ margin : 20px 0 40px 10px ;
3
3
}
4
4
5
5
.logo h1 , .logo span {
6
6
display : inline-block;
7
7
}
8
8
9
9
.logo h1 {
10
- margin-bottom : 0 px ;
10
+ margin-bottom : 0 ;
11
11
}
12
12
13
13
.logo p {
14
- margin-top : 0 px ;
14
+ margin-top : 0 ;
15
15
}
16
16
17
17
.logo small , .logo span , .logo p {
31
31
}
32
32
33
33
.footer {
34
- margin : 40px 0 px 40px 10px ;
34
+ margin : 40px 0 40px 10px ;
35
35
}
36
36
37
37
.table , .table td {
38
38
border : hidden;
39
+ }
40
+
41
+ .error {
42
+ margin : 80px 0 80px 10px ;
39
43
}
Original file line number Diff line number Diff line change
1
+ < html layout:decorator ="layout " xmlns:layout ="http://www.w3.org/1999/xhtml ">
2
+
3
+ < div layout:fragment ="content ">
4
+ < div class ="error ">
5
+ < h1 >
6
+ < small > Sorry, an error occured</ small >
7
+ </ h1 >
8
+ < p data-th-text ="${errorMessage} "> </ p >
9
+ < a href ="/ "> Return to homepage</ a >
10
+ </ div >
11
+ </ div >
12
+ </ html >
Original file line number Diff line number Diff line change
1
+ < html layout:decorator ="layout " xmlns:layout ="http://www.w3.org/1999/xhtml ">
2
+
3
+ < div layout:fragment ="content ">
4
+ < div class ="error ">
5
+ < h1 >
6
+ < small > Sorry, an error occured</ small >
7
+ </ h1 >
8
+ < p data-th-text ="${errorMessage} "> </ p >
9
+ < a href ="/ "> Return to homepage</ a >
10
+ </ div >
11
+ </ div >
12
+ </ html >
You can’t perform that action at this time.
0 commit comments