[gjs/wip/ptomato/jasper-imports: 3/6] native: Return NULL if the module isn't registered



commit 97b1d77952582d12387f5b68795a196a7130492f
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Jan 2 17:52:57 2014 -0500

    native: Return NULL if the module isn't registered
    
    This can't ever happen in practice, since existing callers check
    gjs_is_registered_native_module, but with our new loader, it's a
    bit more convenient to simply check against NULL rather than have
    to do a precheck or catch an exception first.

 gjs/native.cpp |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/gjs/native.cpp b/gjs/native.cpp
index a9ded6e..4908f75 100644
--- a/gjs/native.cpp
+++ b/gjs/native.cpp
@@ -98,10 +98,8 @@ gjs_import_native_module(JSContext              *context,
         func = NULL;
 
     if (!func) {
-        gjs_throw(context,
-                  "No native module '%s' has registered itself",
-                  name);
-        return false;
+        module_out.set(NULL);
+        return true;
     }
 
     return func (context, module_out);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]