// Code generated by op-codegen - DO NOT EDIT

package onepassword

import (
	"encoding/json"
	"errors"
)

type DesktopSessionExpiredError struct {
	message string
}

func (e *DesktopSessionExpiredError) Error() string {
	return e.message
}

type RateLimitExceededError struct {
	message string
}

func (e *RateLimitExceededError) Error() string {
	return e.message
}

func unmarshalError(err string) error {
	v := struct {
		Name    string `json:"name"`
		Message string `json:"message"`
	}{}
	if e := json.Unmarshal([]byte(err), &v); e != nil {
		return errors.New(err)
	}
	switch v.Name {
	case "DesktopSessionExpired":
		return &DesktopSessionExpiredError{
			message: v.Message,
		}
	case "RateLimitExceeded":
		return &RateLimitExceededError{
			message: v.Message,
		}
	default:
		return errors.New(v.Message)
	}
}
