Add Api Error Class

@mattlebel @liuhenry 

Goofed squashing my commits in the other branch, so I just cherry-picked the rebase commit into this new branch off master.