Skip to content

Commit

Permalink
Improve logging when loading extra code, see #245.
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitri committed Jun 11, 2015
1 parent ff5b596 commit 322f7dd
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/main.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@
:test #'string=)
(error "Unknown lisp file extension: ~s" (pathname-type pathname)))

(log-message :info "Loading code from ~s" pathname)
(load (compile-file pathname :verbose nil :print nil))))

(defun main (argv)
Expand Down Expand Up @@ -256,17 +257,6 @@
(uiop:quit +os-code-error+))))
(uiop:quit +os-code-success+))

(when load
(loop for filename in load do
(handler-case
(load-extra-transformation-functions filename)
(condition (e)
(format *standard-output*
"Failed to load lisp source file ~s~%"
filename)
(format *standard-output* "~a~%" e)
(uiop:quit +os-code-error+)))))

;; Now process the arguments
(when arguments
;; Start the logs system
Expand All @@ -278,6 +268,18 @@
(log-message :log "Main logs in '~a'" (probe-file *log-filename*))
(log-message :log "Data errors in '~a'~%" *root-dir*)

;; load extra lisp code provided for by the user
(when load
(loop for filename in load do
(handler-case
(load-extra-transformation-functions filename)
(condition (e)
(log-message :fatal
"Failed to load lisp source file ~s~%"
filename)
(log-message :error "~a" e)
(uiop:quit +os-code-error+)))))

(handler-case
;; The handler-case is to catch unhandled exceptions at the
;; top level.
Expand Down

0 comments on commit 322f7dd

Please sign in to comment.