Enhanced to show an error message.