Skip to content

district0x/district0x-error-handling

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

district0x/error-handling

Build Status

Clojurescript library with functions aiding in error handling. This library currently utilises timbre as a logging library. You shoud use it in conjunction with the district-server-logging and district-ui-logging modules which setup various logging appenders.

Installation

Add into your project.clj:
Clojars Project

Include [district.shared.error-handling] in your CLJS file.

district.shared.error-handling

try-catch

  • Wraps around a function body and logs any exception being thrown.

try-catch-throw

  • Wraps around a function body, logs any exception being thrown and then re-throws it for further handling.

Usage

(ns my-district
  (:require [district.shared.error-handling :refer [try-catch try-catch-throw]]))

(defn function-that-can-fail [n]
  (try-catch
   (/ 7 n)))

Library dependencies

error-handling requires a configured district-server-logging and/or district-ui-logging modules to function correctly. Depending on where the code is run and how the logging is configured your errors will be reported to the browser, node.js console, log file, sentry etc.

For possible configuration options please see district-server-logging and district-ui-logging.

About

Library with functions for error handling.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published