Runtime class

Runtime provides methods to modify an extension instance's runtime data.

Signature:

exportdeclareclassRuntime

Methods

MethodModifiersDescription
setFatalError(errorMessage)Reports a fatal error while running a lifecycle event handler.
setProcessingState(state, detailMessage)Sets the processing state of an extension instance.

Runtime.setFatalError()

Reports a fatal error while running a lifecycle event handler.

Call this method when a lifecycle event handler fails in a way that makes the Instance inoperable. If the lifecycle event failed but the instance will still work as expected, call setProcessingState with the "PROCESSING_WARNING" or "PROCESSING_FAILED" state instead.

Signature:

setFatalError(errorMessage:string):Promise<void>;

Parameters

ParameterTypeDescription
errorMessagestringA message explaining what went wrong and how to fix it.

Returns:

Promise<void>

Runtime.setProcessingState()

Sets the processing state of an extension instance.

Use this method to report the results of a lifecycle event handler.

If the lifecycle event failed & the extension instance will no longer work correctly, use Runtime.setFatalError() instead.

To report the status of function calls other than lifecycle event handlers, use console.log or the Cloud Functions logger SDK.

Signature:

setProcessingState(state:SettableProcessingState,detailMessage:string):Promise<void>;

Parameters

ParameterTypeDescription
stateSettableProcessingStateThe state to set the instance to.
detailMessagestringA message explaining the results of the lifecycle function.

Returns:

Promise<void>