@@ -1127,12 +1127,11 @@ public static IRubyObject decode(final ThreadContext context,
1127
1127
return decodeImpl (context , (RubyModule ) self , obj );
1128
1128
}
1129
1129
catch (IOException e ) {
1130
- //throw context.runtime.newIOErrorFromException(e);
1131
- throw newASN1Error (context .runtime , e .getMessage ());
1130
+ throw newASN1Error (context .runtime , e );
1132
1131
}
1133
1132
catch (IllegalArgumentException e ) {
1134
1133
debugStackTrace (context .runtime , e );
1135
- throw context .runtime .newArgumentError (e .getMessage ());
1134
+ throw ( RaiseException ) context .runtime .newArgumentError (e .getMessage ()). initCause ( e );
1136
1135
}
1137
1136
catch (RuntimeException e ) {
1138
1137
@@ -1212,8 +1211,7 @@ public static IRubyObject decode_all(final ThreadContext context,
1212
1211
arr .append ( decodeImpl (context , ASN1 , in ) );
1213
1212
}
1214
1213
catch (IOException e ) {
1215
- //throw context.runtime.newIOErrorFromException(e);
1216
- throw newASN1Error (context .runtime , e .getMessage ());
1214
+ throw newASN1Error (context .runtime , e );
1217
1215
}
1218
1216
catch (IllegalArgumentException e ) {
1219
1217
debugStackTrace (context .runtime , e );
@@ -1233,6 +1231,10 @@ public static RaiseException newASN1Error(Ruby runtime, String message) {
1233
1231
return Utils .newError (runtime , _ASN1 (runtime ).getClass ("ASN1Error" ), message , false );
1234
1232
}
1235
1233
1234
+ static RaiseException newASN1Error (Ruby runtime , Throwable ex ) {
1235
+ return (RaiseException ) newASN1Error (runtime , ex .getMessage ()).initCause (ex );
1236
+ }
1237
+
1236
1238
static RubyModule _ASN1 (final Ruby runtime ) {
1237
1239
return (RubyModule ) runtime .getModule ("OpenSSL" ).getConstant ("ASN1" );
1238
1240
}
0 commit comments