Hataları otomatik olarak bildirme
Aşağıda gösterildiği gibi bir işlevden Error Reporting'e hata gönderebilirsiniz:
Node.js
Python
Daha ayrıntılı hata raporu almak isterseniz Error Reporting istemcisini kullanabilirsiniz. kitaplıklar.
Bildirilen hataları Google Cloud Console'daki Hata Bildirimi bölümünde görüntüleyebilirsiniz. Ayrıca, belirli bir işlevi, Google Cloud Console'daki işlev listesinden seçtiğinizde yapabilirsiniz.
İşleviniz tarafından oluşturulan ve yakalanmayan istisnalar, Hata Raporlama'da görünür. Bazı yakalanmamış istisna türlerinin (ör. eşzamansız olarak), gerçekleşme tarihi işlevi çağırır. Bu, işlevinizin çalışması için gereken süreyi artırır.
Hataları manuel olarak bildirme
Cloud Logging adresine gönderiliyor
Cloud Functions'daki error
işlevi
günlük kaydedici
SDK, hataları hem Cloud Logging hem de Error Reporting'e bildirir. Hatadan alınan daha fazla bağlamı yapılandırılmış veri olarak eklemek için ikinci bağımsız değişken olarak bir hata nesnesini iletin:
} catch (err) {
// Attach an error object as the second argument
functions.logger.error(
"Unable to read quote from Firestore, sending default instead",
err
);
}