refactor: improve error reporting in the UI server code