File tree Expand file tree Collapse file tree 5 files changed +25
-15
lines changed Expand file tree Collapse file tree 5 files changed +25
-15
lines changed Original file line number Diff line number Diff line change 33import  *  as  Stdlib_Error  from  "./Stdlib_Error.js" ; 
44import  *  as  Primitive_object  from  "./Primitive_object.js" ; 
55
6- function  $$throw ( prim )  { 
7-   throw  prim ; 
8- } 
9- 
106function  assertEqual ( a ,  b )  { 
117  if  ( ! Primitive_object . notequal ( a ,  b ) )  { 
128    return ; 
@@ -15,7 +11,7 @@ function assertEqual(a, b) {
1511    RE_EXN_ID : "Assert_failure" , 
1612    _1 : [ 
1713      "Stdlib.res" , 
18-       118 , 
14+       134 , 
1915      4 
2016    ] , 
2117    Error : new  Error ( ) 
@@ -158,7 +154,6 @@ export {
158154  $$BigInt64Array , 
159155  $$BigUint64Array , 
160156  panic , 
161-   $$throw , 
162157  assertEqual , 
163158} 
164159/* No side effect */ 
Original file line number Diff line number Diff line change 33let  Stdlib_Error  =  require ( "./Stdlib_Error.js" ) ; 
44let  Primitive_object  =  require ( "./Primitive_object.js" ) ; 
55
6- function  $$throw ( prim )  { 
7-   throw  prim ; 
8- } 
9- 
106function  assertEqual ( a ,  b )  { 
117  if  ( ! Primitive_object . notequal ( a ,  b ) )  { 
128    return ; 
@@ -15,7 +11,7 @@ function assertEqual(a, b) {
1511    RE_EXN_ID : "Assert_failure" , 
1612    _1 : [ 
1713      "Stdlib.res" , 
18-       118 , 
14+       134 , 
1915      4 
2016    ] , 
2117    Error : new  Error ( ) 
@@ -157,6 +153,5 @@ exports.$$Uint8ClampedArray = $$Uint8ClampedArray;
157153exports . $$BigInt64Array  =  $$BigInt64Array ; 
158154exports . $$BigUint64Array  =  $$BigUint64Array ; 
159155exports . panic  =  panic ; 
160- exports . $$throw  =  $$throw ; 
161156exports . assertEqual  =  assertEqual ; 
162157/* No side effect */ 
Original file line number Diff line number Diff line change @@ -12,7 +12,9 @@ external /* Internal */
1212__unsafe_cast : 'a  =>  'b  =  "%identity" 
1313
1414/* Exceptions */ 
15- 
15+ @deprecated (
16+   "`raise` has been renamed to `throw` to align with JavaScript vocabulary. Please use `throw`" 
17+ )
1618external  raise : exn  =>  'a  =  "%raise" 
1719
1820@deprecated ("Use custom exception instead" )
Original file line number Diff line number Diff line change @@ -100,7 +100,23 @@ async function main() {
100100external  import : 'a  =>  promise <'a > =  "%import" 
101101
102102let  panic  =  Error .panic 
103- let  throw  =  Error .throw 
103+ 
104+ /** 
105+ Throw and exception which will stop execution. 
106+ 
107+ ## Examples 
108+ 
109+ ```rescript 
110+ let error = Error.make("Everything is upside down.") 
111+ 
112+ if 5 > 10 { 
113+   error->throw 
114+ } else { 
115+   Console.log("Phew, sanity still rules.") 
116+ } 
117+ ``` 
118+ */ 
119+ external  throw : Error .t  =>  'a  =  "%raise" 
104120
105121/** 
106122`assertEqual(a, b)` check if `a` is equal `b`. If not raise a panic exception 
Original file line number Diff line number Diff line change @@ -155,7 +155,9 @@ if 5 > 10 {
155155} 
156156``` 
157157*/ 
158- @deprecated ("Use `Error.throw` instead." )
158+ @deprecated (
159+   "`raise` has been renamed to `throw` to align with JavaScript vocabulary. Please use `throw`" 
160+ )
159161external  raise : t  =>  'a  =  "%raise" 
160162
161163/** 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments