refactor: Update error message and remove commented JSON conversion methods
This commit is contained in:
@@ -49,7 +49,7 @@ func (u URL) Value() (driver.Value, error) {
|
||||
func ParseURL(input string, descr string) (*URL, error) {
|
||||
u, err := url.Parse(input)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%w: Input %s Error %w", ErrURLParse, input, err)
|
||||
return nil, fmt.Errorf("%w: Input %s GeminiError %w", ErrURLParse, input, err)
|
||||
}
|
||||
protocol := u.Scheme
|
||||
hostname := u.Hostname()
|
||||
@@ -60,26 +60,8 @@ func ParseURL(input string, descr string) (*URL, error) {
|
||||
}
|
||||
port, err := strconv.Atoi(strPort)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%w: Input %s Error %w", ErrURLParse, input, err)
|
||||
return nil, fmt.Errorf("%w: Input %s GeminiError %w", ErrURLParse, input, err)
|
||||
}
|
||||
full := fmt.Sprintf("%s://%s:%d%s", protocol, hostname, port, path)
|
||||
return &URL{Protocol: protocol, Hostname: hostname, Port: port, Path: path, Descr: descr, Full: full}, nil
|
||||
}
|
||||
|
||||
//func GeminiUrltoJSON(g URL) string {
|
||||
// // Serialize the Person struct to JSON
|
||||
// jsonData, err := json.Marshal(g)
|
||||
// if err != nil {
|
||||
// logging.LogError("Error serializing to JSON: %w", err)
|
||||
// }
|
||||
// return string(jsonData)
|
||||
//}
|
||||
//
|
||||
//func GeminiUrlFromJSON(input string) URL {
|
||||
// var geminiUrl URL
|
||||
// err := json.Unmarshal([]byte(input), &geminiUrl)
|
||||
// if err != nil {
|
||||
// logging.LogError("Error deserializing from JSON: %w", err)
|
||||
// }
|
||||
// return geminiUrl
|
||||
//}
|
||||
|
||||
Reference in New Issue
Block a user