github.com/openfga/go-sdk@v0.3.5/client/errors.go (about)

     1  /**
     2   * Go SDK for OpenFGA
     3   *
     4   * API version: 0.1
     5   * Website: https://openfga.dev
     6   * Documentation: https://openfga.dev/docs
     7   * Support: https://discord.gg/8naAwJfWN6
     8   * License: [Apache-2.0](https://github.com/openfga/go-sdk/blob/main/LICENSE)
     9   *
    10   * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT.
    11   */
    12  
    13  package client
    14  
    15  // FgaRequiredParamError Provides access to the body, error and model on returned errors.
    16  type FgaRequiredParamError struct {
    17  	error string
    18  	param string
    19  }
    20  
    21  // Error returns non-empty string if there was an error.
    22  func (e FgaRequiredParamError) Error() string {
    23  	if e.error == "" {
    24  		return "Required parameter " + e.Param() + " was not provided"
    25  	}
    26  	return e.error
    27  }
    28  
    29  // Param returns the name of the missing parameter
    30  func (e FgaRequiredParamError) Param() string {
    31  	return e.param
    32  }
    33  
    34  // FgaInvalidError Provides access to the body, error and model on returned errors.
    35  type FgaInvalidError struct {
    36  	error       string
    37  	param       string
    38  	description string
    39  }
    40  
    41  // Error returns non-empty string if there was an error.
    42  func (e FgaInvalidError) Error() string {
    43  	if e.error == "" {
    44  		return "Parameter " + e.Param() + " is not a valid " + e.description
    45  	}
    46  	return e.error
    47  }
    48  
    49  // Param returns the name of the invalid parameter
    50  func (e FgaInvalidError) Param() string {
    51  	return e.param
    52  }