Display a message when there has been an error
Signed-off-by: Oliver Davies <oliver@oliverdavies.uk>
This commit is contained in:
parent
075bbaac5e
commit
fe620bc9d9
1 changed files with 4 additions and 1 deletions
|
@ -16,7 +16,10 @@ func handler(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
|
||||||
if (code != 200) {
|
if (code != 200) {
|
||||||
json.NewEncoder(w).Encode(map[string]any{})
|
json.NewEncoder(w).Encode(map[string]any{
|
||||||
|
"message": "There has been an error.",
|
||||||
|
"statusCode": code,
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
json.NewEncoder(w).Encode(map[string]string{
|
json.NewEncoder(w).Encode(map[string]string{
|
||||||
"name": "Oliver Davies",
|
"name": "Oliver Davies",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue