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, callsetProcessingState 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, useRuntime.setFatalError() instead.

To report the status of function calls other than lifecycle event handlers, useconsole.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>

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2022-11-17 UTC.