This commit is contained in:
parent
98191fd098
commit
d272fa90b4
20 changed files with 574 additions and 27 deletions
22
web/public/errorpages.go
Normal file
22
web/public/errorpages.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
package webpublic
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
webutils "git.mstar.dev/mstar/goutils/http"
|
||||
)
|
||||
|
||||
var errorDescriptions = map[string]string{
|
||||
"webfinger-bad-resource": "The given format for the \"resource\" url parameter was missing or invalid. It must follow the form \"acct:<username>@<domain>\"",
|
||||
"db-failure": "The database query for this request failed for an undisclosed reason. This is often caused by bad input data conflicting with existing information. Try to submit different data or wait for some time",
|
||||
}
|
||||
|
||||
func errorTypeHandler(w http.ResponseWriter, r *http.Request) {
|
||||
errName := r.PathValue("name")
|
||||
if description, ok := errorDescriptions[errName]; ok {
|
||||
fmt.Fprint(w, description)
|
||||
} else {
|
||||
webutils.ProblemDetailsStatusOnly(w, 404)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue