Skip to content

Commit

Permalink
fix comments for HTTP funcs, add QuickWrap to instance (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvndaai authored Jan 10, 2023
1 parent 6faca81 commit 2e8b227
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions ctxerr.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ const (
FieldKeyStatusCode = "error_status_code"
// FieldKeyAction is an action that a user can take to fix the error
FieldKeyAction = "error_action"
//FieldKeyCategory can be used with IsCategorgy(...) to determin a category of error
// FieldKeyCategory can be used with IsCategorgy(...) to determin a category of error
FieldKeyCategory = "error_category"
//FieldKeyLocation shows the file location of the err
// FieldKeyLocation shows the file location of the err
FieldKeyLocation = "error_location"
)

Expand Down Expand Up @@ -266,7 +266,10 @@ func (in Instance) Wrapf(ctx context.Context, err error, code, message string, m

// QuickWrap will wrap an error with an empty code and the calling function's name as the message
func QuickWrap(ctx context.Context, err error) error {
return Wrap(ctx, err, "", nil)
return global.Wrap(ctx, err, "", nil)
}
func (in Instance) QuickWrap(ctx context.Context, err error) error {
return in.Wrap(ctx, err, "", nil)
}

// Fields retrieves the fields from the context
Expand Down Expand Up @@ -514,7 +517,7 @@ func (in Instance) NewHTTP(ctx context.Context, code, action string, statusCode
return in.New(ctx, code, message...)
}

// Newf creates a new error with action and status code and message formatting
// NewHTTPf creates a new error with action and status code and message formatting
func NewHTTPf(ctx context.Context, code, action string, statusCode int, message string, messageArgs ...interface{}) error {
return global.NewHTTPf(ctx, code, action, statusCode, message, messageArgs...)
}
Expand All @@ -528,7 +531,7 @@ func (in Instance) NewHTTPf(ctx context.Context, code, action string, statusCode
return in.Newf(ctx, code, message, messageArgs...)
}

// Wrap creates a new error with action and status code and another wrapped under it
// WrapHTTP creates a new error with action and status code and another wrapped under it
func WrapHTTP(ctx context.Context, err error, code, action string, statusCode int, message ...interface{}) error {
return global.WrapHTTP(ctx, err, code, action, statusCode, message...)
}
Expand All @@ -542,7 +545,7 @@ func (in Instance) WrapHTTP(ctx context.Context, err error, code, action string,
return in.Wrap(ctx, err, code, message...)
}

// Wrapf creates a new error with action and status code and a formatted message with another wrapped under it
// WrapHTTPf creates a new error with action and status code and a formatted message with another wrapped under it
func WrapHTTPf(ctx context.Context, err error, code, action string, statusCode int, message string, messageArgs ...interface{}) error {
return global.WrapHTTPf(ctx, err, code, action, statusCode, message, messageArgs...)
}
Expand Down

0 comments on commit 2e8b227

Please sign in to comment.