Code Monkey home page Code Monkey logo

bear's Introduction

Bear

Bear is an error package for making errors in go awesome. It's designed to be extreamly flexible, letting you use errors in the way that best fits your code base. Bear focuses on making errors easy to interpret especially at scale. This means Bear focuses on giving you good ways go gropu errors together and generate meaningful reports about the errors your code is generating.

Roadmap

There are future features that are planned for this library. They are ordered roughly in the order of priority. This list is likely to change a lot and none of these features should be considerd gaurenteed.

  • Add a Wrap method to the Template type

  • Add a one stack option to print only the longest stack (e.g. the stack of the most senior error)

  • Improve the error stack. Right now it's including files like proc.go and asm_amd64.s

  • Add more options to transform JSON (filters, ordering, extra fields, etc.)

  • Options to transform labels (filters, combinations, extra lables, etc.)

  • Options to transform tags (filters, combinations, extra tags, ext.)

  • Options to transform metrics (filters, combinations, extra metrics, etx.)

  • Combining Metric and FMetric into a single type, this will allow them to show up in the same place in the resulting json and prevent any differences showing up between the two types

bear's People

Contributors

bjatkin avatar

Watchers

 avatar

bear's Issues

Fmt Issues are respected by deeply nested errors

When using fmt options like FmtNoStack and FmtNoID the original error and parent errors respect these options when rendering output. However, beyond that (e.g. grandparent errors, great-grandparent errors) These options are no longer respected.

Example:

package main

import (
	"github.com/bjatkin/bear"
)

func main() {
	err1 := bear.New(bear.WithLabels("first"))
	err2 := bear.Wrap(err1, bear.WithLabels("second"))
	err3 := bear.Wrap(err2,
		bear.WithLabels("third"),
		bear.FmtPrettyPrint(true),
		bear.FmtNoID(true),
		bear.FmtNoStack(true),
	)

	err3.Panic(true)
}

Expected Output:

{
  "parents": [
    {
      "parents": [
        {
          "labels": [
            "first"
          ],
        }
      ],
      "labels": [
        "second"
      ]
    }
  ],
  "labels": [
    "third"
  ]
}
panic: 1

Actual Output:

{
  "parents": [
    {
      "parents": [
        {
          "id": "90ea479c36e5d40a3f417ec7431fcd2beb56680f9305f590c6df6e8fedf4a5b4",
          "labels": [
            "first"
          ],
          "stack": [
            "main.go:9",
            "/usr/local/go/src/runtime/proc.go:250",
            "/usr/local/go/src/runtime/asm_amd64.s:1571"
          ]
        }
      ],
      "labels": [
        "second"
      ]
    }
  ],
  "labels": [
    "third"
  ]
}
panic: 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.