Skip to content

vscode debugger support for errtrace.FormatString #83

@philippseith

Description

@philippseith

When debugging in vscode (or dlv) errors wrapped by errtrace are not shown in a nice way.

err: error(*braces.dev/errtrace.errTrace) *{err: error(*braces.dev/errtrace.errTrace) *{err: error(*braces.dev/errtrace.errTrace) ..., pc: 7387741}, pc: 7346695}
  data: *braces.dev/errtrace.errTrace {err: error(*braces.dev/errtrace.errTrace) *{err: error(*braces.dev/errtrace.errTrace) ..., pc: 7387741}, pc: 7346695}
... and so on

It is possible use call errtrace.FormatString(err) in the vscode Watch window, but if the method is not used elsewhere in you code, you will get a could not find symbol value for errtrace from the Watch window instead.
This is caused by go's dead code elimination.

Workaround: put _ = errtrace.FormatString(errors.ErrUnsupported) somewhere in your code.

What about adding this as

func init() {
	_ = errtrace.FormatString(errors.ErrUnsupported)
}

to errtrace itself?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions