Handle request errors

This is kinda hacky, but it works.