1. fix sqlalchemy usage bug; 2. add error code
log hook