Skip to content

Commit f9152f1

Browse files
committed
error/error.go: Improve godocs (no OCI references, etc.)
Remove OCI references from the comments, because this is a generic RFC 2119 package and has nothing OCI-specific. Also document the Error properties. Signed-off-by: W. Trevor King <[email protected]>
1 parent d268fb2 commit f9152f1

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

Diff for: error/error.go

+11-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"strings"
88
)
99

10-
// Level represents the OCI compliance levels
10+
// Level represents the RFC 2119 compliance levels
1111
type Level int
1212

1313
const (
@@ -43,14 +43,19 @@ const (
4343
Required
4444
)
4545

46-
// Error represents an error with compliance level and OCI reference.
46+
// Error represents an error with compliance level and specification reference.
4747
type Error struct {
48-
Level Level
48+
// Level represents the RFC 2119 compliance level.
49+
Level Level
50+
51+
// Reference is a URL for the violated specification requirement.
4952
Reference string
50-
Err error
53+
54+
// Err holds additional details about the violation.
55+
Err error
5156
}
5257

53-
// ParseLevel takes a string level and returns the OCI compliance level constant.
58+
// ParseLevel takes a string level and returns the RFC 2119 compliance level constant.
5459
func ParseLevel(level string) (Level, error) {
5560
switch strings.ToUpper(level) {
5661
case "MAY":
@@ -81,7 +86,7 @@ func ParseLevel(level string) (Level, error) {
8186
return l, fmt.Errorf("%q is not a valid compliance level", level)
8287
}
8388

84-
// Error returns the error message with OCI reference
89+
// Error returns the error message with specification reference.
8590
func (err *Error) Error() string {
8691
return fmt.Sprintf("%s\nRefer to: %s", err.Err.Error(), err.Reference)
8792
}

0 commit comments

Comments
 (0)