Is this valid code? If search input was bad, it will show one message, othervise, if anything is wrong with the API iteslf, it will show different messasge.
I'm really having trouble properly understanding error handling, and how to know all the errors that can occure, and how to handle them differently.