Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Make error message clearer when a Clojure source file does not begin with ns form #1

Closed
wants to merge 1 commit into from

2 participants

@jafingerhut

I've been trying out lein-clojuredocs on many of the Clojure contrib libs, and found the exception printed when this condition occurs to be fairly cryptic.

@michaelklishin

The main repo is now clojuredocs/cadastre.

@jafingerhut

Opened issue on main repo clojuredocs/cadastre, and it has been merged and closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 6 deletions.
  1. +12 −6 src/cadastre/analyzer.clj
View
18 src/cadastre/analyzer.clj
@@ -118,12 +118,18 @@
(let [ns-dec (ns-file/read-file-ns-decl f)
ns-name (second ns-dec)]
(p (str "[+] Processing " (or ns-name f) "..."))
- (require ns-name)
- {(str ns-name) (->> ns-name
- ns-interns
- vals
- (map meta)
- (map munge-doc))})
+ (if (nil? ns-dec)
+ (do
+ (p (str "Unable to parse " f
+ " because it did not begin with ns form."))
+ {})
+ (do
+ (require ns-name)
+ {(str ns-name) (->> ns-name
+ ns-interns
+ vals
+ (map meta)
+ (map munge-doc))})))
(catch Exception e
(p (str "Unable to parse " f ": " e))
{})))
Something went wrong with that request. Please try again.