Is it possible to capture the error message that returns from a rest call?

Thank you @nathan.loding, but, how can I access this message property and store it in a variable for example?