Log API errors when they happen