[ 
https://issues.apache.org/jira/browse/CASSGO-113?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18066729#comment-18066729
 ] 

Bohdan Siryk edited comment on CASSGO-113 at 3/19/26 9:23 AM:
--------------------------------------------------------------

Ideally, we should introduce distinct types for all of them. At this moment we 
have:
{code:go}
case ErrCodeInvalid, ErrCodeBootstrapping, ErrCodeConfig, ErrCodeCredentials, 
ErrCodeOverloaded, ErrCodeProtocol, ErrCodeServer, ErrCodeSyntax, 
ErrCodeTruncate, ErrCodeUnauthorized: // TODO(zariel): we should have some 
distinct types for these errors 
return errD, nil 
{code}

Or at least expose a generic error struct (or introduce a new one), because 
there is no possibility to access *RequestError* interface methods despite 
*errorFrame* implementing them:
 
{code:go}
// RequestError represents errors returned by Cassandra server.
type RequestError interface { 
  Code() int 
  Message() string 
  Error() string 
}
 
type errorFrame struct { 
  frameHeader 
  code int 
  message string 
}
 
func (e errorFrame) Code() int { returne.code } 
func (e errorFrame) Message() string { returne.message } 
func (e errorFrame) Error() string { returne.Message() }{code}
 


was (Author: JIRAUSER306087):
Ideally, we should introduce distinct types for all of them. At this moment we 
have:
{code:java}
case ErrCodeInvalid, ErrCodeBootstrapping, ErrCodeConfig, ErrCodeCredentials, 
ErrCodeOverloaded, ErrCodeProtocol, ErrCodeServer, ErrCodeSyntax, 
ErrCodeTruncate, ErrCodeUnauthorized: // TODO(zariel): we should have some 
distinct types for these errors 
return errD, nilOr at least expose a generic error struct (or introduce a new 
one), because there is no possibility to access 
{code}
*RequestError*
{code:java}
 interface methods despite 
{code}
*errorFrame*
{code:java}
 implementing them:{code}
// RequestError represents errors returned by Cassandra server.
 
{code:java}
type RequestError interface { 
  Code() int 
  Message() string 
  Error() string 
}
 
type errorFrame struct { 
  frameHeader 
  code int 
  message string 
}
 
func (e errorFrame) Code() int { returne.code } 
func (e errorFrame) Message() string { returne.message } 
func (e errorFrame) Error() string { returne.Message() }{code}
 

> Add dedicated error types for Overloaded and Bootstrapping errors
> -----------------------------------------------------------------
>
>                 Key: CASSGO-113
>                 URL: https://issues.apache.org/jira/browse/CASSGO-113
>             Project: Apache Cassandra Go driver
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Paolo Elefante
>            Priority: Normal
>
> h2. Problem
> ErrCodeOverloaded (0x1001) and ErrCodeBootstrapping (0x1002) are currently
> parsed as generic errorFrame instances.
> This prevents applications from handling these error conditions in a
> type-safe way, forcing them to rely on error message inspection or
> error code matching.
> h2. Use Case
> Some applications and wrapper libraries need to distinguish these server
> error conditions in a type-safe way, for example to implement custom
> retry, backoff, observability, or request classification logic.
> At the moment, ErrCodeOverloaded and ErrCodeBootstrapping are exposed as
> generic errorFrame values, which makes them inconsistent with other
> server errors that already have dedicated request error types.
> h2. Proposal
> Introduce dedicated error types:
> - RequestErrOverloaded
> - RequestErrBootstrapping
> These should follow the same pattern as existing error types such as:
> - RequestErrUnavailable
> - RequestErrWriteTimeout
> - RequestErrReadTimeout



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to