File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -110,7 +110,8 @@ static void checkRc(final int rc) throws LmdbNativeException {
110110 if (constant == null ) {
111111 throw new IllegalArgumentException ("Unknown result code " + rc );
112112 }
113- throw new LmdbNativeException .ConstantDerviedException (rc , constant .name ());
113+ final String msg = constant .name () + " " + constant .toString ();
114+ throw new LmdbNativeException .ConstantDerviedException (rc , msg );
114115 }
115116
116117}
Original file line number Diff line number Diff line change 2323import static java .lang .Integer .MAX_VALUE ;
2424import java .util .HashSet ;
2525import java .util .Set ;
26+ import static org .hamcrest .CoreMatchers .containsString ;
2627import static org .hamcrest .CoreMatchers .is ;
2728import static org .hamcrest .CoreMatchers .notNullValue ;
2829import static org .hamcrest .MatcherAssert .assertThat ;
@@ -107,6 +108,16 @@ public void checkErrConstantDerived() {
107108 checkRc (20 );
108109 }
109110
111+ @ Test
112+ public void checkErrConstantDerivedMessage () {
113+ try {
114+ checkRc (2 );
115+ fail ("Should have raised exception" );
116+ } catch (final ConstantDerviedException ex ) {
117+ assertThat (ex .getMessage (), containsString ("No such file or directory" ));
118+ }
119+ }
120+
110121 @ Test (expected = FullException .class )
111122 public void checkErrCursorFull () {
112123 checkRc (MDB_CURSOR_FULL );
You can’t perform that action at this time.
0 commit comments