@@ -113,6 +113,14 @@ function caml_raise_constant (tag) { throw [0, tag]; }
113113//Version: >= 4.02
114114function caml_raise_constant ( tag ) { throw tag ; }
115115
116+ //Provides: caml_return_exn_constant (const)
117+ //Version: < 4.02
118+ function caml_return_exn_constant ( tag ) { return [ 0 , tag ] ; }
119+
120+ //Provides: caml_return_exn_constant (const)
121+ //Version: >= 4.02
122+ function caml_return_exn_constant ( tag ) { return tag ; }
123+
116124//Provides: caml_raise_with_arg (const, const)
117125function caml_raise_with_arg ( tag , arg ) { throw [ 0 , tag , arg ] ; }
118126
@@ -133,22 +141,24 @@ function caml_raise_sys_error (msg) {
133141function caml_failwith ( msg ) {
134142 caml_raise_with_string ( caml_global_data . Failure , msg ) ;
135143}
144+
136145//Provides: caml_wrap_exception const (const)
137146//Requires: caml_global_data,caml_js_to_string,caml_named_value
147+ //Requires: caml_return_exn_constant
138148function caml_wrap_exception ( e ) {
139149 if ( e instanceof Array ) return e ;
140150 //Stack_overflow: chrome, safari
141151 if ( joo_global_object . RangeError
142152 && e instanceof joo_global_object . RangeError
143153 && e . message
144154 && e . message . match ( / m a x i m u m c a l l s t a c k / i) )
145- return [ 0 , caml_global_data . Stack_overflow ] ;
155+ return caml_return_exn_constant ( caml_global_data . Stack_overflow ) ;
146156 //Stack_overflow: firefox
147157 if ( joo_global_object . InternalError
148158 && e instanceof joo_global_object . InternalError
149159 && e . message
150160 && e . message . match ( / t o o m u c h r e c u r s i o n / i) )
151- return [ 0 , caml_global_data . Stack_overflow ] ;
161+ return caml_return_exn_constant ( caml_global_data . Stack_overflow ) ;
152162 //Wrap Error in Js.Error exception
153163 if ( e instanceof joo_global_object . Error )
154164 return [ 0 , caml_named_value ( "jsError" ) , e ] ;
0 commit comments