Skip to content

Commit 2277e6f

Browse files
committed
[feature] Log the details of where any error occurs to exist.log so that we can understand and fix it
1 parent 8d310d8 commit 2277e6f

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

services/submit.xql

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,13 @@ return
355355
return
356356
<response status="okay" code="200"><message>{$save} Record {$id} saved, thank you for your contribution. </message></response>
357357
} catch * {
358-
(response:set-status-code( 500 ),
359-
<response status="fail">
360-
<message>Failed to update resource {$id}: {concat($err:code, ": ", $err:description)}</message>
361-
</response>)
358+
(
359+
util:log("ERROR", concat("Failed to update resource: ", $id, ". [", $err:line-number, ":", $err:column-number, "]", $err:module, ": ", $err:code, " ", $err:description)),
360+
response:set-status-code(500),
361+
<response status="fail">
362+
<message>Failed to update resource: {$id}. {concat($err:code, ": ", $err:description)}</message>
363+
</response>
364+
)
362365
}
363366
else if(request:get-parameter('type', '') = 'github') then
364367
try {
@@ -372,11 +375,13 @@ return
372375
</response>
373376
)
374377
} catch * {
375-
(response:set-status-code( 500 ),
376-
<response status="fail">
377-
<message>Failed to submit, please download your changes and send via email. {concat($err:code, ": ", $err:description)}</message>
378-
379-
</response>)
378+
(
379+
util:log("ERROR", concat("Failed to submit, please download your changes and send via email. [", $err:line-number, ":", $err:column-number, "]", $err:module, ": ", $err:code, " ", $err:description)),
380+
response:set-status-code(500),
381+
<response status="fail">
382+
<message>Failed to submit, please download your changes and send via email. {concat($err:code, ": ", $err:description)}</message>
383+
</response>
384+
)
380385
}
381386
else if(request:get-parameter('type', '') = 'download') then
382387
(response:set-header("Content-Type", "application/xml; charset=utf-8"),

0 commit comments

Comments
 (0)