Skip to content

Commit 5eb0ccb

Browse files
authored
Merge pull request #531 from egregius313/patch-2
Change calls to throw to vector instead of string
2 parents 6617e05 + f82bf5f commit 5eb0ccb

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pixie/fs.pxi

+5-5
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
(rel [this other]
110110
(if (satisfies? IFSPath other)
111111
(rel-path this other)
112-
(throw "Second argument must satisfy IFSPath")))
112+
(throw [::AssertionException "Second argument must satisfy IFSPath"])))
113113

114114
(abs [this]
115115
(path/-abs pathz))
@@ -157,7 +157,7 @@
157157
(rel [this other]
158158
(if (satisfies? IFSPath other)
159159
(rel-path this other)
160-
(throw "Second argument must satisfy IFSPath")))
160+
(throw [::AssertionException "Second argument must satisfy IFSPath"])))
161161

162162
(abs [this]
163163
(path/-abs pathz))
@@ -217,7 +217,7 @@
217217
(cond
218218
(path/-file? x) (->File x)
219219
(not (path/-exists? x)) (->File x)
220-
:else (throw (str "A non-file object exists at path: " x)))))
220+
:else (throw [::NotAFileException (str "A non-file object exists at path: " x)]))))
221221

222222
(defn dir
223223
"Returns a dir if the path is a dir or does not exist. If a different filesystem object exists at the path an error will be thrown."
@@ -226,7 +226,7 @@
226226
(cond
227227
(path/-dir? x) (->Dir x)
228228
(not (path/-exists? x)) (->Dir x)
229-
:else (throw (str "A non-dir object exists at path: " x)))))
229+
:else (throw [::NotADirectoryException (str "A non-dir object exists at path: " x)]))))
230230

231231
(defn fspath
232232
"Returns either a File or Dir if they exist at the path"
@@ -235,6 +235,6 @@
235235
(cond
236236
(path/-file? x) (->File x)
237237
(path/-dir? x) (->Dir x)
238-
:else (throw (str "No file or directory at path: " x)))))
238+
:else (throw [::FileNotFoundException (str "No file or directory at path: " x)]))))
239239

240240

0 commit comments

Comments
 (0)