return error instead of logging