@@ -50,7 +50,7 @@ func (e *Error) WithUnderlyingErrors(errs ...error) *Error {
5050}
5151
5252// Property extracts a dynamic property value from an error.
53- // A property may belong to this error, or be extracted from the original cause.
53+ // A property may belong to this error or be extracted from the original cause.
5454// The transparency rules are respected to some extent: both the original cause and the transparent wrapper
5555// may have accessible properties, but an opaque wrapper hides the original properties.
5656func (e * Error ) Property (key Property ) (interface {}, bool ) {
@@ -73,7 +73,7 @@ func (e *Error) Property(key Property) (interface{}, bool) {
7373
7474// HasTrait checks if an error possesses the expected trait.
7575// Trait check works just as a type check would: opaque wrap hides the traits of the cause.
76- // Traits are always a property of a type rather than of an instance, so trait check is an alternative to a type check.
76+ // Traits are always properties of a type rather than of an instance, so trait check is an alternative to a type check.
7777// This alternative is preferable, though, as it is less brittle and generally creates less of a dependency.
7878func (e * Error ) HasTrait (key Trait ) bool {
7979 cause := e
@@ -108,6 +108,7 @@ func (e *Error) IsOfType(t *Type) bool {
108108// Type returns the exact type of this error.
109109// With transparent wrapping, such as in Decorate(), returns the type of the original cause.
110110// The result is always not nil, even if the resulting type is impossible to successfully type check against.
111+ //
111112// NB: the exact error type may fail an equality check where a IsOfType() check would succeed.
112113// This may happen if a type is checked against one of its supertypes, for example.
113114// Therefore, handle direct type checks with care or avoid it altogether and use TypeSwitch() or IsForType() instead.
@@ -135,7 +136,7 @@ func (e *Error) Message() string {
135136// Cause returns the immediate (wrapped) cause of current error.
136137// This method could be used to dig for root cause of the error, but it is not advised to do so.
137138// Errors should not require a complex navigation through causes to be properly handled, and the need to do so is a code smell.
138- // Manually extracting cause defeats features such as properties of wrap, behaviour of properties etc.
139+ // Manually extracting cause defeats features such as opaque wrap, behaviour of properties etc.
139140// This method is, therefore, reserved for system utilities, not for general use.
140141func (e * Error ) Cause () error {
141142 return e .cause
@@ -145,8 +146,8 @@ func (e *Error) Cause() error {
145146// Supported verbs:
146147//
147148// %s simple message output
148- // %v same as %s
149- // %+v full output complete with a stack trace
149+ // %v same as %s
150+ // %+v full output complete with a stack trace
150151//
151152// In is nearly always preferable to use %+v format.
152153// If a stack trace is not required, it should be omitted at the moment of creation rather in formatting.
0 commit comments