func (w *WriterFuncs) WriteErrorPage(rw http.ResponseWriter, opts ErrorPageOpts) {
	if w.ErrorPageFunc != nil {
		w.ErrorPageFunc(rw, opts)
		return
	}
	rw.WriteHeader(opts.Status)
	errMsg := fmt.Sprintf("%d - %v", opts.Status, opts.AppError)
	if _, err := rw.Write([]byte(errMsg)); err != nil {
		rw.WriteHeader(http.StatusInternalServerError)
	}
}
WriteErrorPage implements the Writer interface.
If the ErrorPageFunc is provided, this will be used, else a default
implementation will be used.
package pagewriter
import (
	"fmt"
	"net/http"
)
type Writer interface {
	WriteSignInPage(rw http.ResponseWriter, req *http.Request, redirectURL string)
	WriteErrorPage(rw http.ResponseWriter, opts ErrorPageOpts)
	ProxyErrorHandler(rw http.ResponseWriter, req *http.Request, proxyErr error)
	WriteRobotsTxt(rw http.ResponseWriter, req *http.Request)
}
type pageWriter struct {
	*errorPageWriter
	*signInPageWriter
	*staticPageWriter
}
type Opts struct {
	TemplatesPath string
	ProxyPrefix string
	Footer string
	Version string
	Debug bool
	DisplayLoginForm bool
	ProviderName string
	SignInMessage string
	CustomLogo string
}
func NewWriter(opts Opts) (Writer, error) {
	templates, err := loadTemplates(opts.TemplatesPath)
	if err != nil {
		return nil, fmt.Errorf("error loading templates: %v", err)
	}
	logoData, err := loadCustomLogo(opts.CustomLogo)
	if err != nil {
		return nil, fmt.Errorf("error loading logo: %v", err)
	}
	errorPage := &errorPageWriter{
		template:    templates.Lookup("error.html"),
		proxyPrefix: opts.ProxyPrefix,
		footer:      opts.Footer,
		version:     opts.Version,
		debug:       opts.Debug,
	}
	signInPage := &signInPageWriter{
		template:         templates.Lookup("sign_in.html"),
		errorPageWriter:  errorPage,
		proxyPrefix:      opts.ProxyPrefix,
		providerName:     opts.ProviderName,
		signInMessage:    opts.SignInMessage,
		footer:           opts.Footer,
		version:          opts.Version,
		displayLoginForm: opts.DisplayLoginForm,
		logoData:         logoData,
	}
	staticPages, err := newStaticPageWriter(opts.TemplatesPath, errorPage)
	if err != nil {
		return nil, fmt.Errorf("error loading static page writer: %v", err)
	}
	return &pageWriter{
		errorPageWriter:  errorPage,
		signInPageWriter: signInPage,
		staticPageWriter: staticPages,
	}, nil
}
type WriterFuncs struct {
	SignInPageFunc func(rw http.ResponseWriter, req *http.Request, redirectURL string)
	ErrorPageFunc  func(rw http.ResponseWriter, opts ErrorPageOpts)
	ProxyErrorFunc func(rw http.ResponseWriter, req *http.Request, proxyErr error)
	RobotsTxtfunc  func(rw http.ResponseWriter, req *http.Request)
}
func (w *WriterFuncs) WriteSignInPage(rw http.ResponseWriter, req *http.Request, redirectURL string) {
	if w.SignInPageFunc != nil {
		w.SignInPageFunc(rw, req, redirectURL)
		return
	}
	if _, err := rw.Write([]byte("Sign In")); err != nil {
		rw.WriteHeader(http.StatusInternalServerError)
	}
}