github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/kbfs/tlf/errors.go (about)

     1  // Copyright 2016 Keybase Inc. All rights reserved.
     2  // Use of this source code is governed by a BSD
     3  // license that can be found in the LICENSE file.
     4  
     5  package tlf
     6  
     7  import "fmt"
     8  
     9  // InvalidIDError indicates that a TLF ID string is not parseable or
    10  // invalid.
    11  type InvalidIDError struct {
    12  	id string
    13  }
    14  
    15  func (e InvalidIDError) Error() string {
    16  	return fmt.Sprintf("Invalid TLF ID %q", e.id)
    17  }
    18  
    19  // HandleExtensionMismatchError indicates the expected extension
    20  // doesn't match the server's extension for the given handle.
    21  type HandleExtensionMismatchError struct {
    22  	Expected HandleExtension
    23  	// Actual may be nil.
    24  	Actual *HandleExtension
    25  }
    26  
    27  // Error implements the error interface for HandleExtensionMismatchError
    28  func (e HandleExtensionMismatchError) Error() string {
    29  	return fmt.Sprintf("Folder handle extension mismatch, "+
    30  		"expected: %s, actual: %s", e.Expected, e.Actual)
    31  }
    32  
    33  // BadNameError indicates a top-level folder name that has an
    34  // incorrect format.
    35  type BadNameError struct {
    36  	Name string
    37  }
    38  
    39  // Error implements the error interface for BadNameError.
    40  func (e BadNameError) Error() string {
    41  	return fmt.Sprintf("TLF name %s is in an incorrect format", e.Name)
    42  }