Bugfix error handling

With a previous change, the error handling in Gates had some issues. This meant that the messages weren't displayed in the frontend correctly. This is now fixed.