status

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

README

status

import "github.com/SuperBuker/terraform-provider-dns-he-net/client/status"

Index

Variables

TODO: extend ErrOTPAuthFailed?

var knownIssues = map[string]error{
    "Incorrect":                         &ErrAuthFailed{"Incorrect"},
    "The token supplied is invalid.":    &ErrOTPAuthFailed{"The token supplied is invalid."},
    "This token has already been used.": &ErrOTPAuthFailed{"This token has already been used. You may not reuse tokens."},
    "You may not reuse tokens.":         nil,
}

func Check

func Check(doc *html.Node) (string, []string, error)

Check checks all possible errors in the response. - If the user is not fully logged in. - If there are other contained errors. - If there are error messges in the response. - Sorts errors output by severity

func errorMerging

func errorMerging(errs []error) error

func errorScore

func errorScore(err error) int

func filterIssues

func filterIssues(issues []string) ([]string, []error)

func fromAuthStatus

func fromAuthStatus(status auth.Status) (err error)

fromAuthStatus returns an error asssociated to the auth status.

func fromIssue

func fromIssue(issues []string) (errs []error)

fromIssue parses the errors in the response and returns them as &ErrHeNet{}.

type ErrAuthFailed

ErrAuthFailed is an error that is returned when authentication fails.

type ErrAuthFailed struct {
    error string
}
func (*ErrAuthFailed) Error
func (e *ErrAuthFailed) Error() string
func (*ErrAuthFailed) Unwrap
func (e *ErrAuthFailed) Unwrap() []error

type ErrHeNet

ErrHeNet is an error returned when dns.he.net returns an error. It contains the error message returned in the HTML response.

type ErrHeNet struct {
    error string
}
func (*ErrHeNet) Error
func (e *ErrHeNet) Error() string

type ErrMissingOTPAuth

ErrMissingOTPAuth is an error returned when the user is not fully authenticated. It is used when dns.he.net returns that the client lacks OTP authentication. It includes two wrapped errors, ErrAuth and ErrHeNet.

type ErrMissingOTPAuth struct{}
func (*ErrMissingOTPAuth) Error
func (e *ErrMissingOTPAuth) Error() string
func (*ErrMissingOTPAuth) Unwrap
func (e *ErrMissingOTPAuth) Unwrap() []error

type ErrNoAuth

ErrNoAuth is an error returned when the user is not authenticated. It is used when dns.he.net returns that the client is not authenticated. It includes two wrapped errors, ErrAuth and ErrHeNet.

type ErrNoAuth struct{}
func (*ErrNoAuth) Error
func (e *ErrNoAuth) Error() string
func (*ErrNoAuth) Unwrap
func (e *ErrNoAuth) Unwrap() []error

type ErrOTPAuthFailed

ErrOTPAuthFailed is an error that is returned when authentication fails.

type ErrOTPAuthFailed struct {
    error string
}
func (*ErrOTPAuthFailed) Error
func (e *ErrOTPAuthFailed) Error() string
func (*ErrOTPAuthFailed) Unwrap
func (e *ErrOTPAuthFailed) Unwrap() []error

type ErrPartialAuth

ErrPartialAuth is an error that is returned when authentication is incomplete.

type ErrPartialAuth struct{}
func (*ErrPartialAuth) Error
func (e *ErrPartialAuth) Error() string
func (*ErrPartialAuth) Unwrap
func (e *ErrPartialAuth) Unwrap() []error

type ErrUnknownAuth

ErrUnknownAuth is an error returned when it's not possible to determine the authentication status. It includes two wrapped errors, ErrAuth and ErrHeNet.

type ErrUnknownAuth struct{}
func (*ErrUnknownAuth) Error
func (e *ErrUnknownAuth) Error() string
func (*ErrUnknownAuth) Unwrap
func (e *ErrUnknownAuth) Unwrap() []error

Generated by gomarkdoc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(doc *html.Node) (string, []string, error)

Check checks all possible errors in the response.

  • If the user is not fully logged in.
  • If there are other contained errors.
  • If there are error messges in the response.
  • Sorts errors output by severity

Types

type ErrAuthFailed

type ErrAuthFailed struct {
	// contains filtered or unexported fields
}

ErrAuthFailed is an error that is returned when authentication fails.

func (*ErrAuthFailed) Error

func (e *ErrAuthFailed) Error() string

func (*ErrAuthFailed) Unwrap added in v0.0.5

func (e *ErrAuthFailed) Unwrap() []error

type ErrHeNet

type ErrHeNet struct {
	// contains filtered or unexported fields
}

ErrHeNet is an error returned when dns.he.net returns an error. It contains the error message returned in the HTML response.

func (*ErrHeNet) Error

func (e *ErrHeNet) Error() string

type ErrMissingOTPAuth added in v0.0.5

type ErrMissingOTPAuth struct{}

ErrMissingOTPAuth is an error returned when the user is not fully authenticated. It is used when dns.he.net returns that the client lacks OTP authentication. It includes two wrapped errors, ErrAuth and ErrHeNet.

func (*ErrMissingOTPAuth) Error added in v0.0.5

func (e *ErrMissingOTPAuth) Error() string

func (*ErrMissingOTPAuth) Unwrap added in v0.0.5

func (e *ErrMissingOTPAuth) Unwrap() []error

type ErrNoAuth

type ErrNoAuth struct{}

ErrNoAuth is an error returned when the user is not authenticated. It is used when dns.he.net returns that the client is not authenticated. It includes two wrapped errors, ErrAuth and ErrHeNet.

func (*ErrNoAuth) Error

func (e *ErrNoAuth) Error() string

func (*ErrNoAuth) Unwrap

func (e *ErrNoAuth) Unwrap() []error

type ErrOTPAuthFailed added in v0.0.5

type ErrOTPAuthFailed struct {
	// contains filtered or unexported fields
}

ErrOTPAuthFailed is an error that is returned when authentication fails.

func (*ErrOTPAuthFailed) Error added in v0.0.5

func (e *ErrOTPAuthFailed) Error() string

func (*ErrOTPAuthFailed) Unwrap added in v0.0.5

func (e *ErrOTPAuthFailed) Unwrap() []error

type ErrPartialAuth added in v0.0.5

type ErrPartialAuth struct{}

ErrPartialAuth is an error that is returned when authentication is incomplete.

func (*ErrPartialAuth) Error added in v0.0.5

func (e *ErrPartialAuth) Error() string

func (*ErrPartialAuth) Unwrap added in v0.0.5

func (e *ErrPartialAuth) Unwrap() []error

type ErrUnknownAuth

type ErrUnknownAuth struct{}

ErrUnknownAuth is an error returned when it's not possible to determine the authentication status. It includes two wrapped errors, ErrAuth and ErrHeNet.

func (*ErrUnknownAuth) Error

func (e *ErrUnknownAuth) Error() string

func (*ErrUnknownAuth) Unwrap

func (e *ErrUnknownAuth) Unwrap() []error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL