globalErrorKeys

View as MarkdownOpen in Claude

Set global error-detection keys that apply to all webhooks in this DataMap. If any of these keys are present in a webhook response, the response is treated as an error.

Parameters

keys
string[]Required

Response keys that indicate an error occurred.

Returns

DataMap — Self for method chaining.

Example

import { DataMap, FunctionResult } from '@signalwire/sdk';
const dm = new DataMap('get_weather');
dm.globalErrorKeys(['error', 'fault', 'exception']);
dm.webhook('GET', 'https://api.weather.com/v1/current?q=${args.city}');
dm.output(new FunctionResult('Weather: ${response.current.condition.text}'));