File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
src/main/java/org/mybatis/spring Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2010-2022 the original author or authors.
2
+ * Copyright 2010-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -82,8 +82,12 @@ public DataAccessException translateExceptionIfPossible(RuntimeException e) {
82
82
if (e instanceof PersistenceException ) {
83
83
// Batch exceptions come inside another PersistenceException
84
84
// recursion has a risk of infinite loop so better make another if
85
+ String msg = e .getMessage ();
85
86
if (e .getCause () instanceof PersistenceException ) {
86
87
e = (PersistenceException ) e .getCause ();
88
+ if (msg == null ) {
89
+ msg = e .getMessage ();
90
+ }
87
91
}
88
92
if (e .getCause () instanceof SQLException ) {
89
93
this .initExceptionTranslator ();
@@ -94,7 +98,7 @@ public DataAccessException translateExceptionIfPossible(RuntimeException e) {
94
98
} else if (e .getCause () instanceof TransactionException ) {
95
99
throw (TransactionException ) e .getCause ();
96
100
}
97
- return new MyBatisSystemException (e );
101
+ return new MyBatisSystemException (msg , e );
98
102
}
99
103
return null ;
100
104
}
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2010-2022 the original author or authors.
2
+ * Copyright 2010-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -31,8 +31,8 @@ public class MyBatisSystemException extends UncategorizedDataAccessException {
31
31
32
32
private static final long serialVersionUID = -5284728621670758939L ;
33
33
34
- public MyBatisSystemException (Throwable cause ) {
35
- super (null , cause );
34
+ public MyBatisSystemException (String msg , Throwable cause ) {
35
+ super (msg , cause );
36
36
}
37
37
38
38
}
You can’t perform that action at this time.
0 commit comments