Error catching for setting error string.