Improve error messages related to Selectors

This change modifies the error messages related to Selectors by
delegating formatting to the Selector's String method.

Change-Id: I88acb70751509e588139ea26a8388661b3f63511
Relates-To: #145
This commit is contained in:
Ian Howell 2020-03-31 10:28:28 -05:00
parent 0ad22d69b6
commit bc949f259f

View File

@ -28,7 +28,7 @@ type ErrMultipleDocsFound struct {
} }
func (e ErrDocNotFound) Error() string { func (e ErrDocNotFound) Error() string {
return fmt.Sprintf("Document filtered by selector %q found no documents", e.Selector) return fmt.Sprintf("Document filtered by selector %v found no documents", e.Selector)
} }
func (e ErrDocumentDataKeyNotFound) Error() string { func (e ErrDocumentDataKeyNotFound) Error() string {
@ -40,5 +40,5 @@ func (e ErrDocumentMalformed) Error() string {
} }
func (e ErrMultipleDocsFound) Error() string { func (e ErrMultipleDocsFound) Error() string {
return fmt.Sprintf("Document filtered by selector %q found more than one document", e.Selector) return fmt.Sprintf("Document filtered by selector %v found more than one document", e.Selector)
} }