rollbar

package
v0.0.0-...-5b4c5eb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewErrorRecorderRepository

func NewErrorRecorderRepository(client Client) repository.ErrorRecorder

func StackTracer

func StackTracer(err error) ([]runtime.Frame, bool)

Types

type Client

type Client interface {
	ErrorWithStackSkipWithExtrasAndContext(
		ctx context.Context,
		level string,
		err error,
		skip int,
		extras map[string]interface{},
	)

	SetStackTracer(stackTracer rollbar.StackTracerFunc)
}

Client abstracts rollbar.Client

type ClientMock

type ClientMock struct {
	// ErrorWithStackSkipWithExtrasAndContextFunc mocks the ErrorWithStackSkipWithExtrasAndContext method.
	ErrorWithStackSkipWithExtrasAndContextFunc func(ctx context.Context, level string, err error, skip int, extras map[string]interface{})

	// SetStackTracerFunc mocks the SetStackTracer method.
	SetStackTracerFunc func(stackTracer rollbar.StackTracerFunc)
	// contains filtered or unexported fields
}

ClientMock is a mock implementation of Client.

func TestSomethingThatUsesClient(t *testing.T) {

	// make and configure a mocked Client
	mockedClient := &ClientMock{
		ErrorWithStackSkipWithExtrasAndContextFunc: func(ctx context.Context, level string, err error, skip int, extras map[string]interface{})  {
			panic("mock out the ErrorWithStackSkipWithExtrasAndContext method")
		},
		SetStackTracerFunc: func(stackTracer rollbar.StackTracerFunc)  {
			panic("mock out the SetStackTracer method")
		},
	}

	// use mockedClient in code that requires Client
	// and then make assertions.

}

func (*ClientMock) ErrorWithStackSkipWithExtrasAndContext

func (mock *ClientMock) ErrorWithStackSkipWithExtrasAndContext(ctx context.Context, level string, err error, skip int, extras map[string]interface{})

ErrorWithStackSkipWithExtrasAndContext calls ErrorWithStackSkipWithExtrasAndContextFunc.

func (*ClientMock) ErrorWithStackSkipWithExtrasAndContextCalls

func (mock *ClientMock) ErrorWithStackSkipWithExtrasAndContextCalls() []struct {
	Ctx    context.Context
	Level  string
	Err    error
	Skip   int
	Extras map[string]interface{}
}

ErrorWithStackSkipWithExtrasAndContextCalls gets all the calls that were made to ErrorWithStackSkipWithExtrasAndContext. Check the length with:

len(mockedClient.ErrorWithStackSkipWithExtrasAndContextCalls())

func (*ClientMock) SetStackTracer

func (mock *ClientMock) SetStackTracer(stackTracer rollbar.StackTracerFunc)

SetStackTracer calls SetStackTracerFunc.

func (*ClientMock) SetStackTracerCalls

func (mock *ClientMock) SetStackTracerCalls() []struct {
	StackTracer rollbar.StackTracerFunc
}

SetStackTracerCalls gets all the calls that were made to SetStackTracer. Check the length with:

len(mockedClient.SetStackTracerCalls())

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL