jsa_proc: added in error class
db.py: tidied up whitespace and used new error classes