Unify error messages
This commit is contained in:
@@ -2,7 +2,6 @@ package atom
|
||||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"errors"
|
||||
"fmt"
|
||||
"mime"
|
||||
)
|
||||
@@ -27,7 +26,7 @@ func newOutOfLineContent(mediaType string, content any) (*OutOfLineContent, erro
|
||||
}
|
||||
|
||||
if !isValidIRI(iri) {
|
||||
return nil, errors.New("content not a valid uri")
|
||||
return nil, fmt.Errorf("content %v not a valid uri", iri)
|
||||
}
|
||||
|
||||
return &OutOfLineContent{Type: MediaType(mediaType), SRC: iri}, nil
|
||||
@@ -54,11 +53,11 @@ func (o *OutOfLineContent) Check() error {
|
||||
}
|
||||
|
||||
if isCompositeMediaType(mediaType) {
|
||||
return errors.New("type attribute of out of line content must not be a composite type")
|
||||
return fmt.Errorf("type attribute of out of line content %v must not be a composite type", o)
|
||||
}
|
||||
|
||||
if o.SRC == "" {
|
||||
return errors.New("src attribute of out of line content empty")
|
||||
return fmt.Errorf("src attribute of out of line content %v empty", o)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user