func (e *OAuthError) ShortDescription() string {
	switch e.Code {
	case InvalidRequest:
		return BadRequest
	case InvalidToken:
		return Unauthorized
	case InsufficientScope:
		return Forbidden
	default:
		return e.Code
	}
}
ShortDescription returns the prettified HTTP Errors
package errors
import (
	"errors"
	"strings"
	"istio.io/api/policy/v1beta1"
)
const (
	BadRequest          = "Bad Request"
	Unauthorized        = "Unauthorized"
	Forbidden           = "Forbidden"
	InternalServerError = "Internal Server Error"
)
const (
	InvalidRequest    = "invalid_request"
	InvalidToken      = "invalid_token"
	InsufficientScope = "insufficient_scope"
)
const (
	ExpiredToken = "Token is expired"
)
type OAuthError struct {
	Code   string   `json:"error"`
	Msg    string   `json:"error_description"`
	URI    string   `json:"error_uri"`
	Scopes []string `json:"scopes"`
}
func ExpiredTokenError() *OAuthError {
	return &OAuthError{
		Code: InvalidToken,
		Msg:  ExpiredToken,
	}
}
func UnauthorizedHTTPException(msg string, scopes []string) *OAuthError {
	return &OAuthError{
		Msg:    msg,
		Code:   InvalidToken,
		Scopes: scopes,
	}
}
func BadRequestHTTPException(msg string) *OAuthError {
	return &OAuthError{
		Msg:    msg,
		Code:   InvalidRequest,
		Scopes: nil,
	}
}
func (e *OAuthError) Error() string {
	if e.Code == "" && e.Msg == "" {
		return "an error occurred"
	} else if e.Code == "" {
		return e.Msg
	} else if e.Msg == "" {
		return e.Code
	} else {
		return e.Code + ": " + e.Msg
	}
}