- Now
-err2-ret-trace
anderr2.SetErrRetTracer
gives us error return traces which are even more readable than-err2-trace
,err2.SetErrorTracer
with long error return traces - A new automatic error formatter/generator added for
TryCopyFile
convention - New features for
sample/
to demonstrate latest features - Extended documentation
assert
package:- bug fix: call stack traversal during unit testing in some situations
- all generics-based functions are inline expansed
- performance is now same as if-statements for all functions
- new assert functions:
MNil
,CNil
,Less
,Greater
, etc. - all assert messages follow Go idiom:
got, want
Asserter
can be set per goroutine:PushAsserter
try
package:- new check functions:
T
,T1
,T2
,T3
, for quick refactoring fromTo
functions to annotate an error locally - all functions are inline expansed: if-statement equal performance
- new check functions:
- Finally! We are very happy, and thanks to all who have helped!
- Lots of documentation updates and cleanups for version 1.0.0
Catch/Handle
take unlimited amount error handler functions- allows building e.g. error handling middlewares
- this is major feature because it allows building helpers/add-ons
- automatic outputs aren't overwritten by given args, only with
assert.Plain
- Minor API fixes to still simplify it:
- remove exported vars, obsolete types and funcs from
assert
pkg Result2.Def2()
sets onlyVal2
- remove exported vars, obsolete types and funcs from
- technical refactorings: variadic function calls only in API level
err2.Stderr
helpers forCatch/Handle
to direct auto-logging + snippetsassert
packageShorter
Longer
helpers for automatic messagesasserter
package remove deprecated slow reflection based funcs- cleanup and refactoring for sample apps
flag
package support to seterr2
andassert
package configurationerr2.Catch
default mode is to log error- cleanup and refactoring, new tests and benchmarks
flag
package support to seterr2
andassert
package configurationerr2.Catch
default mode is to log error- cleanup and refactoring, new tests and benchmarks
- Issue #18: bug fixed: noerr-handler had to be the last one of the err2 handlers
- Significant performance boost for:
defer err2.Handle/Catch()
- 3x faster happy path than the previous version, which is now equal to
simplest
defer
function in theerr
-returning function . (Please see thedefer
benchmarks in theerr2_test.go
and runmake bench_reca
) - the solution caused a change to API, where the core reason is Go's optimization "bug". (We don't have confirmation yet.)
- 3x faster happy path than the previous version, which is now equal to
simplest
- Changed API for deferred error handling:
defer err2.Handle/Catch()
- Obsolete:
defer err2.Handle(&err, func() {}) // <- relaying closure to access err val
- Current version:
Because handler function is not relaying closures any more, it opens a new opportunity to use and build general helper functions:
defer err2.Handle(&err, func(err error) error { return err }) // not a closure
err2.Noop
, etc. - Use auto-migration scripts especially for large code-bases. More information
can be found in the
scripts/
directory's readme file. - Added a new (experimental) API:
This is experimental because we aren't sure if this is something we want to have in the
defer err2.Handle(&err, func(noerr bool) { assert.That(noerr) // noerr is always true!! doSomething() })
err2
package.
- Obsolete:
- Bug fixes:
ResultX.Logf()
now works as it should - More documentation
- New API for immediate error handling:
try out handle/catch err
val := try.Out1strconv.Atois.Catch(10)
- New err2.Catch API for automatic logging
- Performance boost for assert pkg:
defer assert.PushTester(t)()
- Our API has now all the same features Zig's error handling has
- Performance boost for assert pkg:
assert.That(boolVal)
==if boolVal
- Go version 1.18 is a new minimum (was 1.19, use of
atomic.Pointer
) - Generic functions support type aliases
- More support for
assert
package for tests: support for cross module asserts during the tests - Using
assert
pkg for tests allow us to have traversable call stack during unit tests -- cross module boundaries solved - Implementation: simplified
assert
pkg totesting
pkg integration, and especially performance
- Clean and simple API
- Removing deprecated functions:
- Only
err2.Handle
for error returning functions - Only
err2.Catch
for function that doesn't return error - Please see
scripts/README.md
for Auto-migration for your repos
- Only
- Default
err2.SetPanicTracer(os.Stderr)
allowsdefer err2.Catch()
err2.Handle
supports sentinel errors, can now stop panicserr2.Catch
has one generic API and it stops panics as default- Deprecated
CatchTrace
andCatchAll
which merged withCatch
- Auto-migration offered (similar to
go fix
) - Code snippets added
- New assertion functions
- No direct variables in APIs (race), etc.
- Bug-fix: automatic error strings for methods
- Added API to set preferred error string Formatter or implement own
- New super Handle for most of the use cases to simplify the API
- Deferred error handlers are 2x faster now
- Restructuring internal pkgs
- New documentation and tests, etc.
- remove deprecations
- New global err values and
try.IsXX
functions - More documentation
- New assertion functions and helpers for tests
- bug fixes
- Deprecations
- New Tracer API
- Preparing
err2
API for 1.0
- Assertion package integrates with Go's testing system
- Type variables removed
- Auto-migration tool to convert deprecated API usage for your repos
err2.Throwf
added
- Stack Tracing bug fixed
- URL helper restored until migration tool
- Typo in
StackTraceWriter
fixed
- Optimized Stack Tracing
- Documentation
- Benchmarks, other tests
try.IsXX()
bug fix- Lots of new docs
- Automatic Stack Tracing!
- bug-fix:
runtime.Error
types are treated aspanics
now (Issue #1)
try.To()
, Start to use Go genericsassert.That()
and other assert functions with the help of the generics
- Filter functions for non-errors like
io.EOF
assert
package added, and new type helpers
- Go modules are in use
- Documentation update
Returnf
added, not use own transport type anymore but justerror
- Code generation for type helpers
- First draft (Summer 2019)