Raise exception for bad searches

@glyphobet, this allows us to provide more informative response messages to external API users, see https://github.com/goodscloud/goodscloud/tree/fix-flask-errorhandlers.

This edit makes the failing tests of class `APIErrorHandlersTest` pass, as observed in https://magnum.travis-ci.com/goodscloud/goodscloud/jobs/5532808.

In case exceptions are not handled by Flask, this change does expose more information about the app to potential attackers, so I'm not sure if this patch is for upstream/jfinkels.