Add error handling for branches and oauth