File: errors.go

package info (click to toggle)
golang-github-openfga-go-sdk 0.6.5-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid, trixie
  • size: 1,960 kB
  • sloc: makefile: 13
file content (52 lines) | stat: -rw-r--r-- 1,361 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/**
 * Go SDK for OpenFGA
 *
 * API version: 1.x
 * Website: https://openfga.dev
 * Documentation: https://openfga.dev/docs
 * Support: https://openfga.dev/community
 * License: [Apache-2.0](https://github.com/openfga/go-sdk/blob/main/LICENSE)
 *
 * NOTE: This file was auto generated by OpenAPI Generator (https://openapi-generator.tech). DO NOT EDIT.
 */

package client

// FgaRequiredParamError Provides access to the body, error and model on returned errors.
type FgaRequiredParamError struct {
	error string
	param string
}

// Error returns non-empty string if there was an error.
func (e FgaRequiredParamError) Error() string {
	if e.error == "" {
		return "Required parameter " + e.Param() + " was not provided"
	}
	return e.error
}

// Param returns the name of the missing parameter
func (e FgaRequiredParamError) Param() string {
	return e.param
}

// FgaInvalidError Provides access to the body, error and model on returned errors.
type FgaInvalidError struct {
	error       string
	param       string
	description string
}

// Error returns non-empty string if there was an error.
func (e FgaInvalidError) Error() string {
	if e.error == "" {
		return "Parameter " + e.Param() + " is not a valid " + e.description
	}
	return e.error
}

// Param returns the name of the invalid parameter
func (e FgaInvalidError) Param() string {
	return e.param
}