How to use the @slack/web-api.ErrorCode.RateLimitedError function in @slack/web-api

To help you get started, we’ve selected a few @slack/web-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Automattic / jetpack / tests / e2e / lib / reporters / slack.js View on Github external
async function sendRequestToSlack( fn ) {
	try {
		await fn();
	} catch ( error ) {
		// Check the code property and log the response
		if (
			error.code === ErrorCode.PlatformError ||
			error.code === ErrorCode.RequestError ||
			error.code === ErrorCode.RateLimitedError ||
			error.code === ErrorCode.HTTPError
		) {
			console.log( error.data );
		} else {
			// Some other error, oh no!
			console.log(
				'The error occurred does not match an error we are checking for in this block.'
			);
			console.log( error );
		}
	}
}