print error message for user or set timeout for a message

I would like to print some sort of error message to inform the user.

Is there a way to do this already? or even a way to display a message for a certain time limit, e.g. 2seconds ?