Changeset: 183ba77e0604 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=183ba77e0604 Modified Files: clients/Tests/exports.stable.out monetdb5/mal/mal.c monetdb5/mal/mal_exception.c monetdb5/mal/mal_exception.h Branch: default Log Message:
The server does not have a console to safely deliver exceptions anymore. They are now redirecto towards the system log. diffs (148 lines): diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -2137,7 +2137,6 @@ str drop_triggerRef; str drop_typeRef; str drop_userRef; str drop_viewRef; -void dumpExceptionsToStream(stream *out, str msg); void dumpModules(stream *out); str emptybindRef; str emptybindidxRef; @@ -2576,13 +2575,11 @@ void setprofilerlimit(int limit); str shortStmtRendering(MalBlkPtr mb, MalStkPtr stl, InstrPtr p); void showAllScenarios(stream *f); void showCurrentScenario(void); -void showException(stream *out, enum malexception, const char *, _In_z_ _Printf_format_string_ const char *, ...) __attribute__((__format__(__printf__, 4, 5))); void showMalBlkHistory(stream *out, MalBlkPtr mb); void showOptimizerHistory(void); void showOptimizerStep(str fnme, int i, int flg); void showScenario(stream *f, Scenario s); void showScenarioByName(stream *f, str s); -void showScriptException(stream *out, MalBlkPtr, int, enum malexception, _In_z_ _Printf_format_string_ const char *, ...) __attribute__((__format__(__printf__, 5, 6))); str shutdownFactory(Client cntxt, MalBlkPtr mb); str shutdownFactoryByName(Client cntxt, Module m, str nme); str singleRef; diff --git a/monetdb5/mal/mal.c b/monetdb5/mal/mal.c --- a/monetdb5/mal/mal.c +++ b/monetdb5/mal/mal.c @@ -79,7 +79,7 @@ int mal_init(void){ #ifndef NDEBUG mdbExit(); #endif - dumpExceptionsToStream(NULL, err); + fprintf(stderr, "%s", err); freeException(err); return -1; } diff --git a/monetdb5/mal/mal_exception.c b/monetdb5/mal/mal_exception.c --- a/monetdb5/mal/mal_exception.c +++ b/monetdb5/mal/mal_exception.c @@ -146,59 +146,6 @@ freeException(str msg) GDKfree(msg); } -/** - * Internal helper function to properly emit the given string to out, - * thereby abiding to all the protocol laws. - */ -void -dumpExceptionsToStream(stream *out, str whatever) { - size_t i; - size_t last = 0; - size_t len ; - - if (whatever == NULL) - return; - len = strlen(whatever); - /* make sure each line starts with a ! */ - for (i = 0; i < len; i++) { - if (whatever[i] == '\n') { - whatever[i] = '\0'; - if (i - last > 0) { /* skip empty lines */ - if (whatever[last] == '!') /* no need for double ! */ - last++; - if (out) - mnstr_printf(out, "!%s\n", whatever + last); - else - fprintf(stderr, "!%s\n", whatever + last); - } - last = i + 1; - } - } - /* flush last part */ - if (i - last > 0) { /* skip if empty */ - if (out) - mnstr_printf(out, "!%s\n", whatever + last); - else - fprintf(stderr, "!%s\n", whatever + last); - } -} - -/** - * Dump an error message using the exception structure - */ -void -showException(stream *out, enum malexception type, const char *fcn, const char *format, ...) -{ - va_list ap; - str msg; - - va_start(ap, format); - msg = createExceptionInternal(type, fcn, format, ap); - va_end(ap); - - dumpExceptionsToStream(out, msg); - freeException(msg); -} /** * Internal helper function for createMalException and @@ -269,24 +216,6 @@ createMalException(MalBlkPtr mb, int pc, } /** - * Sends the exception as generated by a call to - * createMalException(mb, pc, type, NULL, format, ...) to a stream - */ -void -showScriptException(stream *out, MalBlkPtr mb, int pc, enum malexception type, const char *format, ...) -{ - va_list ap; - str msg; - - va_start(ap, format); - msg = createMalExceptionInternal(mb, pc, type, NULL, format, ap); - va_end(ap); - - dumpExceptionsToStream(out,msg); - freeException(msg); -} - -/** * Returns the malexception number for the given exception string. If no * exception could be found in the string, MAL is returned indicating a * generic MALException. diff --git a/monetdb5/mal/mal_exception.h b/monetdb5/mal/mal_exception.h --- a/monetdb5/mal/mal_exception.h +++ b/monetdb5/mal/mal_exception.h @@ -51,19 +51,12 @@ mal_export str createMalException(MalBlk _In_z_ _Printf_format_string_ const char *, ...) __attribute__((__format__(__printf__, 4, 5))) __attribute__((__returns_nonnull__)); -mal_export void showException(stream *out, enum malexception, const char *, - _In_z_ _Printf_format_string_ const char *, ...) - __attribute__((__format__(__printf__, 4, 5))); -mal_export void showScriptException(stream *out, MalBlkPtr, int, enum malexception, - _In_z_ _Printf_format_string_ const char *, ...) - __attribute__((__format__(__printf__, 5, 6))); mal_export int isExceptionVariable(str nme); mal_export enum malexception getExceptionType(const char *); mal_export str getExceptionPlace(const char *); mal_export str getExceptionMessageAndState(const char *); mal_export str getExceptionMessage(const char *); -mal_export void dumpExceptionsToStream(stream *out, str msg); mal_export void freeException(str); #include "mal_errors.h" _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list