d7c32efc750fb6a7612263c5dc76b7b267750a28 — nytpu 2 months ago 380d377
better error printing
1 files changed, 7 insertions(+), 7 deletions(-)

M src/gtf.lisp
M src/gtf.lisp => src/gtf.lisp +7 -7
@@ 43,20 43,20 @@ size.")

    (assert (typep (cdr (assoc :text-type-params config)) 'string)
            "Invald MIME type parameters:: ~a" (cdr (assoc :text-type-params config)))
            "Invald MIME type parameters: ~s" (cdr (assoc :text-type-params config)))
    (let ((index-name (assoc :index-name config)))
      (typecase (cdr index-name)
        (string (setf (cdr index-name) (uiop:parse-unix-namestring (cdr index-name))))
        (pathname nil)
        (t (error "Invalid index name: ~a" (cdr index-name)))))
        (t (error "Invalid index name: ~s" (cdr index-name)))))
    (assert (<= 10 (cdr (assoc :error-code config)) 62)
            "Invald response status code: ~a" (cdr (assoc :error-code config)))
            "Invald response status code: ~s" (cdr (assoc :error-code config)))
    (let ((error-meta (cdr (assoc :error-meta config))))
      (assert (and (typep error-meta 'string)
                   (<= (length error-meta) 1024))
              "Invalid response error meta: ~a" error-meta))
              "Invalid response error meta: ~s" error-meta))


@@ 66,7 66,7 @@ size.")
            for name = (if (listp item) (cadr item) item)
            for parsed-name = (uiop:parse-unix-namestring name :ensure-directory t)
            unless (uiop:directory-exists-p parsed-name)
            do (error "Root directory doesn't exist: ~a" name)
            do (error "Root directory doesn't exist: ~s" name)
            collect (cons kind name)))))

@@ 96,7 96,7 @@ size.")

    (let ((protocol (cl-fastcgi:fcgx-getparam req "SERVER_PROTOCOL")))
      (unless (string= "GEMINI" (string-upcase protocol))
        (error "Unsupported protocol: ~a" protocol)))
        (error "Unsupported protocol: ~s" protocol)))
    (let ((path (sanitize-path (cl-fastcgi:fcgx-getparam req "GEMINI_URL_PATH"))))
      (when (and (> (length path) 0)
                 (char= #\/ (char path 0)))

@@ 134,7 134,7 @@ size.")
                      (return-file req filename)
                      (return nil))))

                 (t (error "Invalid test: ~a" test)))
                 (t (error "Invalid test: ~s" test)))

            ;; Return the error header if none of the above match
            finally (cl-fastcgi:fcgx-puts req (format nil "~2,'0d ~a~a"