-
Notifications
You must be signed in to change notification settings - Fork 653
Closed
Labels
api: loggingIssues related to the Cloud Logging API.Issues related to the Cloud Logging API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.
Description
I noticed that calls to log.error and log.write don't behave the same when it comes to execute the callback functions.
While I was trying to log an error thrown by my Datastore, I realized that my log.error callback was never executed. See code below.
- err is an error thrown by Datastore
- Trying to log err throws another error (Value of type object not recognized. at Function.GrpcService.encodeValue)
- This 2nd error should be catched by the callback, unfortunatly it is never the case with log.error
- But it works with log.write
const entry = log.entry (metadata, {
error: "UnableToUpdateUser",
data: {
error: err
}
})
log.error (entry)
.then ( function (resp) {
// fine
})
.catch ( (logErr) => {
// never called, this log never appears in Stackdriver
log.error (log.entry (metadata, { error: "LogError 1"}))
})
log.write (entry)
.then ( function (resp) {
// fine
})
.catch ( (logErr) => {
// this one is called, can see it in Stackdriver
log.error (log.entry (metadata, { error: "LogError 2"}))
})This was produced on the Google Function Emulator.
"@google-cloud/datastore": "^0.6.0",
"@google-cloud/logging": "^0.6.0"gcloud -v :
Google Cloud SDK 138.0.0
alpha 2016.01.12
beta 2016.01.12
bq 2.0.24
bq-nix 2.0.24
cloud-datastore-emulator 1.2.1
core 2016.12.09
core-nix 2016.11.07
gcd-emulator v1beta3-1.0.0
gcloud
gsutil 4.22
gsutil-nix 4.21
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api: loggingIssues related to the Cloud Logging API.Issues related to the Cloud Logging API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.