diff options
author | Adam Chlipala <adam@chlipala.net> | 2011-07-03 12:40:00 -0400 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2011-07-03 12:40:00 -0400 |
commit | 3311911fd21e0c240788d83ff6da710dbbbc66e8 (patch) | |
tree | 57875f0e93a279eeaac3f66eac6372405cdf4b60 /src | |
parent | dd592cc205438ef4a46f7103d0fc7113e376d358 (diff) |
For non-debug builds, leave out source location info in what is shown to user
Diffstat (limited to 'src')
-rw-r--r-- | src/c/urweb.c | 10 | ||||
-rw-r--r-- | src/cjr_print.sml | 5 | ||||
-rw-r--r-- | src/compiler.sml | 3 |
3 files changed, 17 insertions, 1 deletions
diff --git a/src/c/urweb.c b/src/c/urweb.c index b653390a..e38cd072 100644 --- a/src/c/urweb.c +++ b/src/c/urweb.c @@ -3894,3 +3894,13 @@ failure_kind uw_begin_onError(uw_context ctx, char *msg) { void uw_mayReturnIndirectly(uw_context ctx) { ctx->allowed_to_return_indirectly = 1; } + +void uw_cutErrorLocation(char *s) { + char *s2; + + s2 = strstr(s, ": "); + if (s2 == NULL || strcspn(s, "<&") < s2 - s) + return; + + memmove(s, s2+2, strlen(s2+2)+1); +} diff --git a/src/cjr_print.sml b/src/cjr_print.sml index 9b747bcb..79d7e7da 100644 --- a/src/cjr_print.sml +++ b/src/cjr_print.sml @@ -3112,6 +3112,11 @@ fun p_file env (ds, ps) = NONE => box [] | SOME n => box [string "static void uw_onError(uw_context ctx, char *msg) {", newline, + if Settings.getDebug () then + box [] + else + box [string "uw_cutErrorLocation(msg);", + newline], box [string "uw_write(ctx, ", p_enamed env n, string "(ctx, msg, 0));", diff --git a/src/compiler.sml b/src/compiler.sml index 229b40ff..d4f34021 100644 --- a/src/compiler.sml +++ b/src/compiler.sml @@ -324,7 +324,8 @@ fun capitalize "" = "" | capitalize s = str (Char.toUpper (String.sub (s, 0))) ^ String.extract (s, 1, NONE) fun institutionalizeJob (job : job) = - (Settings.setUrlPrefix (#prefix job); + (Settings.setDebug (#debug job); + Settings.setUrlPrefix (#prefix job); Settings.setTimeout (#timeout job); Settings.setHeaders (#headers job); Settings.setScripts (#scripts job); |