goldberry/errors.go

23 lines
1.5 KiB
Go

package main
import (
"fmt"
)
const (
WebDisabled string = `<h1 class="error-header">X1</h1><p>Loading http(s) URLs is disabled currently disabled.</p><p>This can be adjusted in your settings. Which can be found in one of these locations:</p><ul><li><pre>$XDG_CONFIG_HOME/goldberry/goldberry.json</pre></li><li><pre>~/.config/goldberry/goldberry.json</li></ul>`
GopherDisabled string = `<h1 class="error-header">X2</h1><p>Loading gopher URLs is disabled currently disabled.</p><p>This can be adjusted in your settings. Which can be found in one of these locations:</p><ul><li><pre>$XDG_CONFIG_HOME/goldberry/goldberry.json</pre></li><li><pre>~/.config/goldberry/goldberry.json</li></ul>`
FileDisabled string = `<h1 class="error-header">X3</h1><p>Loading file/local URLs is disabled currently disabled.</p><p>This can be adjusted in your settings. Which can be found in one of these locations:</p><ul><li><pre>$XDG_CONFIG_HOME/goldberry/goldberry.json</pre></li><li><pre>~/.config/goldberry/goldberry.json</li></ul>`
TooManyRedirects string = `<h1 class="error-header">X4</h1><p>Too many redirects were encountered.</p>`
WTFError string = `<h1 class="error-header">X9</h1><p>General client error. This is a code bug and nothing you did wrong as a user.</p>`
)
// Used for status codes returned from gemini, thus the int
func ConvertErrorToHTML(status int, msg string) string {
format := `
<h1 class="error-header">Error: %d</h1>
<p class="">%s</p>
`
return fmt.Sprintf(format, status, msg)
}