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

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