revamp error handling API
branch APIs