Set an error code in case of error

Authored by ahartmetz on Sep 4 2017, 4:34 PM.