Creating feed with invalid engine type can crash UI #685
Description
Working with the self-hosted API, the feed/create.json endpoint doesn't perform validity checking on the engine type passed in. If an invalid engine type is selected, the feed page on the UI will fail to load and apps that depend on feeds (such as My Electric) will fail. To get out of this state, manually deleting the feed from the MySQL table and restarting the service was necessary.
It looks like these lines - https://github.com/emoncms/emoncms/blob/master/Modules/feed/feed_model.php#L70-L71 - properly throw an error from the class upon detecting an invalid engine ID, but that error isn't caught cleanly upstream and results in the whole app going down. Looking over the emoncmsorg code, the validity checking on engines also seems limited to a handful of known (and unsupported) options. Additional checking to ensure a bad API call there doesn't bring down part (or even all 😱 ) of the hosted version is probably in order.