func LookupErrorType(code int) ErrorType {
	for t, c := range errorTypeToStatusCodeMap {
		if c == code {
			return t
		}
	}
	return UnknownError
}
LookupErrorType returns the ErrorType for the given HTTP StatusCode,
UnknownError is returned if the error type could not be found.
package apitypes
import (
	"encoding/json"
	"strings"
	"github.com/manifoldco/go-base64"
	"github.com/manifoldco/torus-cli/envelope"
	"github.com/manifoldco/torus-cli/identity"
)
type ErrorType string
const (
	BadRequestError     = "bad_request"
	UnauthorizedError   = "unauthorized"
	NotFoundError       = "not_found"
	RequestTimeoutError = "request_timeout"
	InternalServerError = "internal_server"
	NotImplementedError = "not_implemented"
	UnknownError        = "unknown_error"
)
var errorTypeToStatusCodeMap = map[ErrorType]int{
	BadRequestError:     400,
	UnauthorizedError:   401,
	NotFoundError:       404,
	RequestTimeoutError: 408,
	InternalServerError: 500,
	NotImplementedError: 501,
	UnknownError:        0,
}