File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
src/javascript/lib/core/erlang_compat Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 11defmodule ElixirScript.Test.Assertions do
22 def assert ( value ) do
33 if ! value do
4- ElixirScript.JS . throw ( % ElixirScript.Test.AssertionError {
5- message: "failed"
6- } )
4+ raise ElixirScript.Test.AssertionError , message: "failed"
75 end
86 end
97end
Original file line number Diff line number Diff line change @@ -478,19 +478,25 @@ function _throw(term) {
478478}
479479
480480function error ( reason ) {
481+ let theError = null ;
482+
481483 if ( reason instanceof Map && reason . has ( Symbol . for ( '__exception__' ) ) ) {
482484 let name = Symbol . keyFor ( reason . get ( Symbol . for ( '__struct__' ) ) . __MODULE__ ) ;
483485 name = name
484486 . split ( '.' )
485487 . slice ( 1 )
486488 . join ( '.' ) ;
487489 const message = reason . get ( Symbol . for ( 'message' ) ) ;
488- throw new Error ( `** (${ name } ) ${ message } ` ) ;
490+ theError = new Error ( `** (${ name } ) ${ message } ` ) ;
489491 } else if ( is_binary ( reason ) ) {
490- throw new Error ( `** (RuntimeError) ${ reason } ` ) ;
492+ theError = new Error ( `** (RuntimeError) ${ reason } ` ) ;
491493 } else {
492- throw new Error ( `** (ErlangError) Erlang Error ${ reason . toString ( ) } ` ) ;
494+ theError = new Error ( `** (ErlangError) Erlang Error ${ reason . toString ( ) } ` ) ;
493495 }
496+
497+ theError . __reason = reason ;
498+
499+ throw theError ;
494500}
495501
496502function exit ( ...args ) {
You can’t perform that action at this time.
0 commit comments