@@ -10,25 +10,33 @@ import (
1010 "github.com/ydb-platform/ydb-go-sdk/v3/ratelimiter"
1111)
1212
13- // IterateByIssues helps to iterate over internal issues of operation error
13+ // IterateByIssues helps to iterate over internal issues of operation error.
1414func IterateByIssues (err error , it func (message string , code Ydb.StatusIds_StatusCode , severity uint32 )) {
1515 xerrors .IterateByIssues (err , it )
1616}
1717
18- // IsTimeoutError checks whether given err is a some timeout error (context, transport or operation)
18+ // IsTimeoutError checks whether given err is a some timeout error (context, transport or operation).
1919func IsTimeoutError (err error ) bool {
2020 return xerrors .IsTimeoutError (err )
2121}
2222
23- // IsTransportError checks whether given err is a transport (grpc) error
23+ // IsTransportError checks whether given err is a transport (grpc) error.
2424func IsTransportError (err error , codes ... grpcCodes.Code ) bool {
2525 return xerrors .IsTransportError (err , codes ... )
2626}
2727
28- // Error is an interface of error which reports about error code and error name
29- type Error xerrors.Error
28+ // Error is an interface of error which reports about error code and error name.
29+ type Error interface {
30+ error
3031
31- // TransportError checks when given error is a transport error and returns description of transport error
32+ // Code reports the error code
33+ Code () int32
34+
35+ // Name reports the name of error
36+ Name () string
37+ }
38+
39+ // TransportError checks when given error is a transport error and returns description of transport error.
3240func TransportError (err error ) Error {
3341 return xerrors .TransportError (err )
3442}
@@ -38,14 +46,14 @@ func IsYdbError(err error) bool {
3846 return xerrors .IsYdb (err )
3947}
4048
41- // IsOperationError reports whether any error is an operation error with one of passed codes
42- // If codes not defined IsOperationError returns true on error is an operation error
49+ // IsOperationError reports whether any error is an operation error with one of passed codes.
50+ // If codes not defined IsOperationError returns true on error is an operation error.
4351func IsOperationError (err error , codes ... Ydb.StatusIds_StatusCode ) bool {
4452 return xerrors .IsOperationError (err , codes ... )
4553}
4654
47- // OperationError returns operation error description
48- // If given err is not an operation error - returns nil
55+ // OperationError returns operation error description.
56+ // If given err is not an operation error - returns nil.
4957func OperationError (err error ) Error {
5058 return xerrors .OperationError (err )
5159}
@@ -80,7 +88,7 @@ func IsRatelimiterAcquireError(err error) bool {
8088 return ratelimiterErrors .IsAcquireError (err )
8189}
8290
83- // ToRatelimiterAcquireError casts given err to ratelimiter.AcquireError
91+ // ToRatelimiterAcquireError casts given err to ratelimiter.AcquireError.
8492// If given err is not ratelimiter acquire error - returns nil
8593func ToRatelimiterAcquireError (err error ) ratelimiter.AcquireError {
8694 return ratelimiterErrors .ToAcquireError (err )
0 commit comments