Skip to content

Releases: mvndaai/ctxerr

add CallerFuncs

24 Sep 20:29
22d6240
Compare
Choose a tag to compare
v0.14.0

add CallerFuncs helper function (#16)

Support `errors.Join` & getting fields from other err types

29 Sep 17:28
e849e02
Compare
Choose a tag to compare
  • The functions AllFields, HasField, and HasCategory now dow a depth first search over the error tree and handle errors.Join that was added in Go1.20.
  • Chagned AllFields, HasField, and HasCategory to get fields from an interface of just Fields() map[string]any instead of the CtxErr interface what needed a context. Now any error that has that interface can give fields not just ones from this package.
  • Added configurable functions to allow adding more field getting functions so if someone prefers the interface FieldMap() map[string]any then they could configure ctxerr to allow that too.

[Backwards incompatible] Fix field hooks

01 Aug 01:08
fa10758
Compare
Choose a tag to compare
  • Change the file signature for field hooks to include context
  • Remove echo and opencensus sub packages. They will be added to ctxerrhelper

add FieldHooks

28 Feb 20:06
2817a2f
Compare
Choose a tag to compare

This allows adding func(any) any functions that get run on SetField(s) which can do things like auto redact structs.

FIx Godoc & add QuickWrap to instance

10 Jan 02:48
2e8b227
Compare
Choose a tag to compare
  • The comments for the HTTP functions were copied and pasted wrong and needed fixing.
  • QuickWrap was missed when creating instance so that was added.

Fix HTTP func to use instance

30 Nov 04:34
6faca81
Compare
Choose a tag to compare

I missed this with the recent change to there being instances of ctxerr instead of just global in case you want different hooks. The HTTP functions always used the global which was a problem.

fix panic on Fields with nil context

05 Aug 21:25
a38680c
Compare
Choose a tag to compare
v0.10.3

fix panic on Fields with nil context (#5)

Readme updates; http traceID key

18 Jul 01:21
8602a98
Compare
Choose a tag to compare
v0.10.2

depricate http TraceID func (#4)

Instance cleanup

22 Jun 05:54
Compare
Choose a tag to compare

Change functions from (in *Instance) to (in Instance) when possible to avoid nil pointer exceptions.

When (in *Instance) is required and is nil added pretty panic to help debugging.

HasField and Instance

22 Jun 05:12
Compare
Choose a tag to compare

New function HasField recursively unwraps to see if a field exists.

Instance

There is a new Instance struct to enable configuration of a non-global News, Wraps, and Handle.

  • CreateHooks are functions to update the context one a New/Wrap
  • HandleHooks are functions that happen on Handle
  • FieldsAsSlice makes getting AllFields return a slice of all values rather than the deepest

This allows for better testing. There are no longer private global configurations.