func (err *baseRequestError) restError() string {
	errorJson := err.FormatError("errors")
	rest, e := json.MarshalIndent(errorJson, "", "  ")  
	if e != nil {
		log.Printf("Problem formatting error as REST response: %s", e.Error())
		return e.Error()
	}
	return string(rest)
}
Format this error into a response to a REST request.
package server
import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)
type requestError interface {
	statusCode() int
	rpcError() map[string]interface{}
	restError() string
}
type baseRequestError struct {
	code int  
	message string  
	reason string
	domain string  
	extraFields map[string]interface{}
}
func (re *baseRequestError) statusCode() int {
	return re.code
}
func (re *baseRequestError) Error() string {
	return re.message
}
func (err *baseRequestError) FormatError(errorListTag string) map[string]interface{} {
	errorMap := map[string]interface{}{
		"domain":  err.domain,
		"reason":  err.reason,
		"message": err.message,
	}
	for k, v := range err.extraFields {
		errorMap[k] = v
	}
	return map[string]interface{}{
		"error": map[string]interface{}{
			errorListTag: []map[string]interface{}{errorMap},
			"code":       err.statusCode(),
			"message":    err.message,
		},
	}
}