zeroshade commented on code in PR #1413:
URL: https://github.com/apache/iceberg-go/pull/1413#discussion_r3553622900


##########
partitions.go:
##########
@@ -210,6 +210,9 @@ func NewPartitionSpecOpts(opts ...PartitionOption) 
(PartitionSpec, error) {
 
 func WithSpecID(id int) PartitionOption {
        return func(p *PartitionSpec) error {
+               if id < 0 {
+                       return fmt.Errorf("%w: spec id must be non-negative: 
%d", ErrInvalidPartitionSpec, id)

Review Comment:
   `NewPartitionSpecOpts` already wraps option errors with `fmt.Errorf("%w: 
%w", ErrInvalidPartitionSpec, err)`, so wrapping the sentinel here too 
double-wraps it — the message becomes `invalid partition spec: invalid 
partition spec: spec id must be non-negative: -1`. Sibling options return a 
bare error and let the outer wrapper attach the sentinel; suggest 
`fmt.Errorf("spec id must be non-negative: %d", id)` here.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to