From cd10c3eea07968673a21361726b278eff4f8c8ac Mon Sep 17 00:00:00 2001 From: sergey-miryanov Date: Thu, 11 Feb 2010 14:41:55 +0500 Subject: [PATCH] Improve error diagnostic in driver init --- configure | 1 + configure.ac | 1 + src/sqlite3.erl | 4 ++-- test.erl | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 6815e09..ca09cdb 100755 --- a/configure +++ b/configure @@ -1803,6 +1803,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu #AC_CONFIG_HEADERS([config.h]) +#AC_CANONICAL_TARGET # Checks for programs. ac_ext=c diff --git a/configure.ac b/configure.ac index 2f4dbc1..9f13bd5 100644 --- a/configure.ac +++ b/configure.ac @@ -5,6 +5,7 @@ AC_PREREQ([2.63]) AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS]) AC_CONFIG_SRCDIR([priv/erl_comm.c]) #AC_CONFIG_HEADERS([config.h]) +#AC_CANONICAL_TARGET # Checks for programs. AC_PROG_CC diff --git a/src/sqlite3.erl b/src/sqlite3.erl index c27348e..00dfdf0 100644 --- a/src/sqlite3.erl +++ b/src/sqlite3.erl @@ -396,8 +396,8 @@ init(Options) -> Port = open_port({spawn, string:join ([atom_to_list (?DRIVER_NAME), Dbase], " ")}, [binary]), {ok, #state{port = Port, ops = Options}}; {error, Error} -> - io:format("Error loading ~p: ~p", [?DRIVER_NAME, erl_ddll:format_error(Error)]), - {stop, failed} + Msg = io_lib:format("Error loading ~p: ~p", [?DRIVER_NAME, erl_ddll:format_error(Error)]), + {stop, lists:flatten (Msg)} end. %%-------------------------------------------------------------------- diff --git a/test.erl b/test.erl index ab3a5c9..e40db3e 100755 --- a/test.erl +++ b/test.erl @@ -1,5 +1,5 @@ #!/usr/bin/env escript -%%! -smp enable -pa ebin -name testsqlite3 +%%! -smp enable -pa ebin -sname testsqlite3 -record(user, {name, age, wage}). @@ -27,4 +27,4 @@ main(_) -> catch Class:Error -> io:format("~p:~p:~p~n", [Class, Error, erlang:get_stacktrace()]) - end. \ No newline at end of file + end.