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

     1  package flexibletable
     2  
     3  import "fmt"
     4  
     5  // InconsistentRowsError is an error that is returned when number of columns
     6  // are inconsistent across rows.
     7  type InconsistentRowsError struct {
     8  	existingRows int
     9  	newRow       int
    10  }
    11  
    12  // Error implements the error interface
    13  func (e InconsistentRowsError) Error() string {
    14  	return fmt.Sprintf("existing rows have %d cells but the new row has %d cells",
    15  		e.existingRows, e.newRow)
    16  }
    17  
    18  // NoRowsError indicates no rows in the table.
    19  type NoRowsError struct{}
    20  
    21  // Error implements the error interface
    22  func (e NoRowsError) Error() string {
    23  	return "no rows"
    24  }
    25  
    26  // WidthTooSmallError indicates the width constraints is too small.
    27  type WidthTooSmallError struct{}
    28  
    29  // Error implements the error interface
    30  func (e WidthTooSmallError) Error() string {
    31  	return "width too small"
    32  }
    33  
    34  // BadOptionError indicates, well, bad options, are given.
    35  type BadOptionError struct {
    36  	optionName string
    37  }
    38  
    39  // Error implements the error interface
    40  func (e BadOptionError) Error() string {
    41  	return fmt.Sprintf("bad option %s", e.optionName)
    42  }