summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2014-12-17 14:43:50 +0000
committerDaniel Kolesa <d.kolesa@samsung.com>2014-12-17 14:44:12 +0000
commit208ad62d3cb184688f10198ce42c35cbd3489d90 (patch)
treee35d1389a294d3b3710f0a78606da3b561e98d31 /src/lib
parentc8a993d1f77087750518a2684b151870f5e76651 (diff)
elua: error reporting in the library
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/elua/Elua.h2
-rw-r--r--src/lib/elua/elua.c18
2 files changed, 20 insertions, 0 deletions
diff --git a/src/lib/elua/Elua.h b/src/lib/elua/Elua.h
index 80a8a894a4..8df01de3cc 100644
--- a/src/lib/elua/Elua.h
+++ b/src/lib/elua/Elua.h
@@ -61,6 +61,8 @@ extern "C" {
61EAPI int elua_init(void); 61EAPI int elua_init(void);
62EAPI int elua_shutdown(void); 62EAPI int elua_shutdown(void);
63 63
64EAPI int elua_report_error(lua_State *L, const char *pname, int status);
65
64EAPI void elua_state_setup_i18n(lua_State *L); 66EAPI void elua_state_setup_i18n(lua_State *L);
65 67
66EAPI int elua_io_popen(lua_State *L); 68EAPI int elua_io_popen(lua_State *L);
diff --git a/src/lib/elua/elua.c b/src/lib/elua/elua.c
index f4411ae1e9..2f88e7be02 100644
--- a/src/lib/elua/elua.c
+++ b/src/lib/elua/elua.c
@@ -62,6 +62,24 @@ elua_shutdown(void)
62 return _elua_init_counter; 62 return _elua_init_counter;
63} 63}
64 64
65static void
66_elua_errmsg(const char *pname, const char *msg)
67{
68 ERR("%s%s%s", pname ? pname : "", pname ? ": " : "", msg);
69}
70
71EAPI int
72elua_report_error(lua_State *L, const char *pname, int status)
73{
74 if (status && !lua_isnil(L, -1))
75 {
76 const char *msg = lua_tostring(L, -1);
77 _elua_errmsg(pname, msg ? msg : "(non-string error)");
78 lua_pop(L, 1);
79 }
80 return status;
81}
82
65static int 83static int
66_elua_gettext_bind_textdomain(lua_State *L) 84_elua_gettext_bind_textdomain(lua_State *L)
67{ 85{