How to use error() function and what is the best use of error function
Discussion posts and replies are publicly visible
When calling the error function in a process context, it will pause the process by exception. Use that in situations where you need to stop the process, analyze and solve the root problem and then continue.
In user interfaces, use error() to show a custom, red and ugly, error message to the user. Use that in cases where the UI cannot progress, similar to the process scenario.