@@ -98,17 +98,29 @@ class GuildChannelManager extends CachedManager {
9898 return super . resolveId ( channel ) ;
9999 }
100100
101+ /**
102+ * Data that can be resolved to a News Channel object. This can be:
103+ * * A NewsChannel object
104+ * * A Snowflake
105+ * @typedef {NewsChannel|Snowflake } NewsChannelResolvable
106+ */
107+
101108 /**
102109 * Adds the target channel to a channel's followers.
103- * @param {NewsChannel|Snowflake } channel The channel to follow
110+ * @param {NewsChannelResolvable } channel The channel to follow
104111 * @param {TextChannelResolvable } targetChannel The channel where published announcements will be posted at
105112 * @param {string } [reason] Reason for creating the webhook
106113 * @returns {Promise<Snowflake> } Returns created target webhook id.
107114 */
108115 async addFollower ( channel , targetChannel , reason ) {
109116 const channelId = this . resolveId ( channel ) ;
117+ if ( ! channelId ) {
118+ throw new DiscordjsTypeError ( ErrorCodes . InvalidType , 'channel' , 'NewsChannelResolvable' ) ;
119+ }
110120 const targetChannelId = this . resolveId ( targetChannel ) ;
111- if ( ! channelId || ! targetChannelId ) throw new Error ( ErrorCodes . GuildChannelResolve ) ;
121+ if ( ! targetChannelId ) {
122+ throw new DiscordjsTypeError ( ErrorCodes . InvalidType , 'targetChannel' , 'TextChannelResolvable' ) ;
123+ }
112124 const { webhook_id } = await this . client . rest . post ( Routes . channelFollowers ( channelId ) , {
113125 body : { webhook_channel_id : targetChannelId } ,
114126 reason,
0 commit comments