[gjs: 36/45] [cairo] Improve error messages



commit c44520102892fdf6f62c31c46cb9ab259ad030f9
Author: Johan Dahlin <johan gnome org>
Date:   Tue Mar 2 14:32:45 2010 -0300

    [cairo] Improve error messages

 modules/cairo-image-surface.c   |    2 +-
 modules/cairo-pattern.c         |    2 +-
 modules/cairo-solid-pattern.c   |    2 +-
 modules/cairo-surface-pattern.c |    6 +++---
 modules/cairo-surface.c         |    2 +-
 modules/cairo.c                 |    5 +++--
 6 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/modules/cairo-image-surface.c b/modules/cairo-image-surface.c
index f746605..800f0dc 100644
--- a/modules/cairo-image-surface.c
+++ b/modules/cairo-image-surface.c
@@ -141,5 +141,5 @@ gjs_cairo_image_surface_init(JSContext *context, JSObject *module_obj)
                            "createFromPNG",
                            createFromPNG_func,
                            1, GJS_MODULE_PROP_FLAGS))
-        return JS_FALSE;
+        return;
 }
diff --git a/modules/cairo-pattern.c b/modules/cairo-pattern.c
index 2382fa3..2d719e0 100644
--- a/modules/cairo-pattern.c
+++ b/modules/cairo-pattern.c
@@ -67,7 +67,7 @@ getType_func(JSContext *context,
     cairo_pattern_type_t type;
 
     if (argc > 1) {
-        gjs_throw(context, "FIXME");
+        gjs_throw(context, "Pattern.getType() takes no arguments");
         return JS_FALSE;
     }
 
diff --git a/modules/cairo-solid-pattern.c b/modules/cairo-solid-pattern.c
index b5e68c9..313627a 100644
--- a/modules/cairo-solid-pattern.c
+++ b/modules/cairo-solid-pattern.c
@@ -116,7 +116,7 @@ gjs_cairo_solid_pattern_from_pattern(JSContext       *context,
 
     object = JS_NewObject(context, &gjs_cairo_solid_pattern_class, NULL, NULL);
     if (!object) {
-        gjs_throw(context, "failed to create linear gradient pattern");
+        gjs_throw(context, "failed to create solid pattern");
         return NULL;
     }
 
diff --git a/modules/cairo-surface-pattern.c b/modules/cairo-surface-pattern.c
index f9c9df7..b34d066 100644
--- a/modules/cairo-surface-pattern.c
+++ b/modules/cairo-surface-pattern.c
@@ -110,7 +110,7 @@ getExtend_func(JSContext *context,
     cairo_pattern_t *pattern;
 
     if (argc > 0) {
-        gjs_throw(context, "Context.getExtend() requires no arguments");
+        gjs_throw(context, "SurfacePattern.getExtend() requires no arguments");
         return JS_FALSE;
     }
 
@@ -159,7 +159,7 @@ getFilter_func(JSContext *context,
     cairo_pattern_t *pattern;
 
     if (argc > 0) {
-        gjs_throw(context, "Context.getFilter() requires no arguments");
+        gjs_throw(context, "SurfacePattern.getFilter() requires no arguments");
         return JS_FALSE;
     }
 
@@ -194,7 +194,7 @@ gjs_cairo_surface_pattern_from_pattern(JSContext       *context,
 
     object = JS_NewObject(context, &gjs_cairo_surface_pattern_class, NULL, NULL);
     if (!object) {
-        gjs_throw(context, "failed to create linear gradient pattern");
+        gjs_throw(context, "failed to create surface pattern");
         return NULL;
     }
 
diff --git a/modules/cairo-surface.c b/modules/cairo-surface.c
index 445d2a2..2b5fd80 100644
--- a/modules/cairo-surface.c
+++ b/modules/cairo-surface.c
@@ -90,7 +90,7 @@ getType_func(JSContext *context,
     cairo_surface_type_t type;
 
     if (argc > 1) {
-        gjs_throw(context, "FIXME");
+        gjs_throw(context, "Surface.getType() takes no arguments");
         return JS_FALSE;
     }
 
diff --git a/modules/cairo.c b/modules/cairo.c
index dab35cb..f5c916a 100644
--- a/modules/cairo.c
+++ b/modules/cairo.c
@@ -32,9 +32,10 @@ gjs_cairo_check_status(JSContext      *context,
                        const char     *name)
 {
     if (status != CAIRO_STATUS_SUCCESS) {
-        gjs_throw(context, "Could not create %s: %s",
+        gjs_throw(context, "cairo error on %s: \"%s\" (%d)",
                   name,
-                  cairo_status_to_string(status));
+                  cairo_status_to_string(status),
+                  status);
         return JS_FALSE;
     }
 



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