Change errors export from Descriptors to ErrorDescriptors
This commit is contained in:
parent
e14e5d14b1
commit
92dca269f0
3 changed files with 8 additions and 8 deletions
|
@ -26,9 +26,9 @@ type ErrorDescriptor struct {
|
|||
HTTPStatusCodes []int
|
||||
}
|
||||
|
||||
// Descriptors provides a list of HTTP API Error codes that may be encountered
|
||||
// when interacting with the registry API.
|
||||
var Descriptors = []ErrorDescriptor{
|
||||
// ErrorDescriptors provides a list of HTTP API Error codes that may be
|
||||
// encountered when interacting with the registry API.
|
||||
var ErrorDescriptors = []ErrorDescriptor{
|
||||
{
|
||||
Code: ErrorCodeUnknown,
|
||||
Value: "UNKNOWN",
|
||||
|
@ -131,10 +131,10 @@ var errorCodeToDescriptors map[ErrorCode]ErrorDescriptor
|
|||
var idToDescriptors map[string]ErrorDescriptor
|
||||
|
||||
func init() {
|
||||
errorCodeToDescriptors = make(map[ErrorCode]ErrorDescriptor, len(Descriptors))
|
||||
idToDescriptors = make(map[string]ErrorDescriptor, len(Descriptors))
|
||||
errorCodeToDescriptors = make(map[ErrorCode]ErrorDescriptor, len(ErrorDescriptors))
|
||||
idToDescriptors = make(map[string]ErrorDescriptor, len(ErrorDescriptors))
|
||||
|
||||
for _, descriptor := range Descriptors {
|
||||
for _, descriptor := range ErrorDescriptors {
|
||||
errorCodeToDescriptors[descriptor.Code] = descriptor
|
||||
idToDescriptors[descriptor.Value] = descriptor
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import (
|
|||
// TestErrorCodes ensures that error code format, mappings and
|
||||
// marshaling/unmarshaling. round trips are stable.
|
||||
func TestErrorCodes(t *testing.T) {
|
||||
for _, desc := range Descriptors {
|
||||
for _, desc := range ErrorDescriptors {
|
||||
if desc.Code.String() != desc.Value {
|
||||
t.Fatalf("error code string incorrect: %q != %q", desc.Code.String(), desc.Value)
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ func dumpErrors(wr io.Writer) {
|
|||
|
||||
fmt.Fprintln(writer, "\n"+divider)
|
||||
|
||||
for _, descriptor := range errors.Descriptors {
|
||||
for _, descriptor := range errors.ErrorDescriptors {
|
||||
fmt.Fprint(writer, "|")
|
||||
|
||||
v := reflect.ValueOf(descriptor)
|
||||
|
|
Loading…
Reference in a new issue