Skip to content

Commit

Permalink
Massive refactoring to make code a bit more organized. Indexes are di…
Browse files Browse the repository at this point in the history
…sabled for now.
  • Loading branch information
freiksenet committed Jun 30, 2011
1 parent 0937072 commit 4c102a8
Show file tree
Hide file tree
Showing 5 changed files with 184 additions and 156 deletions.
2 changes: 2 additions & 0 deletions cl-neo4j-package.lisp
Expand Up @@ -2,6 +2,8 @@

(defpackage #:cl-neo4j
(:use #:cl
#:alexandria
#:anaphora
#:json
#:json-rpc
#:drakma)
Expand Down
23 changes: 11 additions & 12 deletions cl-neo4j.asd
Expand Up @@ -10,16 +10,15 @@
:version "0.2"
:description "neo4j RESTful Client Interface"
:long-description "neo4j RESTful Client Interface."
:depends-on (:drakma
:cl-ppcre
:cl-json)
:depends-on (:alexandria
:anaphora
:drakma
:cl-ppcre
:cl-json)
:components ((:file "cl-neo4j-package")
(:file "globals" :depends-on ("cl-neo4j-package"))
(:file "utilities" :depends-on ("globals"))
(:file "conditions" :depends-on ("utilities"))
(:file "struct" :depends-on ("conditions"))
(:file "neo4j" :depends-on ("conditions" "struct"))
(:file "struct-methods" :depends-on ("neo4j"))))



(:file "globals" :depends-on ("cl-neo4j-package"))
(:file "utilities" :depends-on ("globals"))
(:file "conditions" :depends-on ("utilities"))
(:file "struct" :depends-on ("conditions"))
(:file "neo4j" :depends-on ("conditions" "struct"))
(:file "struct-methods" :depends-on ("neo4j"))))
42 changes: 25 additions & 17 deletions conditions.lisp
Expand Up @@ -5,40 +5,48 @@
(property :accessor property :initarg :property)
(status :accessor status :initarg :status))
(:report (lambda (condition stream)
(format stream "Unknown status ~A returned for ~A (~A)"
(status condition) (uri condition) (property condition)))))
(format stream "Unknown status ~A returned for ~A (~A)"
(status condition) (uri condition) (property condition)))))

(define-condition invalid-data-sent-error (error)
((json :accessor json :initarg :json)
(uri :accessor uri :initarg :uri))
(:report (lambda (condition stream)
(format stream "Invalid data sent to ~A: ~A" (uri condition) (json condition)))))
(format stream "Invalid data sent to ~A: ~A" (uri condition) (json condition)))))

(define-condition node-not-found-error (error)
((uri :accessor uri :initarg :uri)
(property :accessor property :initarg :property))
(:report (lambda (condition stream)
(if (slot-boundp condition 'property)
(format stream "Property ~A not found for node ~A"
(property condition) (uri condition))
(format stream "Node not found ~A" (uri condition))))))
(if (slot-boundp condition 'property)
(format stream "Property ~A not found for node ~A"
(property condition) (uri condition))
(format stream "Node not found ~A" (uri condition))))))

(define-condition unable-to-delete-node-error (error)
((uri :accessor uri :initarg :uri))
(:report (lambda (condition stream)
(format stream "Unable to delete node ~A. Still has relationships?" (uri condition)))))
(format stream "Unable to delete node ~A. Still has relationships?" (uri condition)))))

(define-condition relationship-not-found-error (error)
((uri :accessor uri :initarg :uri)
(property :accessor property :initarg :property))
(:report (lambda (condition stream)
(if (slot-boundp condition 'property)
(format stream "Property ~A not found for relationship ~A"
(property condition) (uri condition))
(format stream "Relationship not found ~A" (uri condition))))))
(if (slot-boundp condition 'property)
(format stream "Property ~A not found for relationship ~A"
(property condition) (uri condition))
(format stream "Relationship not found ~A" (uri condition))))))

(define-condition index-entry-not-found-error (error)
((uri :accessor uri :initarg :uri))
(:report (lambda (condition stream)
(format stream "Index entry not found ~A" (uri condition)))))

(format stream "Index entry not found ~A" (uri condition)))))

(define-condition property-not-found-error (error)
((uri :accessor uri :initarg :uri)
(property :accessor property :initarg :property))
(:report (lambda (condition stream)
(format stream "Property ~A not found for ~A ~A"
(first (property condition))
(second (property condition))
(third (property condition))))))

0 comments on commit 4c102a8

Please sign in to comment.