You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: error.go
    path of file: ./repos/iris/middleware/basicauth
    
    the code of the file until where you have to start completion: package basicauth

import (
	"fmt"
	"net/http"
	"time"

	"github.com/kataras/iris/v12/context"
)

type (
	// ErrHTTPVersion is fired when Options.HTTPSOnly was enabled
	// and the current request is a plain http one.
	ErrHTTPVersion struct{}

	// ErrCredentialsForbidden is fired when Options.MaxTries have been consumed
	// by the user and the client is forbidden to retry at least for "Age" time.
	ErrCredentialsForbidden struct {
		Username string
		Password string
		Tries    int
		Age      time.Duration
	}

	// ErrCredentialsMissing is fire
    
func DefaultErrorHandler(ctx *context.Context, err error) {
	switch e := err.(type) {
	case ErrHTTPVersion:
		ctx.StopWithStatus(http.StatusHTTPVersionNotSupported)
	case ErrCredentialsForbidden:
		// If a (proxy) server receives valid credentials that are inadequate to access a given resource,
		// the server should respond with the 403 Forbidden status code.
		// Unlike 401 Unauthorized or 407 Proxy Authentication Required, authentication is impossible for this user.
		ctx.StopWithStatus(http.StatusForbidden)
	case ErrCredentialsMissing:
		unauthorize(ctx, e.AuthenticateHeader, e.AuthenticateHeaderValue, e.Code)
	case ErrCredentialsInvalid:
		unauthorize(ctx, e.AuthenticateHeader, e.AuthenticateHeaderValue, e.Code)
	case ErrCredentialsExpired:
		unauthorize(ctx, e.AuthenticateHeader, e.AuthenticateHeaderValue, e.Code)
	default:
		// This will never happen.
		ctx.StopWithText(http.StatusInternalServerError, "unknown error: %v", err)
	}
}