emit proper error objects throughout.