./devel/go-errors, Simple error handling primitives

[ CVSweb ] [ Homepage ] [ RSS ] [ Required by ] [ Add to tracker ]


Branch: CURRENT, Version: 0.8.0nb4, Package name: go-errors-0.8.0nb4, Maintainer: pkgsrc-users

Package errors provides simple error handling primitives.

The traditional error handling idiom in Go is roughly akin to

if err != nil {
return err
}

which applied recursively up the call stack results in error reports without
context or debugging information. The errors package allows programmers to add
context to the failure path in their code in a way that does not destroy the
original value of the error.


Required to build:
[pkgtools/cwrappers] [lang/go112]

Master sites:

SHA1: 6256e89cb3c94189180096eb804d9c8c90088fb5
RMD160: 473ecf6cada7287f2e27c90509d351f98895ecf3
Filesize: 11.078 KB

Version history: (Expand)


CVS history: (Expand)


   2019-03-16 09:35:51 by Benny Siegert | Files touched by this commit (143) | Package updated
Log message:
Revbump all Go packages after Go 1.12.1 update.
   2019-03-09 11:05:15 by Benny Siegert | Files touched by this commit (143)
Log message:
all: revbump Go packages, now that they use go112 to build
   2019-01-24 11:00:46 by Benny Siegert | Files touched by this commit (144) | Package updated
Log message:
Revbump Go packages after lang/go111 update.
   2018-12-19 16:47:12 by Benny Siegert | Files touched by this commit (141) | Package updated
Log message:
Revbump all Go packages after go111 update.
   2018-11-18 08:29:52 by Ryo ONODERA | Files touched by this commit (3) | Package updated
Log message:
Update to 0.8.0

Changelog:
0.8.0:
What's new since version 0.7.1

errors 0.8.0 decomposes Wrap (and Wrapf) into their component operations, namely \ 
adding a message to an error, and adding a stack trace to an error, which were \ 
previously merged into a single operation.

This is accomplished by adding two top level functions, errors.WithMessage and \ 
errors.WithStack, and rewriting Wrap and Wrapf in terms of these operations.

The motivation for this change was need to treat each of the following \ 
operations as distinct:

    Adding a context message to an existing error without altering the stack trace.
    Adding a stack trace to an existing error without the requirement of adding \ 
an additional message.
    Retrieving the immediate cause of an error; popping one element of the error \ 
stack.

The addition of WithStack and WithMessage increases the surface area of this \ 
package by two methods, after long discussions at GopherCon 2016 it was felt \ 
strongly that destructuring the operation of Wrap and Wrapf was necessary.

For the moment Wrap and Wrapf remain, but depending on your feedback may be \ 
deprecated in future releases. Please leave comments via the issue link.

Thanks to @nmiyake and @fabstu for their assistance in preparing this release.
Bug fixes

    Add Go 1.7.1 to .travis.yml. Thanks @Thomasdezeeuw

0.7.1:
What's new since version 0.7.0

0.7.1 is a minor release in the 0.7 series which contains bugfixes, \ 
documentation improvements and cleanups and some internal refactoring.
Improvements

    Rename StackTrace interface to stacktracer in docs and examples.
    Capitalise first letter of trace in examples. Thanks @jongillham
    Wrapped errors now print full stacktrace.
    Documentation improvements, #69. Thanks @AlekSi
    Added benchmarks comparing stack trace performance. Fixes #72. Thanks @kardianos

Bug fixes

    Fix %q format for wrapped errors. Thanks @greensnark
    Remove trailing newline from LICENSE file. Thanks @vbatts
    Tests now pass when pkg/errors is vendored. Fixes #77. Thanks @exp
    Fix the %q format for errors so it puts "" around the output \ 
(caused by a bug introduced between 0.7.0 and 0.7.1). Thanks @ncw

0.7.0:
What's new since version 0.6.0

0.7.0 removes the deprecated errors.Location and errors.Stack interfaces, and \ 
the errors.Fprint helper. Types returned from this package now implement the \ 
fmt.Formatter interface and can print themselves when passed to fmt.Printf and \ 
friends.

For example:

    fmt.Printf("%s\n", err) will print the message of the error as per \ 
normal, recursive if the underlying error has a Cause method.
    fmt.Printf(%v\n", err) operates the same as %s.
    fmt.Printf(%+v\n", err) prints the error message as above, then prints \ 
a stack trace of the point that the error was created with errors.New, \ 
errors.Errorf, etc.

This new behaviour is described in this blog post.

Other changes in 0.7.0 include:

    The Stacktrace() []Frame interface method was renamed to StackTrace() \ 
StackTrace. Please note the change in capitalisation. The previous interface was \ 
added in 0.6.0 so hopefully this change will not cause to many breaking changes. \ 
The name and signature of the method is not expected to change again in the \ 
future. Fixes #50.

Bug fixes

    README.md incorrectly reported the licence of this package as MIT, not BSD 2 \ 
clause, this has been rectified. Thanks @anthonyfok. Fixes #41.
   2018-11-04 19:38:09 by Benny Siegert | Files touched by this commit (122) | Package updated
Log message:
Revbump all Go packages after go111 update.
   2018-06-12 19:50:29 by Benny Siegert | Files touched by this commit (102) | Package updated
Log message:
Revbump all Go packages after lang/go update.
   2018-03-30 13:56:27 by Benny Siegert | Files touched by this commit (94) | Package updated
Log message:
Revbump all Go packages after 1.10.1 update.

ok wiz@ for committing during freeze