Debian Codegraph @

v2/sarif/exception.go

raw
1 package sarif
2
3 // Exception ...
4 type Exception struct {
5 InnerExceptions []*Exception `json:"innerExceptions,omitempty"`
6 Kind *string `json:"kind,omitempty"`
7 Message *string `json:"message,omitempty"`
8 Stack *Stack `json:"stack,omitempty"`
9 PropertyBag
10
11 }
12
13 // NewException creates a new Exception and returns a pointer to it
14 func NewException() *Exception {
15 return &Exception{}
16 }
17
18 // WithMessage sets the Message
19 func (exception *Exception) WithMessage(message string) *Exception {
20 exception.Message = &message
21 return exception
22 }
23
24 // WithKind sets the Kind
25 func (exception *Exception) WithKind(kind string) *Exception {
26 exception.Kind = &kind
27 return exception
28 }
29
30 // WithStack sets the Stack
31 func (exception *Exception) WithStack(stack Stack) *Exception {
32 exception.Stack = &stack
33 return exception
34 }
35
36 // WithInnerExceptions sets the InnerExceptions
37 func (exception *Exception) WithInnerExceptions(exceptions []*Exception) *Exception {
38 exception.InnerExceptions = exceptions
39 return exception
40 }
41
42 // AddInnerException ...
43 func (exception *Exception) AddInnerException(toAdd *Exception) {
44 exception.InnerExceptions = append(exception.InnerExceptions, toAdd)
45 }