{"id":28205792,"url":"https://github.com/coast-framework/error","last_synced_at":"2025-07-19T19:34:26.290Z","repository":{"id":62431667,"uuid":"192984470","full_name":"coast-framework/error","owner":"coast-framework","description":"Easy clojure error handling","archived":false,"fork":false,"pushed_at":"2019-08-18T18:04:12.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-11T14:44:11.330Z","etag":null,"topics":["clojure","error-handling","errors"],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coast-framework.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-20T20:37:33.000Z","updated_at":"2019-08-18T18:04:14.000Z","dependencies_parsed_at":"2022-11-01T20:46:38.016Z","dependency_job_id":null,"html_url":"https://github.com/coast-framework/error","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/coast-framework/error","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coast-framework%2Ferror","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coast-framework%2Ferror/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coast-framework%2Ferror/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coast-framework%2Ferror/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coast-framework","download_url":"https://codeload.github.com/coast-framework/error/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coast-framework%2Ferror/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265818037,"owners_count":23833530,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clojure","error-handling","errors"],"created_at":"2025-05-17T10:08:31.401Z","updated_at":"2025-07-19T19:34:26.285Z","avatar_url":"https://github.com/coast-framework.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# error\nEasy clojure error handling\n\n## Installation\n\nMake your `deps.edn` look like this:\n\n```clojure\n; ... paths probably\n\n{:deps {coast-framework/error {:mvn/version \"1.0.2\"}}}\n        ;... your other libraries}}\n\n; ... rest of deps.edn\n```\n\n## Usage\n\nRequire it like this\n\n```clojure\n(ns your-project\n  (:require [error.core :as error]))\n```\n\nUse it like this\n\n```clojure\n(defn validate-email [email]\n  (if (re-matches #\".+@.+\\..+\" email)\n    email\n    (error/raise (str \"Please enter a valid email address, not \" email))))\n\n(let [[email e] (error/rescue (validate-email \"not an email\"))]\n  (if (some? e)\n    {:error e}\n    {:email email}))\n```\n\nor like this\n\n```clojure\n(defn validate-email [email]\n  (if (re-matches #\".+@.+\\..+\" email)\n    email\n    (error/raise (str \"Please enter a valid email address, not \" email))))\n      :error/email\n\n(let [[email e] (error/rescue (validate-email \"not an email\")\n                  :error/email)]\n  (if (some? e)\n    {:error/email e}\n    {:email email}))\n```\n\nIt will still throw on exceptions if the identifier you specify isn't the same\n\n```clojure\n(error/rescue\n  (error/raise \"error\" :error)\n  :error1)\n\n; :error1 != :error so the following exception will be called\n(throw (ex-info \"error\" {:error.core/e \"error\" :error.core/id :error}))\n```\n\nIt also works with regular exceptions with `try*`\n\n```clojure\n(defn validate-email [email]\n  (if (re-matches #\".+@.+\\..+\" email)\n    email\n    (throw (Exception. (str \"Please enter a valid email address, not \" email)))))\n\n(let [[email e] (error/try* (validate-email \"not an email\"))]\n  (if (some? e)\n    {:error/email (.getMessage e)}\n    {:email email}))\n```\n\n## Testing\n\n```sh\ngit clone ...\ncd error\nmake test\n```\n\n## License\n\nMIT\n\n## Contribution\n\nAny and all issues or pull requests welcome!\n\n## Too Small\n\nThis library is really small, it's true. Too small? Could be.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoast-framework%2Ferror","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoast-framework%2Ferror","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoast-framework%2Ferror/lists"}