From 4ee8efec767204a3eebe8cd21a00b79c51bfc806 Mon Sep 17 00:00:00 2001 From: Lawrence Forooghian Date: Mon, 11 Dec 2023 14:43:57 -0300 Subject: [PATCH] Change RestChannel._publish to only pass error to callback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit That’s all that the `publish` method looks at anyway, and will aid us in converting `_publish` to use promises. --- src/common/lib/client/restchannel.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/common/lib/client/restchannel.ts b/src/common/lib/client/restchannel.ts index 44e612c89a..add2ba2af3 100644 --- a/src/common/lib/client/restchannel.ts +++ b/src/common/lib/client/restchannel.ts @@ -11,8 +11,9 @@ import Message, { } from '../types/message'; import ErrorInfo from '../types/errorinfo'; import { PaginatedResult } from './paginatedresource'; -import Resource, { ResourceCallback } from './resource'; +import Resource from './resource'; import { ChannelOptions } from '../../types/channel'; +import { ErrCallback } from '../../types/utils'; import BaseRest from './baseclient'; import * as API from '../../../../ably'; import Defaults, { normaliseChannelOptions } from '../util/defaults'; @@ -125,7 +126,7 @@ class RestChannel { }); } - _publish(requestBody: unknown, headers: Record, params: any, callback: ResourceCallback): void { + _publish(requestBody: unknown, headers: Record, params: any, callback: ErrCallback): void { Resource.post( this.client, this.client.rest.channelMixin.basePath(this) + '/messages', @@ -133,7 +134,7 @@ class RestChannel { headers, params, null, - callback + (err) => callback(err) ); }