github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/keys/errors.go (about) 1 // Copyright 2014 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 11 package keys 12 13 import ( 14 "fmt" 15 16 "github.com/cockroachdb/cockroach/pkg/roachpb" 17 ) 18 19 // InvalidRangeMetaKeyError indicates that a Range Metadata key is somehow 20 // invalid. 21 type InvalidRangeMetaKeyError struct { 22 Msg string 23 Key roachpb.Key 24 } 25 26 // NewInvalidRangeMetaKeyError returns a new InvalidRangeMetaKeyError 27 func NewInvalidRangeMetaKeyError(msg string, k []byte) *InvalidRangeMetaKeyError { 28 return &InvalidRangeMetaKeyError{Msg: msg, Key: k} 29 } 30 31 // Error formats error string. 32 func (i *InvalidRangeMetaKeyError) Error() string { 33 return fmt.Sprintf("%q is not valid range metadata key: %s", string(i.Key), i.Msg) 34 }