You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2020/05/28 01:21:37 UTC

[GitHub] [pulsar-client-go] wolfstudy opened a new issue #264: [Improve] Unified processing of error information in the project

wolfstudy opened a new issue #264:
URL: https://github.com/apache/pulsar-client-go/issues/264


   Currently, there are some inconsistencies in the handling of errors. In order to ensure the structured output of the log, we should use withError() instead of Error().
   
   E.g:
   
   ```
   p.log.WithField("size", len(msg.Payload)).
   	WithField("sequenceID", sequenceID).
   	WithField("properties", msg.Properties).
   	Error("unable to add message to batch")
   ```
   
   ```
   if err != nil {
   	log.WithError(err).Error("Failed to parse service URL")
   	return nil, newError(ResultInvalidConfiguration, "Invalid service URL")
   }
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar-client-go] wolfstudy commented on issue #264: [Improve] Unified processing of error information in the project

Posted by GitBox <gi...@apache.org>.
wolfstudy commented on issue #264:
URL: https://github.com/apache/pulsar-client-go/issues/264#issuecomment-635039803


   @keithnull will track this task


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar-client-go] keithnull commented on issue #264: [Improve] Unified processing of error information in the project

Posted by GitBox <gi...@apache.org>.
keithnull commented on issue #264:
URL: https://github.com/apache/pulsar-client-go/issues/264#issuecomment-635790148


   @wolfstudy 
   
   I've checked all error-related logs, which can be classified as:
   
   1. `.WithError(someErr).Error("some string")`
   1. `.WithError(someErr).Error()`
   1. `.Error("some string")`
   
   Type 1 and 2 are exactly what we desire. For Type 3, if we want to make them unified, we need to define some `error` consts and use them instead, like:
   
   ```go
   someErr := fmt.Errorf("some string")
   // log.Error("some string")
   log.WithError(someErr).Error()
   ```
   
   But currently, existing errors are not very universal, i.e., they usually contain information specific to only a few situations. Therefore, maybe it's not quite necessary to do this now.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar-client-go] wolfstudy closed issue #264: [Improve] Unified processing of error information in the project

Posted by GitBox <gi...@apache.org>.
wolfstudy closed issue #264:
URL: https://github.com/apache/pulsar-client-go/issues/264


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org