seed r53 - in trunk: . libseed
- From: racarr svn gnome org
- To: svn-commits-list gnome org
- Subject: seed r53 - in trunk: . libseed
- Date: Sun, 2 Nov 2008 06:12:38 +0000 (UTC)
Author: racarr
Date: Sun Nov 2 06:12:38 2008
New Revision: 53
URL: http://svn.gnome.org/viewvc/seed?rev=53&view=rev
Log:
Patch from Matt: Add line numbers and filenames to exceptions.
Modified:
trunk/libseed/seed-engine.c
trunk/libseed/seed.h
trunk/main.c
Modified: trunk/libseed/seed-engine.c
==============================================================================
--- trunk/libseed/seed-engine.c (original)
+++ trunk/libseed/seed-engine.c Sun Nov 2 06:12:38 2008
@@ -906,3 +906,24 @@
name = seed_value_get_property(e, "message");
return seed_value_to_string(name);
}
+
+guint seed_exception_get_line(JSValueRef e)
+{
+ SeedValue line;
+ g_assert((e));
+ if (!JSValueIsObject(eng->context, e))
+ return 0;
+ line = seed_value_get_property(e, "line");
+ return seed_value_to_uint(line);
+}
+
+gchar * seed_exception_get_file(JSValueRef e)
+{
+ SeedValue file;
+ g_assert((e));
+ if (!JSValueIsObject(eng->context, e))
+ return 0;
+ file = seed_value_get_property(e, "sourceURL");
+ return seed_value_to_string(file);
+}
+
Modified: trunk/libseed/seed.h
==============================================================================
--- trunk/libseed/seed.h (original)
+++ trunk/libseed/seed.h Sun Nov 2 06:12:38 2008
@@ -38,6 +38,8 @@
SeedException seed_make_exception(gchar * name, gchar * message);
gchar * seed_exception_get_name(SeedException e);
gchar * seed_exception_get_message(SeedException e);
+guint seed_exception_get_line(SeedException e);
+gchar * seed_exception_get_file(SeedException e);
SeedValue seed_evaluate(SeedScript *s, SeedObject this);
Modified: trunk/main.c
==============================================================================
--- trunk/main.c (original)
+++ trunk/main.c Sun Nov 2 06:12:38 2008
@@ -52,16 +52,20 @@
buffer++;
buffer++;
}
- script = seed_make_script(buffer, argv[1], 0);
+ script = seed_make_script(buffer, argv[1], 1);
if (e =seed_script_exception(script))
- g_critical("%s. %s",
+ g_critical("%s. %s in %s at line %d",
seed_exception_get_name(e),
- seed_exception_get_message(e));
+ seed_exception_get_message(e),
+ seed_exception_get_file(e),
+ seed_exception_get_line(e));
seed_evaluate(script, 0);
if (e = seed_script_exception(script))
- g_critical("%s. %s",
+ g_critical("%s. %s in %s at line %d",
seed_exception_get_name(e),
- seed_exception_get_message(e));
+ seed_exception_get_message(e),
+ seed_exception_get_file(e),
+ seed_exception_get_line(e));
g_free(script);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]