You can easily write errors to the logs visible at <your forum>/logs. If you want something more visible, you could consider putting some logic in your plugin that sends a PM to @admins.
discourse-saved-searches sends automated PMs from a plugin, so that’s probably a good place to start.