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: httperror.go
    path of file: ./repos/bytom/net/http/httperror
    
    the code of the file until where you have to start completion: // Package httperror defines the format for HTTP error responses
// from Chain services.
package httperror

import (
	"context"
	"net/http"

	"github.com/bytom/bytom/errors"
	"github.com/bytom/bytom/net/http/httpjson"
)

// Info contains a set of error codes to send to the user.
type Info struct {
	HTTPStatus int    `json:"-"`
	ChainCode  string `json:"code"`
	Message    string `json:"msg"`
}

// Response defines the error resp
    
func (f Formatter) Format(err error) (body Response) {
	root := errors.Root(err)
	// Some types cannot be used as map keys, for example slices.
	// If an error's underlying type is one of these, don't panic.
	// Just treat it like any other missing entry.
	defer func() {
		if err := recover(); err != nil {
			body = Response{f.Default, "fail", "", nil, true}
		}
	}()
	info, ok := f.Errors[root]
	if !ok {
		info = f.Default
	}

	body = Response{
		Info:      info,
		Status:    "fail",
		Detail:    errors.Detail(err),
		Data:      errors.Data(err),
		Temporary: f.IsTemporary(info, err),
	}
	return body
}