It's better to show error messages like this in the GUI if the application is a GUI. You should also log the error.