getErrorMessage()

Returns a String that contains an error message.

public String getErrorMessage()

Type: String

The error message doesn’t make a round trip through a Visualforce view state, because exceptions can’t be serialized.