@@ -66,12 +66,16 @@ export function getDefaultGuildIds() {
66
66
67
67
/**
68
68
* Sets the amount of retries for when registering commands, only applies when {@link defaultBehaviorWhenNotIdentical}
69
- * is set to {@link RegisterBehavior.BulkOverwrite}. This is used if registering the commands fails .
69
+ * is set to {@link RegisterBehavior.BulkOverwrite}. This is used if registering the commands times out .
70
70
* The default value is `1`, which means no retries are performed.
71
71
* @param newAmountOfRetries The new amount of retries to set. Set this to `null` to reset it to the default
72
72
*/
73
73
export function setBulkOverwriteRetries ( newAmountOfRetries : number | null ) {
74
- bulkOVerwriteRetries = newAmountOfRetries ?? 1 ;
74
+ newAmountOfRetries ??= 1 ;
75
+
76
+ if ( newAmountOfRetries <= 0 ) throw new RangeError ( 'The amount of retries must be greater than 0' ) ;
77
+
78
+ bulkOVerwriteRetries = newAmountOfRetries ;
75
79
}
76
80
77
81
export function getBulkOverwriteRetries ( ) {
@@ -181,6 +185,8 @@ async function handleBulkOverwriteGlobalCommands(
181
185
182
186
bulkOverwriteInfo ( `Successfully overwrote global application commands. The application now has ${ result . size } global commands` ) ;
183
187
} catch ( error ) {
188
+ if ( error instanceof Error && error . name === 'AbortError' ) throw error ;
189
+
184
190
emitBulkOverwriteError ( error , null ) ;
185
191
}
186
192
}
@@ -234,6 +240,8 @@ async function handleBulkOverwriteGuildCommands(
234
240
`Successfully overwrote guild application commands for guild ${ guildId } . The application now has ${ result . size } guild commands for guild ${ guildId } `
235
241
) ;
236
242
} catch ( error ) {
243
+ if ( error instanceof Error && error . name === 'AbortError' ) throw error ;
244
+
237
245
emitBulkOverwriteError ( error , guildId ) ;
238
246
}
239
247
}
0 commit comments