handle_event_error: Generate a handling function for an invocation error

View source: R/error-handling.R

handle_event_errorR Documentation

Generate a handling function for an invocation error

Description

An error caught during event handling must be handled in a special way. An error message must be logged and posted to the invocation error endpoint, and the the runtime must continue — an invocation error is a problem for the invocation, not the runtime.

The handle_event_error function accepts an event and generates a function. The generated function accepts error caught by tryCatch, logs it, and then submits it to the invocation error endpoint. Importantly it does not stop the kernel — the intention is that the runtime moves onto the next event.

This function may need to be implemented differently depending on the source of an event. As such, handle_event_error is an S3 generic that can dispatch on the event class as returned by classify_event.

tryCatch(
    handle_event(...),
    error = handle_invocation_error(event) # returns a function(e)
 )

Usage

handle_event_error(event, config, ...)

Value

A function that accepts an error e as caught by tryCatch


lambdr documentation built on Nov. 25, 2023, 5:08 p.m.