* * Panicking methods. * These are where the component logic is implemented, * so they could panic, and if they do, the system shouldn't crash. */
(ctx core.TriggerContext)
| 66 | * so they could panic, and if they do, the system shouldn't crash. |
| 67 | */ |
| 68 | func (s *PanicableTrigger) Setup(ctx core.TriggerContext) (err error) { |
| 69 | defer func() { |
| 70 | if r := recover(); r != nil { |
| 71 | ctx.Logger.Errorf("Trigger %s panicked in Setup(): %v\nStack: %s", |
| 72 | s.underlying.Name(), r, debug.Stack()) |
| 73 | err = fmt.Errorf("trigger %s panicked in Setup(): %v", |
| 74 | s.underlying.Name(), r) |
| 75 | } |
| 76 | }() |
| 77 | return s.underlying.Setup(ctx) |
| 78 | } |
| 79 | |
| 80 | func (s *PanicableTrigger) HandleWebhook(ctx core.WebhookRequestContext) (status int, response *core.WebhookResponseBody, err error) { |
| 81 | defer func() { |