reporting error code on thread failure