File tree Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Expand file tree Collapse file tree 3 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -49,6 +49,10 @@ public String getErrorMessage() {
4949 return entity != null ? entity .getErrorMessage () : null ;
5050 }
5151
52+ public String getException () {
53+ return entity != null ? entity .getException () : null ;
54+ }
55+
5256 public int getResponseCode () {
5357 return entity != null ? entity .getCode () : null ;
5458 }
Original file line number Diff line number Diff line change 2727public class ErrorEntity {
2828
2929 private String errorMessage ;
30+ private String exception ;
3031 private int code ;
3132 private int errorNum ;
3233
@@ -41,6 +42,14 @@ public String getErrorMessage() {
4142 return errorMessage ;
4243 }
4344
45+ /**
46+ * @return the exception message, passed when transaction fails
47+ * @return
48+ */
49+ public String getException () {
50+ return exception ;
51+ }
52+
4453 /**
4554 * @return the status code
4655 */
Original file line number Diff line number Diff line change 2828import static org .hamcrest .Matchers .is ;
2929import static org .hamcrest .Matchers .not ;
3030import static org .junit .Assert .assertThat ;
31+ import static org .junit .Assert .assertTrue ;
3132import static org .junit .Assert .fail ;
3233
3334import java .io .IOException ;
@@ -1068,6 +1069,20 @@ public void getDocument() {
10681069 }
10691070 }
10701071
1072+ @ Test
1073+ public void shouldIncludeExceptionMessage () {
1074+ final String exceptionMessage = "My error context" ;
1075+ final String action = "function (params) {"
1076+ + "throw '" + exceptionMessage + "';"
1077+ + "}" ;
1078+ try {
1079+ db .transaction (action , VPackSlice .class , null );
1080+ fail ();
1081+ } catch (final ArangoDBException e ) {
1082+ assertTrue (e .getException ().contains (exceptionMessage ));
1083+ }
1084+ }
1085+
10711086 @ Test (expected = ArangoDBException .class )
10721087 public void getDocumentWrongId () {
10731088 db .getDocument ("123" , BaseDocument .class );
You can’t perform that action at this time.
0 commit comments