Add DeadlockException

Make it easier to handle deadlocks by throwing a specific exception.
Detect deadlocks using error codes
Merge pull request #87 from tombb/deadlock-exception

Add a specific DeadlockException for when transactions deadlock