Merge pull request #1 from yext/master

merge
Don't switch on type but instead try to cast to error
Merge pull request #1 from ttacon/master

Type assertion instead of switching on type