Add error codes and error message.
Fix db env in config.
Merge remote-tracking branch 'origin/master'