Account Codes (codes.js): handle database lock errors gracefully and not with a success state
To reproduce:
- Run Hello.gent (
npm run dev
) - Run codes.js
What should happen
You should get an error message telling you that you cannot run the codes script when Hallo.gent is running.
## What does happen
node codes.js create -a 10
(node:3711) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): OpenError: IO error: lock /Users/aral/indie/net/hallo-gent/server/db/data/LOCK: Resource temporarily unavailable
(node:3711) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[ … (list of codes) ]