File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 203203(defn- format-error
204204 [error command]
205205 (let [{:keys [code message candidates context]} error
206- hint (or (error-hint error command) (:hint context))
206+ hint (or (error-hint error command) (:hint error) ( :hint context))
207207 message* (style/bold-keywords message [" option" " command" " argument" ])
208208 candidates* (format-candidates candidates)]
209209 (if (= :graph-validation-failed code)
Original file line number Diff line number Diff line change 8383 :context {:code :missing-auth
8484 :hint " Run `logseq login` first." }}}
8585 {:output-format nil })]
86- (is (= " Error (missing-auth): missing auth\n Hint: Run `logseq login` first." result)))))
86+ (is (= " Error (missing-auth): missing auth\n Hint: Run `logseq login` first." result))))
87+
88+ (testing " human error with hint directly on error map"
89+ (let [result (format/format-result {:status :error
90+ :error {:code :e2ee-password-not-found
91+ :message " e2ee-password not found"
92+ :hint " Provide --e2ee-password to verify and persist it." }}
93+ {:output-format nil })]
94+ (is (= " Error (e2ee-password-not-found): e2ee-password not found\n Hint: Provide --e2ee-password to verify and persist it." result)))))
8795
8896(deftest test-format-graph-validation
8997 (testing " graph validation success prints validated"
You can’t perform that action at this time.
0 commit comments