Commit 9b92a19f authored by Daniel Espinosa Ortiz's avatar Daniel Espinosa Ortiz

server: fix error handling

parent 82ce17e1
......@@ -167,7 +167,11 @@ public class GVls.GServer : GLib.Object, ContainerHashable, Server
if (root_server != null) {
root_server.add_namespace (so.val);
} else {
add_namespace (so.val);
try {
add_namespace (so.val);
} catch (GLib.Error e) {
message ("Error adding namespace: %s: %s", so.val, e.message);
}
}
}
CodeContext.pop ();
......
......@@ -187,7 +187,7 @@ public interface GVls.Server : GLib.Object, ContainerHashable
public virtual bool add_namespace (string ns) throws GLib.Error {
var nsf = find_namespace_file (ns);
if (nsf == null) {
throw new ServerError.NO_VAPI_DIR_ERROR ("Namespace not found in current VAPI dirs");
throw new ServerError.NO_VAPI_DIR_ERROR ("Namespace not found in current VAPI dirs: %s", ns);
}
var srv = create_pkg_server (nsf);
add_server (srv);
......
......@@ -28,13 +28,13 @@ files_client_parse = files ([
'test-client-parse.vala',
])
tsp = executable('client-parse', files_client_parse,
tcp = executable('client-parse', files_client_parse,
vala_args : [],
dependencies : [ gvls_deps, inc_libh_dep, inc_rooth_dep],
link_with: lib
)
test ('client-parse', tsp,
test ('client-parse', tcp,
env: [
'BUILD_DIR='+meson.current_build_dir(),
'SRC_DIR='+join_paths(meson.source_root (), 'tests')
......@@ -64,13 +64,13 @@ files_server_performance_servers = files ([
'test-server-performance-servers.vala',
])
tsp = executable('server-performance-servers', files_server_performance_servers,
tsprp = executable('server-performance-servers', files_server_performance_servers,
vala_args : [],
dependencies : [ gvls_deps, inc_libh_dep, inc_rooth_dep],
link_with: lib
)
benchmark ('server-performance-servers', tsp,
benchmark ('server-performance-servers', tsprp,
env: [
'BUILD_DIR='+meson.current_build_dir(),
'SRC_DIR='+join_paths(meson.source_root (), 'tests')
......
using Gtk;
using Cairo;
/**
*
*/
......
......@@ -308,10 +308,9 @@ class Tests {
Server server3 = new GServer () as Server;
try {
server3.parse (file2);
assert (server3.servers.get_n_items () == 0);
server3.add_using_namespaces ();
message ("Servers: %u", server3.servers.get_n_items ());
assert (server3.servers.get_n_items () == 1);
assert (server3.get_symbol ("Gtk") != null);
assert (server3.get_symbol ("Cairo") != null);
server1.parse (file1);
server2.parse (file2);
server.add_server (server1);
......@@ -321,7 +320,7 @@ class Tests {
assert (server.servers.get_n_items () == 4);
assert (server.get_symbol ("string") != null);
assert (server.get_symbol ("string.replace") != null);
assert (server.get_symbol ("Gtk") != null);
assert (server.get_symbol ("Cairo") != null);
} catch (GLib.Error e) {
message ("Error: %s", e.message);
assert_not_reached ();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment