File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,11 +54,22 @@ namespace tns
5454 {
5555 SET_PROFILER_FRAME ();
5656
57- ASSERT_MESSAGE (args.Length () == 2 , " require should be called with two parameters" );
58- ASSERT_MESSAGE (!args[0 ]->IsUndefined () && !args[0 ]->IsNull (), " require called with undefined moduleName parameter" );
59- ASSERT_MESSAGE (!args[1 ]->IsUndefined () && !args[1 ]->IsNull (), " require called with undefined callingModulePath parameter" );
60- ASSERT_MESSAGE (args[0 ]->IsString (), " require should be called with string parameter" );
61- ASSERT_MESSAGE (args[1 ]->IsString (), " require should be called with string parameter" );
57+ auto isolate = Isolate::GetCurrent ();
58+ if (args.Length () != 2 )
59+ {
60+ isolate->ThrowException (ConvertToV8String (" require should be called with two parameters" ));
61+ return ;
62+ }
63+ if (!args[0 ]->IsString ())
64+ {
65+ isolate->ThrowException (ConvertToV8String (" require's first parameter should be string" ));
66+ return ;
67+ }
68+ if (!args[1 ]->IsString ())
69+ {
70+ isolate->ThrowException (ConvertToV8String (" require's second parameter should be string" ));
71+ return ;
72+ }
6273
6374 string moduleName = ConvertToString (args[0 ].As <String>());
6475 string callingModuleDirName = ConvertToString (args[1 ].As <String>());
@@ -100,7 +111,7 @@ namespace tns
100111 }
101112 else
102113 {
103- moduleObj = Local<Object>::New (Isolate::GetCurrent () , *((*it).second ));
114+ moduleObj = Local<Object>::New (isolate , *((*it).second ));
104115 }
105116
106117 if (!hasError){
Original file line number Diff line number Diff line change 1616import java .util .HashMap ;
1717import java .util .HashSet ;
1818
19- import org .json .JSONObject ;
20-
2119import android .util .SparseArray ;
2220
2321import com .tns .bindings .ProxyGenerator ;
You can’t perform that action at this time.
0 commit comments