Commit ed345b72 authored by Mike Jones's avatar Mike Jones 🌶

Censor error messages containing the API key

parent dc007e2f
......@@ -3,6 +3,7 @@ package command
import (
"fmt"
"strconv"
"strings"
"github.com/n7st/lastfm-go/lastfm"
......@@ -32,6 +33,11 @@ type Fn struct {
// error, but just don't include the information they should've sent (or set it
// as unknown).
func fmtError(err error) string {
if strings.Contains("api_key", err.Error()) {
// Sneaky error with API key in it, return generic response
return "There was a problem contacting Last.fm"
}
return fmt.Sprintf("Error: %s", err.Error())
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment