Improve ide-api error handling

I removed a couple of pattern match failures and improved the error messages a bit.