File tree 3 files changed +28
-0
lines changed
3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,10 @@ public String getErrorMessage() {
49
49
return entity != null ? entity .getErrorMessage () : null ;
50
50
}
51
51
52
+ public String getException () {
53
+ return entity != null ? entity .getException () : null ;
54
+ }
55
+
52
56
public int getResponseCode () {
53
57
return entity != null ? entity .getCode () : null ;
54
58
}
Original file line number Diff line number Diff line change 27
27
public class ErrorEntity {
28
28
29
29
private String errorMessage ;
30
+ private String exception ;
30
31
private int code ;
31
32
private int errorNum ;
32
33
@@ -41,6 +42,14 @@ public String getErrorMessage() {
41
42
return errorMessage ;
42
43
}
43
44
45
+ /**
46
+ * @return the exception message, passed when transaction fails
47
+ * @return
48
+ */
49
+ public String getException () {
50
+ return exception ;
51
+ }
52
+
44
53
/**
45
54
* @return the status code
46
55
*/
Original file line number Diff line number Diff line change 28
28
import static org .hamcrest .Matchers .is ;
29
29
import static org .hamcrest .Matchers .not ;
30
30
import static org .junit .Assert .assertThat ;
31
+ import static org .junit .Assert .assertTrue ;
31
32
import static org .junit .Assert .fail ;
32
33
33
34
import java .io .IOException ;
@@ -1060,6 +1061,20 @@ public void getDocument() {
1060
1061
}
1061
1062
}
1062
1063
1064
+ @ Test
1065
+ public void shouldIncludeExceptionMessage () {
1066
+ final String exceptionMessage = "My error context" ;
1067
+ final String action = "function (params) {"
1068
+ + "throw '" + exceptionMessage + "';"
1069
+ + "}" ;
1070
+ try {
1071
+ db .transaction (action , VPackSlice .class , null );
1072
+ fail ();
1073
+ } catch (final ArangoDBException e ) {
1074
+ assertTrue (e .getException ().contains (exceptionMessage ));
1075
+ }
1076
+ }
1077
+
1063
1078
@ Test (expected = ArangoDBException .class )
1064
1079
public void getDocumentWrongId () {
1065
1080
db .getDocument ("123" , BaseDocument .class );
You can’t perform that action at this time.
0 commit comments