Added more error handling and necessary functions

This commit is contained in:
2024-10-19 12:28:09 +02:00
parent d4e7bce5e2
commit f4dfd6d060
22 changed files with 317 additions and 122 deletions

View File

@@ -9,11 +9,11 @@ import (
type Icon struct {
XMLName xml.Name `xml:"icon"`
*CommonAttributes
URI IRI `xml:",chardata"`
URI string `xml:",chardata"` // IRI
}
// NewIcon creates a new Icon. It returns a *Icon and an error.
func NewIcon(uri IRI) (*Icon, error) {
func NewIcon(uri string) (*Icon, error) {
if !isValidIRI(uri) {
return nil, fmt.Errorf("uri %v not correctly formatted", uri)
}