From 766ef4bb53e5509976f17f6314c92b4cd5b1012a Mon Sep 17 00:00:00 2001 From: vemv Date: Fri, 18 Aug 2023 12:55:10 +0200 Subject: [PATCH] Handle unloadable classes Fixes #9 --- CHANGELOG.md | 6 ++++++ src/haystack/analyzer.clj | 15 ++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c0a4125..9c96f00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## master (unreleased) +### Bugs fixed + +* [#9](https://github.com/clojure-emacs/haystack/issues/9): handle unloadable classes. + +## 0.0.3 + ### Changes * Add stacktrace analyzer and parsers. diff --git a/src/haystack/analyzer.clj b/src/haystack/analyzer.clj index 8fe747d..7fcc3ba 100644 --- a/src/haystack/analyzer.clj +++ b/src/haystack/analyzer.clj @@ -87,11 +87,16 @@ path->url str) (str (frame->url frame))))) - (assoc frame :file-url (some->> frame :name symbol - (java/resolve-symbol 'user) - :file - path->url - str)))) + (assoc frame :file-url (try + (some->> frame :name symbol + (java/resolve-symbol 'user) + :file + path->url + str) + (catch Throwable _ + ;; `java/resolve-symbol` can throw exceptions when the underlying class cannot be loaded. + ;; See https://github.com/clojure-emacs/haystack/issues/9 + nil))))) (defn- analyze-file "Associate the file type (extension) of the source file to the frame map, and