Log error instead of just printing