|
29 | 29 | [clojure.java.io :as io]
|
30 | 30 | [clojure.string :as string]
|
31 | 31 | [clojure.tools.logging :as logging])
|
32 |
| - (:use |
33 |
| - [slingshot.slingshot :only [throw+]]) |
34 | 32 | (:import
|
35 | 33 | [java.io
|
36 | 34 | File InputStream OutputStream StringReader
|
|
183 | 181 | (.add id-repo (.forSSHAgent keypair)))))
|
184 | 182 |
|
185 | 183 | :else
|
186 |
| - (throw+ |
187 |
| - {:reason :do-not-know-how-to-add-identity |
188 |
| - :args options} |
189 |
| - "Don't know how to add identity")))) |
| 184 | + (throw |
| 185 | + (ex-info |
| 186 | + "Don't know how to add identity" |
| 187 | + {:reason :do-not-know-how-to-add-identity |
| 188 | + :args options}))))) |
190 | 189 |
|
191 | 190 | (defn add-identity-with-keychain
|
192 | 191 | "Add a private key, only if not already known, using the keychain to obtain
|
|
214 | 213 | (add-identity agent (assoc options :passphrase passphrase))
|
215 | 214 | (do
|
216 | 215 | (logging/error "Passphrase required, but none findable.")
|
217 |
| - (throw+ |
218 |
| - {:reason :passphrase-not-found |
219 |
| - :key-name name} |
220 |
| - "Passphrase required for key %s, but none findable." name))) |
| 216 | + (throw |
| 217 | + (ex-info |
| 218 | + (str "Passphrase required for key " name ", but none findable.") |
| 219 | + {:reason :passphrase-not-found |
| 220 | + :key-name name}) name))) |
221 | 221 | (add-identity agent options)))))
|
222 | 222 |
|
223 | 223 | ;;; Sessions
|
@@ -518,7 +518,7 @@ sh returns a map of
|
518 | 518 | 5 (. target#
|
519 | 519 | (~name (first args#) (second args#) (nth args# 2) (nth args# 3)
|
520 | 520 | (nth args# 4)))
|
521 |
| - (throw+ |
| 521 | + (throw |
522 | 522 | (java.lang.IllegalArgumentException.
|
523 | 523 | (str "Too many arguments passed. Limit 5, passed " (count args#)))))))
|
524 | 524 |
|
@@ -564,7 +564,7 @@ sh returns a map of
|
564 | 564 | (conj args (sftp-modemap (options :mode)))
|
565 | 565 | args)]
|
566 | 566 | ((memfn-varargs put ChannelSftp) channel args))
|
567 |
| - (throw+ |
| 567 | + (throw |
568 | 568 | (java.lang.IllegalArgumentException. (str "Unknown SFTP command " cmd)))))
|
569 | 569 |
|
570 | 570 | (defn sftp
|
@@ -616,15 +616,16 @@ cmd specifies a command to exec. Valid commands are:
|
616 | 616 | [^InputStream in]
|
617 | 617 | (let [code (.read in)]
|
618 | 618 | (when-not (zero? code)
|
619 |
| - (throw+ |
620 |
| - {:type :clj-ssh/scp-failure |
621 |
| - :message (format |
622 |
| - "clj-ssh scp failure: %s" |
623 |
| - (case code |
624 |
| - 1 "scp error" |
625 |
| - 2 "scp fatal error" |
626 |
| - -1 "disconnect error" |
627 |
| - "unknown error"))})))) |
| 619 | + (throw |
| 620 | + (ex-info |
| 621 | + (format |
| 622 | + "clj-ssh scp failure: %s" |
| 623 | + (case code |
| 624 | + 1 "scp error" |
| 625 | + 2 "scp fatal error" |
| 626 | + -1 "disconnect error" |
| 627 | + "unknown error")) |
| 628 | + {:type :clj-ssh/scp-failure}))))) |
628 | 629 |
|
629 | 630 | (defn- scp-send-command
|
630 | 631 | "Send command to the specified output stream"
|
@@ -695,11 +696,11 @@ cmd specifies a command to exec. Valid commands are:
|
695 | 696 | (fn [^String path]
|
696 | 697 | (let [file (File. path)]
|
697 | 698 | (when (.isDirectory file)
|
698 |
| - (throw+ |
699 |
| - {:type :clj-ssh/scp-directory-copy-requested |
700 |
| - :message (format |
701 |
| - "Copy of dir %s requested without recursive flag" |
702 |
| - path)})) |
| 699 | + (throw |
| 700 | + (ex-info |
| 701 | + (format |
| 702 | + "Copy of dir %s requested without recursive flag" path) |
| 703 | + {:type :clj-ssh/scp-directory-copy-requested}))) |
703 | 704 | file)))]
|
704 | 705 | (map f paths)))
|
705 | 706 |
|
@@ -838,11 +839,10 @@ cmd specifies a command to exec. Valid commands are:
|
838 | 839 | _ (when (and (.exists file)
|
839 | 840 | (not (.isDirectory file))
|
840 | 841 | (> (count remote-paths) 1))
|
841 |
| - (throw+ |
842 |
| - {:type :clj-ssh/scp-copy-multiple-files-to-file-requested |
843 |
| - :message (format |
844 |
| - "Copy of multiple files to file %s requested" |
845 |
| - local-path)}))] |
| 842 | + (throw |
| 843 | + (ex-info |
| 844 | + (format "Copy of multiple files to file %s requested" local-path) |
| 845 | + {:type :clj-ssh/scp-copy-multiple-files-to-file-requested})))] |
846 | 846 | (when (and session (not (connected? session)))
|
847 | 847 | (connect session))
|
848 | 848 | (let [[^PipedInputStream in
|
|
0 commit comments