Skip to content

Commit 7d5903b

Browse files
committed
comments
1 parent 2942a37 commit 7d5903b

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

errors.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,60 +10,78 @@ import (
1010
"github.com/ydb-platform/ydb-go-sdk/v3/ratelimiter"
1111
)
1212

13+
// IterateByIssues helps to iterate over internal issues of operation error
1314
func IterateByIssues(err error, it func(message string, code Ydb.StatusIds_StatusCode, severity uint32)) {
1415
xerrors.IterateByIssues(err, it)
1516
}
1617

18+
// IsTimeoutError checks whether given err is a some timeout error (context, transport or operation)
1719
func IsTimeoutError(err error) bool {
1820
return xerrors.IsTimeoutError(err)
1921
}
2022

23+
// IsTransportError checks whether given err is a transport (grpc) error
2124
func IsTransportError(err error, codes ...grpcCodes.Code) bool {
2225
return xerrors.IsTransportError(err, codes...)
2326
}
2427

28+
// Error is an interface of error which reports about error code and error name
2529
type Error xerrors.Error
2630

31+
// TransportError checks when given error is a transport error and returns description of transport error
2732
func TransportError(err error) Error {
2833
return xerrors.TransportError(err)
2934
}
3035

36+
// IsYdbError reports when given error is and ydb error (transport, operation or internal driver error)
3137
func IsYdbError(err error) bool {
3238
return xerrors.IsYdb(err)
3339
}
3440

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
3543
func IsOperationError(err error, codes ...Ydb.StatusIds_StatusCode) bool {
3644
return xerrors.IsOperationError(err, codes...)
3745
}
3846

47+
// OperationError returns operation error description
48+
// If given err is not an operation error - returns nil
3949
func OperationError(err error) Error {
4050
return xerrors.OperationError(err)
4151
}
4252

53+
// IsOperationErrorOverloaded checks whether given err is an operation error with code Overloaded
4354
func IsOperationErrorOverloaded(err error) bool {
4455
return IsOperationError(err, Ydb.StatusIds_OVERLOADED)
4556
}
4657

58+
// IsOperationErrorUnavailable checks whether given err is an operation error with code Unavailable
4759
func IsOperationErrorUnavailable(err error) bool {
4860
return IsOperationError(err, Ydb.StatusIds_UNAVAILABLE)
4961
}
5062

63+
// IsOperationErrorAlreadyExistsError checks whether given err is an operation error with code AlreadyExistsError
5164
func IsOperationErrorAlreadyExistsError(err error) bool {
5265
return IsOperationError(err, Ydb.StatusIds_ALREADY_EXISTS)
5366
}
5467

68+
// IsOperationErrorNotFoundError checks whether given err is an operation error with code NotFoundError
5569
func IsOperationErrorNotFoundError(err error) bool {
5670
return IsOperationError(err, Ydb.StatusIds_NOT_FOUND)
5771
}
5872

73+
// IsOperationErrorSchemeError checks whether given err is an operation error with code SchemeError
5974
func IsOperationErrorSchemeError(err error) bool {
6075
return IsOperationError(err, Ydb.StatusIds_SCHEME_ERROR)
6176
}
6277

78+
// IsRatelimiterAcquireError checks whether given err is an ratelimiter acquire error
6379
func IsRatelimiterAcquireError(err error) bool {
6480
return ratelimiterErrors.IsAcquireError(err)
6581
}
6682

83+
// ToRatelimiterAcquireError casts given err to ratelimiter.AcquireError
84+
// If given err is not ratelimiter acquire error - returns nil
6785
func ToRatelimiterAcquireError(err error) ratelimiter.AcquireError {
6886
return ratelimiterErrors.ToAcquireError(err)
6987
}

version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ package ydb
22

33
import "github.com/ydb-platform/ydb-go-sdk/v3/internal/meta"
44

5-
// Version alias for except cycle import
5+
// Version is the current version of sdk
66
const Version = meta.Version

0 commit comments

Comments
 (0)