summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoreltrac <hi@eltr.ac>2026-09-11 18:00:25 +0800
committereltrac <hi@eltr.ac>2026-09-11 18:00:25 +0800
commit13fd270a93a91ff48e362f115da57f846e02f311 (patch)
tree76561bff6a93b79141b0f3d514204bf666b58ece /src
parent064e7401ae2b9f04fb2bc19fd909ef76d9c32711 (diff)
fix #13
Diffstat (limited to 'src')
-rw-r--r--src/weepinbell/storage/edn_storage.clj10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/weepinbell/storage/edn_storage.clj b/src/weepinbell/storage/edn_storage.clj
index ca2d9b7..1533e40 100644
--- a/src/weepinbell/storage/edn_storage.clj
+++ b/src/weepinbell/storage/edn_storage.clj
@@ -1,8 +1,10 @@
(ns weepinbell.storage.edn-storage
(:require [clojure.edn :as edn]
+ [taoensso.timbre :as timbre]
+ [weepinbell.utils :refer [file-exists?]]
[weepinbell.utils.url :refer [get-domain get-target get-path]]
[clojure.java.io :as io]
- [clojure.string :refer [join]]))
+ [clojure.string :refer [join ends-with?]]))
(defn unload-data
"Write to data file, replacing everything."
@@ -82,6 +84,12 @@
;; make storage vtable
(defn use-store [datasource]
+ (when (not (file-exists? datasource))
+ (timbre/error "Datasource is not found. File does not exist.")
+ (System/exit 1))
+ (when (not (ends-with? datasource ".edn"))
+ (timbre/error "Datasource is not valid. It must be an .edn file.")
+ (System/exit 1))
{:append (partial append-wm datasource)
:update (partial update-wm datasource)
:delete (partial delete-wm datasource)