ESSENTIALS-290: Improve error handling of gallery plugin.