• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nats-io / nats-server / 24382614788

10 Apr 2026 02:22PM UTC coverage: 81.873% (+0.07%) from 81.808%
24382614788

push

github

web-flow
(2.14) [ADDED] Config reload: add/remove remote leafnodes (#7937)

The configuration reload now supports adding and/or removing remote
leafnodes. A remote is identified with the combination of its URLs list,
local account and credentials file name. This is what is used by the
server to detect changes for the remote leafnodes list.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>

75096 of 91723 relevant lines covered (81.87%)

592190.62 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

55.81
/server/jetstream_errors_generated.go
1
// Generated code, do not edit. See errors.json and run go generate to update
2

3
package server
4

5
import "strings"
6

7
const (
8
        // JSAccountResourcesExceededErr resource limits exceeded for account
9
        JSAccountResourcesExceededErr ErrorIdentifier = 10002
10

11
        // JSAtomicPublishContainsDuplicateMessageErr atomic publish batch contains duplicate message id
12
        JSAtomicPublishContainsDuplicateMessageErr ErrorIdentifier = 10201
13

14
        // JSAtomicPublishDisabledErr atomic publish is disabled
15
        JSAtomicPublishDisabledErr ErrorIdentifier = 10174
16

17
        // JSAtomicPublishIncompleteBatchErr atomic publish batch is incomplete
18
        JSAtomicPublishIncompleteBatchErr ErrorIdentifier = 10176
19

20
        // JSAtomicPublishInvalidBatchCommitErr atomic publish batch commit is invalid
21
        JSAtomicPublishInvalidBatchCommitErr ErrorIdentifier = 10200
22

23
        // JSAtomicPublishInvalidBatchIDErr atomic publish batch ID is invalid
24
        JSAtomicPublishInvalidBatchIDErr ErrorIdentifier = 10179
25

26
        // JSAtomicPublishMissingSeqErr atomic publish sequence is missing
27
        JSAtomicPublishMissingSeqErr ErrorIdentifier = 10175
28

29
        // JSAtomicPublishTooLargeBatchErrF atomic publish batch is too large: {size}
30
        JSAtomicPublishTooLargeBatchErrF ErrorIdentifier = 10199
31

32
        // JSAtomicPublishTooManyInflight atomic publish too many inflight
33
        JSAtomicPublishTooManyInflight ErrorIdentifier = 10210
34

35
        // JSAtomicPublishUnsupportedHeaderBatchErr atomic publish unsupported header used: {header}
36
        JSAtomicPublishUnsupportedHeaderBatchErr ErrorIdentifier = 10177
37

38
        // JSBadRequestErr bad request
39
        JSBadRequestErr ErrorIdentifier = 10003
40

41
        // JSBatchPublishDisabledErr batch publish is disabled
42
        JSBatchPublishDisabledErr ErrorIdentifier = 10205
43

44
        // JSBatchPublishInvalidBatchIDErr batch publish ID is invalid
45
        JSBatchPublishInvalidBatchIDErr ErrorIdentifier = 10207
46

47
        // JSBatchPublishInvalidPatternErr batch publish pattern is invalid
48
        JSBatchPublishInvalidPatternErr ErrorIdentifier = 10206
49

50
        // JSBatchPublishTooManyInflight batch publish too many inflight
51
        JSBatchPublishTooManyInflight ErrorIdentifier = 10211
52

53
        // JSBatchPublishUnknownBatchIDErr batch publish ID unknown
54
        JSBatchPublishUnknownBatchIDErr ErrorIdentifier = 10208
55

56
        // JSClusterIncompleteErr incomplete results
57
        JSClusterIncompleteErr ErrorIdentifier = 10004
58

59
        // JSClusterNoPeersErrF Error causing no peers to be available ({err})
60
        JSClusterNoPeersErrF ErrorIdentifier = 10005
61

62
        // JSClusterNotActiveErr JetStream not in clustered mode
63
        JSClusterNotActiveErr ErrorIdentifier = 10006
64

65
        // JSClusterNotAssignedErr JetStream cluster not assigned to this server
66
        JSClusterNotAssignedErr ErrorIdentifier = 10007
67

68
        // JSClusterNotAvailErr JetStream system temporarily unavailable
69
        JSClusterNotAvailErr ErrorIdentifier = 10008
70

71
        // JSClusterNotLeaderErr JetStream cluster can not handle request
72
        JSClusterNotLeaderErr ErrorIdentifier = 10009
73

74
        // JSClusterPeerNotMemberErr peer not a member
75
        JSClusterPeerNotMemberErr ErrorIdentifier = 10040
76

77
        // JSClusterRequiredErr JetStream clustering support required
78
        JSClusterRequiredErr ErrorIdentifier = 10010
79

80
        // JSClusterServerMemberChangeInflightErr cluster member change is in progress
81
        JSClusterServerMemberChangeInflightErr ErrorIdentifier = 10202
82

83
        // JSClusterServerNotMemberErr server is not a member of the cluster
84
        JSClusterServerNotMemberErr ErrorIdentifier = 10044
85

86
        // JSClusterTagsErr tags placement not supported for operation
87
        JSClusterTagsErr ErrorIdentifier = 10011
88

89
        // JSClusterUnSupportFeatureErr not currently supported in clustered mode
90
        JSClusterUnSupportFeatureErr ErrorIdentifier = 10036
91

92
        // JSConsumerAckPolicyInvalidErr consumer ack policy invalid
93
        JSConsumerAckPolicyInvalidErr ErrorIdentifier = 10181
94

95
        // JSConsumerAckWaitNegativeErr consumer ack wait needs to be positive
96
        JSConsumerAckWaitNegativeErr ErrorIdentifier = 10183
97

98
        // JSConsumerAlreadyExists action CREATE is used for a existing consumer with a different config (consumer already exists)
99
        JSConsumerAlreadyExists ErrorIdentifier = 10148
100

101
        // JSConsumerBackOffNegativeErr consumer backoff needs to be positive
102
        JSConsumerBackOffNegativeErr ErrorIdentifier = 10184
103

104
        // JSConsumerBadDurableNameErr durable name can not contain '.', '*', '>'
105
        JSConsumerBadDurableNameErr ErrorIdentifier = 10103
106

107
        // JSConsumerConfigRequiredErr consumer config required
108
        JSConsumerConfigRequiredErr ErrorIdentifier = 10078
109

110
        // JSConsumerCreateDurableAndNameMismatch Consumer Durable and Name have to be equal if both are provided
111
        JSConsumerCreateDurableAndNameMismatch ErrorIdentifier = 10132
112

113
        // JSConsumerCreateErrF General consumer creation failure string ({err})
114
        JSConsumerCreateErrF ErrorIdentifier = 10012
115

116
        // JSConsumerCreateFilterSubjectMismatchErr Consumer create request did not match filtered subject from create subject
117
        JSConsumerCreateFilterSubjectMismatchErr ErrorIdentifier = 10131
118

119
        // JSConsumerDeliverCycleErr consumer deliver subject forms a cycle
120
        JSConsumerDeliverCycleErr ErrorIdentifier = 10081
121

122
        // JSConsumerDeliverToWildcardsErr consumer deliver subject has wildcards
123
        JSConsumerDeliverToWildcardsErr ErrorIdentifier = 10079
124

125
        // JSConsumerDescriptionTooLongErrF consumer description is too long, maximum allowed is {max}
126
        JSConsumerDescriptionTooLongErrF ErrorIdentifier = 10107
127

128
        // JSConsumerDirectRequiresEphemeralErr consumer direct requires an ephemeral consumer
129
        JSConsumerDirectRequiresEphemeralErr ErrorIdentifier = 10091
130

131
        // JSConsumerDirectRequiresPushErr consumer direct requires a push based consumer
132
        JSConsumerDirectRequiresPushErr ErrorIdentifier = 10090
133

134
        // JSConsumerDoesNotExist action UPDATE is used for a nonexisting consumer (consumer does not exist)
135
        JSConsumerDoesNotExist ErrorIdentifier = 10149
136

137
        // JSConsumerDuplicateFilterSubjects consumer cannot have both FilterSubject and FilterSubjects specified
138
        JSConsumerDuplicateFilterSubjects ErrorIdentifier = 10136
139

140
        // JSConsumerDurableNameNotInSubjectErr consumer expected to be durable but no durable name set in subject
141
        JSConsumerDurableNameNotInSubjectErr ErrorIdentifier = 10016
142

143
        // JSConsumerDurableNameNotMatchSubjectErr consumer name in subject does not match durable name in request
144
        JSConsumerDurableNameNotMatchSubjectErr ErrorIdentifier = 10017
145

146
        // JSConsumerDurableNameNotSetErr consumer expected to be durable but a durable name was not set
147
        JSConsumerDurableNameNotSetErr ErrorIdentifier = 10018
148

149
        // JSConsumerEmptyFilter consumer filter in FilterSubjects cannot be empty
150
        JSConsumerEmptyFilter ErrorIdentifier = 10139
151

152
        // JSConsumerEmptyGroupName Group name cannot be an empty string
153
        JSConsumerEmptyGroupName ErrorIdentifier = 10161
154

155
        // JSConsumerEphemeralWithDurableInSubjectErr consumer expected to be ephemeral but detected a durable name set in subject
156
        JSConsumerEphemeralWithDurableInSubjectErr ErrorIdentifier = 10019
157

158
        // JSConsumerEphemeralWithDurableNameErr consumer expected to be ephemeral but a durable name was set in request
159
        JSConsumerEphemeralWithDurableNameErr ErrorIdentifier = 10020
160

161
        // JSConsumerExistingActiveErr consumer already exists and is still active
162
        JSConsumerExistingActiveErr ErrorIdentifier = 10105
163

164
        // JSConsumerFCRequiresPushErr consumer flow control requires a push based consumer
165
        JSConsumerFCRequiresPushErr ErrorIdentifier = 10089
166

167
        // JSConsumerFilterNotSubsetErr consumer filter subject is not a valid subset of the interest subjects
168
        JSConsumerFilterNotSubsetErr ErrorIdentifier = 10093
169

170
        // JSConsumerHBRequiresPushErr consumer idle heartbeat requires a push based consumer
171
        JSConsumerHBRequiresPushErr ErrorIdentifier = 10088
172

173
        // JSConsumerInactiveThresholdExcess consumer inactive threshold exceeds system limit of {limit}
174
        JSConsumerInactiveThresholdExcess ErrorIdentifier = 10153
175

176
        // JSConsumerInvalidDeliverSubject invalid push consumer deliver subject
177
        JSConsumerInvalidDeliverSubject ErrorIdentifier = 10112
178

179
        // JSConsumerInvalidGroupNameErr Valid priority group name must match A-Z, a-z, 0-9, -_/=)+ and may not exceed 16 characters
180
        JSConsumerInvalidGroupNameErr ErrorIdentifier = 10162
181

182
        // JSConsumerInvalidPolicyErrF Generic delivery policy error ({err})
183
        JSConsumerInvalidPolicyErrF ErrorIdentifier = 10094
184

185
        // JSConsumerInvalidPriorityGroupErr Provided priority group does not exist for this consumer
186
        JSConsumerInvalidPriorityGroupErr ErrorIdentifier = 10160
187

188
        // JSConsumerInvalidResetErr invalid reset: {err}
189
        JSConsumerInvalidResetErr ErrorIdentifier = 10204
190

191
        // JSConsumerInvalidSamplingErrF failed to parse consumer sampling configuration: {err}
192
        JSConsumerInvalidSamplingErrF ErrorIdentifier = 10095
193

194
        // JSConsumerMaxDeliverBackoffErr max deliver is required to be > length of backoff values
195
        JSConsumerMaxDeliverBackoffErr ErrorIdentifier = 10116
196

197
        // JSConsumerMaxPendingAckExcessErrF consumer max ack pending exceeds system limit of {limit}
198
        JSConsumerMaxPendingAckExcessErrF ErrorIdentifier = 10121
199

200
        // JSConsumerMaxPendingAckPolicyRequiredErr consumer requires ack policy for max ack pending
201
        JSConsumerMaxPendingAckPolicyRequiredErr ErrorIdentifier = 10082
202

203
        // JSConsumerMaxRequestBatchExceededF consumer max request batch exceeds server limit of {limit}
204
        JSConsumerMaxRequestBatchExceededF ErrorIdentifier = 10125
205

206
        // JSConsumerMaxRequestBatchNegativeErr consumer max request batch needs to be > 0
207
        JSConsumerMaxRequestBatchNegativeErr ErrorIdentifier = 10114
208

209
        // JSConsumerMaxRequestExpiresTooSmall consumer max request expires needs to be >= 1ms
210
        JSConsumerMaxRequestExpiresTooSmall ErrorIdentifier = 10115
211

212
        // JSConsumerMaxWaitingNegativeErr consumer max waiting needs to be positive
213
        JSConsumerMaxWaitingNegativeErr ErrorIdentifier = 10087
214

215
        // JSConsumerMetadataLengthErrF consumer metadata exceeds maximum size of {limit}
216
        JSConsumerMetadataLengthErrF ErrorIdentifier = 10135
217

218
        // JSConsumerMultipleFiltersNotAllowed consumer with multiple subject filters cannot use subject based API
219
        JSConsumerMultipleFiltersNotAllowed ErrorIdentifier = 10137
220

221
        // JSConsumerNameContainsPathSeparatorsErr Consumer name can not contain path separators
222
        JSConsumerNameContainsPathSeparatorsErr ErrorIdentifier = 10127
223

224
        // JSConsumerNameExistErr consumer name already in use
225
        JSConsumerNameExistErr ErrorIdentifier = 10013
226

227
        // JSConsumerNameTooLongErrF consumer name is too long, maximum allowed is {max}
228
        JSConsumerNameTooLongErrF ErrorIdentifier = 10102
229

230
        // JSConsumerNotFoundErr consumer not found
231
        JSConsumerNotFoundErr ErrorIdentifier = 10014
232

233
        // JSConsumerOfflineErr consumer is offline
234
        JSConsumerOfflineErr ErrorIdentifier = 10119
235

236
        // JSConsumerOfflineReasonErrF consumer is offline: {err}
237
        JSConsumerOfflineReasonErrF ErrorIdentifier = 10195
238

239
        // JSConsumerOnMappedErr consumer direct on a mapped consumer
240
        JSConsumerOnMappedErr ErrorIdentifier = 10092
241

242
        // JSConsumerOverlappingSubjectFilters consumer subject filters cannot overlap
243
        JSConsumerOverlappingSubjectFilters ErrorIdentifier = 10138
244

245
        // JSConsumerPinnedTTLWithoutPriorityPolicyNone PinnedTTL cannot be set when PriorityPolicy is none
246
        JSConsumerPinnedTTLWithoutPriorityPolicyNone ErrorIdentifier = 10197
247

248
        // JSConsumerPriorityGroupWithPolicyNone consumer can not have priority groups when policy is none
249
        JSConsumerPriorityGroupWithPolicyNone ErrorIdentifier = 10196
250

251
        // JSConsumerPriorityPolicyWithoutGroup Setting PriorityPolicy requires at least one PriorityGroup to be set
252
        JSConsumerPriorityPolicyWithoutGroup ErrorIdentifier = 10159
253

254
        // JSConsumerPullNotDurableErr consumer in pull mode requires a durable name
255
        JSConsumerPullNotDurableErr ErrorIdentifier = 10085
256

257
        // JSConsumerPullRequiresAckErr consumer in pull mode requires explicit ack policy on workqueue stream
258
        JSConsumerPullRequiresAckErr ErrorIdentifier = 10084
259

260
        // JSConsumerPullWithRateLimitErr consumer in pull mode can not have rate limit set
261
        JSConsumerPullWithRateLimitErr ErrorIdentifier = 10086
262

263
        // JSConsumerPushMaxWaitingErr consumer in push mode can not set max waiting
264
        JSConsumerPushMaxWaitingErr ErrorIdentifier = 10080
265

266
        // JSConsumerPushWithPriorityGroupErr priority groups can not be used with push consumers
267
        JSConsumerPushWithPriorityGroupErr ErrorIdentifier = 10178
268

269
        // JSConsumerReplacementWithDifferentNameErr consumer replacement durable config not the same
270
        JSConsumerReplacementWithDifferentNameErr ErrorIdentifier = 10106
271

272
        // JSConsumerReplayPolicyInvalidErr consumer replay policy invalid
273
        JSConsumerReplayPolicyInvalidErr ErrorIdentifier = 10182
274

275
        // JSConsumerReplicasExceedsStream consumer config replica count exceeds parent stream
276
        JSConsumerReplicasExceedsStream ErrorIdentifier = 10126
277

278
        // JSConsumerReplicasShouldMatchStream consumer config replicas must match interest retention stream's replicas
279
        JSConsumerReplicasShouldMatchStream ErrorIdentifier = 10134
280

281
        // JSConsumerSmallHeartbeatErr consumer idle heartbeat needs to be >= 100ms
282
        JSConsumerSmallHeartbeatErr ErrorIdentifier = 10083
283

284
        // JSConsumerStoreFailedErrF error creating store for consumer: {err}
285
        JSConsumerStoreFailedErrF ErrorIdentifier = 10104
286

287
        // JSConsumerWQConsumerNotDeliverAllErr consumer must be deliver all on workqueue stream
288
        JSConsumerWQConsumerNotDeliverAllErr ErrorIdentifier = 10101
289

290
        // JSConsumerWQConsumerNotUniqueErr filtered consumer not unique on workqueue stream
291
        JSConsumerWQConsumerNotUniqueErr ErrorIdentifier = 10100
292

293
        // JSConsumerWQMultipleUnfilteredErr multiple non-filtered consumers not allowed on workqueue stream
294
        JSConsumerWQMultipleUnfilteredErr ErrorIdentifier = 10099
295

296
        // JSConsumerWQRequiresExplicitAckErr workqueue stream requires explicit ack
297
        JSConsumerWQRequiresExplicitAckErr ErrorIdentifier = 10098
298

299
        // JSConsumerWithFlowControlNeedsHeartbeats consumer with flow control also needs heartbeats
300
        JSConsumerWithFlowControlNeedsHeartbeats ErrorIdentifier = 10108
301

302
        // JSInsufficientResourcesErr insufficient resources
303
        JSInsufficientResourcesErr ErrorIdentifier = 10023
304

305
        // JSInvalidJSONErr invalid JSON: {err}
306
        JSInvalidJSONErr ErrorIdentifier = 10025
307

308
        // JSMaximumConsumersLimitErr maximum consumers limit reached
309
        JSMaximumConsumersLimitErr ErrorIdentifier = 10026
310

311
        // JSMaximumStreamsLimitErr maximum number of streams reached
312
        JSMaximumStreamsLimitErr ErrorIdentifier = 10027
313

314
        // JSMemoryResourcesExceededErr insufficient memory resources available
315
        JSMemoryResourcesExceededErr ErrorIdentifier = 10028
316

317
        // JSMessageCounterBrokenErr message counter is broken
318
        JSMessageCounterBrokenErr ErrorIdentifier = 10172
319

320
        // JSMessageIncrDisabledErr message counters is disabled
321
        JSMessageIncrDisabledErr ErrorIdentifier = 10168
322

323
        // JSMessageIncrInvalidErr message counter increment is invalid
324
        JSMessageIncrInvalidErr ErrorIdentifier = 10171
325

326
        // JSMessageIncrMissingErr message counter increment is missing
327
        JSMessageIncrMissingErr ErrorIdentifier = 10169
328

329
        // JSMessageIncrPayloadErr message counter has payload
330
        JSMessageIncrPayloadErr ErrorIdentifier = 10170
331

332
        // JSMessageSchedulesDisabledErr message schedules is disabled
333
        JSMessageSchedulesDisabledErr ErrorIdentifier = 10188
334

335
        // JSMessageSchedulesPatternInvalidErr message schedules pattern is invalid
336
        JSMessageSchedulesPatternInvalidErr ErrorIdentifier = 10189
337

338
        // JSMessageSchedulesRollupInvalidErr message schedules invalid rollup
339
        JSMessageSchedulesRollupInvalidErr ErrorIdentifier = 10192
340

341
        // JSMessageSchedulesSchedulerInvalidErr message schedules invalid scheduler
342
        JSMessageSchedulesSchedulerInvalidErr ErrorIdentifier = 10212
343

344
        // JSMessageSchedulesSourceInvalidErr message schedules source is invalid
345
        JSMessageSchedulesSourceInvalidErr ErrorIdentifier = 10203
346

347
        // JSMessageSchedulesTTLInvalidErr message schedules invalid per-message TTL
348
        JSMessageSchedulesTTLInvalidErr ErrorIdentifier = 10191
349

350
        // JSMessageSchedulesTargetInvalidErr message schedules target is invalid
351
        JSMessageSchedulesTargetInvalidErr ErrorIdentifier = 10190
352

353
        // JSMessageTTLDisabledErr per-message TTL is disabled
354
        JSMessageTTLDisabledErr ErrorIdentifier = 10166
355

356
        // JSMessageTTLInvalidErr invalid per-message TTL
357
        JSMessageTTLInvalidErr ErrorIdentifier = 10165
358

359
        // JSMirrorConsumerSetupFailedErrF generic mirror consumer setup failure string ({err})
360
        JSMirrorConsumerSetupFailedErrF ErrorIdentifier = 10029
361

362
        // JSMirrorInvalidStreamName mirrored stream name is invalid
363
        JSMirrorInvalidStreamName ErrorIdentifier = 10142
364

365
        // JSMirrorInvalidSubjectFilter mirror transform source: {err}
366
        JSMirrorInvalidSubjectFilter ErrorIdentifier = 10151
367

368
        // JSMirrorInvalidTransformDestination mirror transform: {err}
369
        JSMirrorInvalidTransformDestination ErrorIdentifier = 10154
370

371
        // JSMirrorMaxMessageSizeTooBigErr stream mirror must have max message size >= source
372
        JSMirrorMaxMessageSizeTooBigErr ErrorIdentifier = 10030
373

374
        // JSMirrorMultipleFiltersNotAllowed mirror with multiple subject transforms cannot also have a single subject filter
375
        JSMirrorMultipleFiltersNotAllowed ErrorIdentifier = 10150
376

377
        // JSMirrorOverlappingSubjectFilters mirror subject filters can not overlap
378
        JSMirrorOverlappingSubjectFilters ErrorIdentifier = 10152
379

380
        // JSMirrorWithAtomicPublishErr stream mirrors can not also use atomic publishing
381
        JSMirrorWithAtomicPublishErr ErrorIdentifier = 10198
382

383
        // JSMirrorWithBatchPublishErr stream mirrors can not also use batch publishing
384
        JSMirrorWithBatchPublishErr ErrorIdentifier = 10209
385

386
        // JSMirrorWithCountersErr stream mirrors can not also calculate counters
387
        JSMirrorWithCountersErr ErrorIdentifier = 10173
388

389
        // JSMirrorWithFirstSeqErr stream mirrors can not have first sequence configured
390
        JSMirrorWithFirstSeqErr ErrorIdentifier = 10143
391

392
        // JSMirrorWithMsgSchedulesErr stream mirrors can not also schedule messages
393
        JSMirrorWithMsgSchedulesErr ErrorIdentifier = 10186
394

395
        // JSMirrorWithSourcesErr stream mirrors can not also contain other sources
396
        JSMirrorWithSourcesErr ErrorIdentifier = 10031
397

398
        // JSMirrorWithStartSeqAndTimeErr stream mirrors can not have both start seq and start time configured
399
        JSMirrorWithStartSeqAndTimeErr ErrorIdentifier = 10032
400

401
        // JSMirrorWithSubjectFiltersErr stream mirrors can not contain filtered subjects
402
        JSMirrorWithSubjectFiltersErr ErrorIdentifier = 10033
403

404
        // JSMirrorWithSubjectsErr stream mirrors can not contain subjects
405
        JSMirrorWithSubjectsErr ErrorIdentifier = 10034
406

407
        // JSNoAccountErr account not found
408
        JSNoAccountErr ErrorIdentifier = 10035
409

410
        // JSNoLimitsErr no JetStream default or applicable tiered limit present
411
        JSNoLimitsErr ErrorIdentifier = 10120
412

413
        // JSNoMessageFoundErr no message found
414
        JSNoMessageFoundErr ErrorIdentifier = 10037
415

416
        // JSNotEmptyRequestErr expected an empty request payload
417
        JSNotEmptyRequestErr ErrorIdentifier = 10038
418

419
        // JSNotEnabledErr JetStream not enabled
420
        JSNotEnabledErr ErrorIdentifier = 10076
421

422
        // JSNotEnabledForAccountErr JetStream not enabled for account
423
        JSNotEnabledForAccountErr ErrorIdentifier = 10039
424

425
        // JSPedanticErrF pedantic mode: {err}
426
        JSPedanticErrF ErrorIdentifier = 10157
427

428
        // JSPeerRemapErr peer remap failed
429
        JSPeerRemapErr ErrorIdentifier = 10075
430

431
        // JSRaftGeneralErrF General RAFT error string ({err})
432
        JSRaftGeneralErrF ErrorIdentifier = 10041
433

434
        // JSReplicasCountCannotBeNegative replicas count cannot be negative
435
        JSReplicasCountCannotBeNegative ErrorIdentifier = 10133
436

437
        // JSRequiredApiLevelErr JetStream minimum api level required
438
        JSRequiredApiLevelErr ErrorIdentifier = 10185
439

440
        // JSRestoreSubscribeFailedErrF JetStream unable to subscribe to restore snapshot {subject}: {err}
441
        JSRestoreSubscribeFailedErrF ErrorIdentifier = 10042
442

443
        // JSSequenceNotFoundErrF sequence {seq} not found
444
        JSSequenceNotFoundErrF ErrorIdentifier = 10043
445

446
        // JSSnapshotDeliverSubjectInvalidErr deliver subject not valid
447
        JSSnapshotDeliverSubjectInvalidErr ErrorIdentifier = 10015
448

449
        // JSSourceConsumerSetupFailedErrF General source consumer setup failure string ({err})
450
        JSSourceConsumerSetupFailedErrF ErrorIdentifier = 10045
451

452
        // JSSourceDuplicateDetected source stream, filter and transform (plus external if present) must form a unique combination (duplicate source configuration detected)
453
        JSSourceDuplicateDetected ErrorIdentifier = 10140
454

455
        // JSSourceInvalidStreamName sourced stream name is invalid
456
        JSSourceInvalidStreamName ErrorIdentifier = 10141
457

458
        // JSSourceInvalidSubjectFilter source transform source: {err}
459
        JSSourceInvalidSubjectFilter ErrorIdentifier = 10145
460

461
        // JSSourceInvalidTransformDestination source transform: {err}
462
        JSSourceInvalidTransformDestination ErrorIdentifier = 10146
463

464
        // JSSourceMaxMessageSizeTooBigErr stream source must have max message size >= target
465
        JSSourceMaxMessageSizeTooBigErr ErrorIdentifier = 10046
466

467
        // JSSourceMultipleFiltersNotAllowed source with multiple subject transforms cannot also have a single subject filter
468
        JSSourceMultipleFiltersNotAllowed ErrorIdentifier = 10144
469

470
        // JSSourceOverlappingSubjectFilters source filters can not overlap
471
        JSSourceOverlappingSubjectFilters ErrorIdentifier = 10147
472

473
        // JSSourceWithMsgSchedulesErr stream source can not also schedule messages
474
        JSSourceWithMsgSchedulesErr ErrorIdentifier = 10187
475

476
        // JSStorageResourcesExceededErr insufficient storage resources available
477
        JSStorageResourcesExceededErr ErrorIdentifier = 10047
478

479
        // JSStreamAssignmentErrF Generic stream assignment error string ({err})
480
        JSStreamAssignmentErrF ErrorIdentifier = 10048
481

482
        // JSStreamCreateErrF Generic stream creation error string ({err})
483
        JSStreamCreateErrF ErrorIdentifier = 10049
484

485
        // JSStreamDeleteErrF General stream deletion error string ({err})
486
        JSStreamDeleteErrF ErrorIdentifier = 10050
487

488
        // JSStreamDuplicateMessageConflict duplicate message id is in process
489
        JSStreamDuplicateMessageConflict ErrorIdentifier = 10158
490

491
        // JSStreamExpectedLastSeqPerSubjectInvalid missing sequence for expected last sequence per subject
492
        JSStreamExpectedLastSeqPerSubjectInvalid ErrorIdentifier = 10193
493

494
        // JSStreamExpectedLastSeqPerSubjectNotReady expected last sequence per subject temporarily unavailable
495
        JSStreamExpectedLastSeqPerSubjectNotReady ErrorIdentifier = 10163
496

497
        // JSStreamExternalApiOverlapErrF stream external api prefix {prefix} must not overlap with {subject}
498
        JSStreamExternalApiOverlapErrF ErrorIdentifier = 10021
499

500
        // JSStreamExternalDelPrefixOverlapsErrF stream external delivery prefix {prefix} overlaps with stream subject {subject}
501
        JSStreamExternalDelPrefixOverlapsErrF ErrorIdentifier = 10022
502

503
        // JSStreamGeneralErrorF General stream failure string ({err})
504
        JSStreamGeneralErrorF ErrorIdentifier = 10051
505

506
        // JSStreamHeaderExceedsMaximumErr header size exceeds maximum allowed of 64k
507
        JSStreamHeaderExceedsMaximumErr ErrorIdentifier = 10097
508

509
        // JSStreamInfoMaxSubjectsErr subject details would exceed maximum allowed
510
        JSStreamInfoMaxSubjectsErr ErrorIdentifier = 10117
511

512
        // JSStreamInvalidConfigF Stream configuration validation error string ({err})
513
        JSStreamInvalidConfigF ErrorIdentifier = 10052
514

515
        // JSStreamInvalidErr stream not valid
516
        JSStreamInvalidErr ErrorIdentifier = 10096
517

518
        // JSStreamInvalidExternalDeliverySubjErrF stream external delivery prefix {prefix} must not contain wildcards
519
        JSStreamInvalidExternalDeliverySubjErrF ErrorIdentifier = 10024
520

521
        // JSStreamLimitsErrF General stream limits exceeded error string ({err})
522
        JSStreamLimitsErrF ErrorIdentifier = 10053
523

524
        // JSStreamMaxBytesRequired account requires a stream config to have max bytes set
525
        JSStreamMaxBytesRequired ErrorIdentifier = 10113
526

527
        // JSStreamMaxStreamBytesExceeded stream max bytes exceeds account limit max stream bytes
528
        JSStreamMaxStreamBytesExceeded ErrorIdentifier = 10122
529

530
        // JSStreamMessageExceedsMaximumErr message size exceeds maximum allowed
531
        JSStreamMessageExceedsMaximumErr ErrorIdentifier = 10054
532

533
        // JSStreamMinLastSeqErr min last sequence
534
        JSStreamMinLastSeqErr ErrorIdentifier = 10180
535

536
        // JSStreamMirrorNotUpdatableErr stream mirror configuration can not be updated
537
        JSStreamMirrorNotUpdatableErr ErrorIdentifier = 10055
538

539
        // JSStreamMismatchErr stream name in subject does not match request
540
        JSStreamMismatchErr ErrorIdentifier = 10056
541

542
        // JSStreamMoveAndScaleErr can not move and scale a stream in a single update
543
        JSStreamMoveAndScaleErr ErrorIdentifier = 10123
544

545
        // JSStreamMoveInProgressF stream move already in progress: {msg}
546
        JSStreamMoveInProgressF ErrorIdentifier = 10124
547

548
        // JSStreamMoveNotInProgress stream move not in progress
549
        JSStreamMoveNotInProgress ErrorIdentifier = 10129
550

551
        // JSStreamMsgDeleteFailedF Generic message deletion failure error string ({err})
552
        JSStreamMsgDeleteFailedF ErrorIdentifier = 10057
553

554
        // JSStreamNameContainsPathSeparatorsErr Stream name can not contain path separators
555
        JSStreamNameContainsPathSeparatorsErr ErrorIdentifier = 10128
556

557
        // JSStreamNameExistErr stream name already in use with a different configuration
558
        JSStreamNameExistErr ErrorIdentifier = 10058
559

560
        // JSStreamNameExistRestoreFailedErr stream name already in use, cannot restore
561
        JSStreamNameExistRestoreFailedErr ErrorIdentifier = 10130
562

563
        // JSStreamNotFoundErr stream not found
564
        JSStreamNotFoundErr ErrorIdentifier = 10059
565

566
        // JSStreamNotMatchErr expected stream does not match
567
        JSStreamNotMatchErr ErrorIdentifier = 10060
568

569
        // JSStreamOfflineErr stream is offline
570
        JSStreamOfflineErr ErrorIdentifier = 10118
571

572
        // JSStreamOfflineReasonErrF stream is offline: {err}
573
        JSStreamOfflineReasonErrF ErrorIdentifier = 10194
574

575
        // JSStreamPurgeFailedF Generic stream purge failure error string ({err})
576
        JSStreamPurgeFailedF ErrorIdentifier = 10110
577

578
        // JSStreamReplicasNotSupportedErr replicas > 1 not supported in non-clustered mode
579
        JSStreamReplicasNotSupportedErr ErrorIdentifier = 10074
580

581
        // JSStreamReplicasNotUpdatableErr Replicas configuration can not be updated
582
        JSStreamReplicasNotUpdatableErr ErrorIdentifier = 10061
583

584
        // JSStreamRestoreErrF restore failed: {err}
585
        JSStreamRestoreErrF ErrorIdentifier = 10062
586

587
        // JSStreamRollupFailedF Generic stream rollup failure error string ({err})
588
        JSStreamRollupFailedF ErrorIdentifier = 10111
589

590
        // JSStreamSealedErr invalid operation on sealed stream
591
        JSStreamSealedErr ErrorIdentifier = 10109
592

593
        // JSStreamSequenceNotMatchErr expected stream sequence does not match
594
        JSStreamSequenceNotMatchErr ErrorIdentifier = 10063
595

596
        // JSStreamSnapshotErrF snapshot failed: {err}
597
        JSStreamSnapshotErrF ErrorIdentifier = 10064
598

599
        // JSStreamStoreFailedF Generic error when storing a message failed ({err})
600
        JSStreamStoreFailedF ErrorIdentifier = 10077
601

602
        // JSStreamSubjectOverlapErr subjects overlap with an existing stream
603
        JSStreamSubjectOverlapErr ErrorIdentifier = 10065
604

605
        // JSStreamTemplateCreateErrF Generic template creation failed string ({err})
606
        JSStreamTemplateCreateErrF ErrorIdentifier = 10066
607

608
        // JSStreamTemplateDeleteErrF Generic stream template deletion failed error string ({err})
609
        JSStreamTemplateDeleteErrF ErrorIdentifier = 10067
610

611
        // JSStreamTemplateNotFoundErr template not found
612
        JSStreamTemplateNotFoundErr ErrorIdentifier = 10068
613

614
        // JSStreamTooManyRequests too many requests
615
        JSStreamTooManyRequests ErrorIdentifier = 10167
616

617
        // JSStreamTransformInvalidDestination stream transform: {err}
618
        JSStreamTransformInvalidDestination ErrorIdentifier = 10156
619

620
        // JSStreamTransformInvalidSource stream transform source: {err}
621
        JSStreamTransformInvalidSource ErrorIdentifier = 10155
622

623
        // JSStreamUpdateErrF Generic stream update error string ({err})
624
        JSStreamUpdateErrF ErrorIdentifier = 10069
625

626
        // JSStreamWrongLastMsgIDErrF wrong last msg ID: {id}
627
        JSStreamWrongLastMsgIDErrF ErrorIdentifier = 10070
628

629
        // JSStreamWrongLastSequenceConstantErr wrong last sequence
630
        JSStreamWrongLastSequenceConstantErr ErrorIdentifier = 10164
631

632
        // JSStreamWrongLastSequenceErrF wrong last sequence: {seq}
633
        JSStreamWrongLastSequenceErrF ErrorIdentifier = 10071
634

635
        // JSTempStorageFailedErr JetStream unable to open temp storage for restore
636
        JSTempStorageFailedErr ErrorIdentifier = 10072
637

638
        // JSTemplateNameNotMatchSubjectErr template name in subject does not match request
639
        JSTemplateNameNotMatchSubjectErr ErrorIdentifier = 10073
640
)
641

642
var (
643
        ApiErrors = map[ErrorIdentifier]*ApiError{
644
                JSAccountResourcesExceededErr:                {Code: 400, ErrCode: 10002, Description: "resource limits exceeded for account"},
645
                JSAtomicPublishContainsDuplicateMessageErr:   {Code: 400, ErrCode: 10201, Description: "atomic publish batch contains duplicate message id"},
646
                JSAtomicPublishDisabledErr:                   {Code: 400, ErrCode: 10174, Description: "atomic publish is disabled"},
647
                JSAtomicPublishIncompleteBatchErr:            {Code: 400, ErrCode: 10176, Description: "atomic publish batch is incomplete"},
648
                JSAtomicPublishInvalidBatchCommitErr:         {Code: 400, ErrCode: 10200, Description: "atomic publish batch commit is invalid"},
649
                JSAtomicPublishInvalidBatchIDErr:             {Code: 400, ErrCode: 10179, Description: "atomic publish batch ID is invalid"},
650
                JSAtomicPublishMissingSeqErr:                 {Code: 400, ErrCode: 10175, Description: "atomic publish sequence is missing"},
651
                JSAtomicPublishTooLargeBatchErrF:             {Code: 400, ErrCode: 10199, Description: "atomic publish batch is too large: {size}"},
652
                JSAtomicPublishTooManyInflight:               {Code: 429, ErrCode: 10210, Description: "atomic publish too many inflight"},
653
                JSAtomicPublishUnsupportedHeaderBatchErr:     {Code: 400, ErrCode: 10177, Description: "atomic publish unsupported header used: {header}"},
654
                JSBadRequestErr:                              {Code: 400, ErrCode: 10003, Description: "bad request"},
655
                JSBatchPublishDisabledErr:                    {Code: 400, ErrCode: 10205, Description: "batch publish is disabled"},
656
                JSBatchPublishInvalidBatchIDErr:              {Code: 400, ErrCode: 10207, Description: "batch publish ID is invalid"},
657
                JSBatchPublishInvalidPatternErr:              {Code: 400, ErrCode: 10206, Description: "batch publish pattern is invalid"},
658
                JSBatchPublishTooManyInflight:                {Code: 429, ErrCode: 10211, Description: "batch publish too many inflight"},
659
                JSBatchPublishUnknownBatchIDErr:              {Code: 400, ErrCode: 10208, Description: "batch publish ID unknown"},
660
                JSClusterIncompleteErr:                       {Code: 503, ErrCode: 10004, Description: "incomplete results"},
661
                JSClusterNoPeersErrF:                         {Code: 400, ErrCode: 10005, Description: "{err}"},
662
                JSClusterNotActiveErr:                        {Code: 500, ErrCode: 10006, Description: "JetStream not in clustered mode"},
663
                JSClusterNotAssignedErr:                      {Code: 500, ErrCode: 10007, Description: "JetStream cluster not assigned to this server"},
664
                JSClusterNotAvailErr:                         {Code: 503, ErrCode: 10008, Description: "JetStream system temporarily unavailable"},
665
                JSClusterNotLeaderErr:                        {Code: 500, ErrCode: 10009, Description: "JetStream cluster can not handle request"},
666
                JSClusterPeerNotMemberErr:                    {Code: 400, ErrCode: 10040, Description: "peer not a member"},
667
                JSClusterRequiredErr:                         {Code: 503, ErrCode: 10010, Description: "JetStream clustering support required"},
668
                JSClusterServerMemberChangeInflightErr:       {Code: 400, ErrCode: 10202, Description: "cluster member change is in progress"},
669
                JSClusterServerNotMemberErr:                  {Code: 400, ErrCode: 10044, Description: "server is not a member of the cluster"},
670
                JSClusterTagsErr:                             {Code: 400, ErrCode: 10011, Description: "tags placement not supported for operation"},
671
                JSClusterUnSupportFeatureErr:                 {Code: 503, ErrCode: 10036, Description: "not currently supported in clustered mode"},
672
                JSConsumerAckPolicyInvalidErr:                {Code: 400, ErrCode: 10181, Description: "consumer ack policy invalid"},
673
                JSConsumerAckWaitNegativeErr:                 {Code: 400, ErrCode: 10183, Description: "consumer ack wait needs to be positive"},
674
                JSConsumerAlreadyExists:                      {Code: 400, ErrCode: 10148, Description: "consumer already exists"},
675
                JSConsumerBackOffNegativeErr:                 {Code: 400, ErrCode: 10184, Description: "consumer backoff needs to be positive"},
676
                JSConsumerBadDurableNameErr:                  {Code: 400, ErrCode: 10103, Description: "durable name can not contain '.', '*', '>'"},
677
                JSConsumerConfigRequiredErr:                  {Code: 400, ErrCode: 10078, Description: "consumer config required"},
678
                JSConsumerCreateDurableAndNameMismatch:       {Code: 400, ErrCode: 10132, Description: "Consumer Durable and Name have to be equal if both are provided"},
679
                JSConsumerCreateErrF:                         {Code: 500, ErrCode: 10012, Description: "{err}"},
680
                JSConsumerCreateFilterSubjectMismatchErr:     {Code: 400, ErrCode: 10131, Description: "Consumer create request did not match filtered subject from create subject"},
681
                JSConsumerDeliverCycleErr:                    {Code: 400, ErrCode: 10081, Description: "consumer deliver subject forms a cycle"},
682
                JSConsumerDeliverToWildcardsErr:              {Code: 400, ErrCode: 10079, Description: "consumer deliver subject has wildcards"},
683
                JSConsumerDescriptionTooLongErrF:             {Code: 400, ErrCode: 10107, Description: "consumer description is too long, maximum allowed is {max}"},
684
                JSConsumerDirectRequiresEphemeralErr:         {Code: 400, ErrCode: 10091, Description: "consumer direct requires an ephemeral consumer"},
685
                JSConsumerDirectRequiresPushErr:              {Code: 400, ErrCode: 10090, Description: "consumer direct requires a push based consumer"},
686
                JSConsumerDoesNotExist:                       {Code: 400, ErrCode: 10149, Description: "consumer does not exist"},
687
                JSConsumerDuplicateFilterSubjects:            {Code: 400, ErrCode: 10136, Description: "consumer cannot have both FilterSubject and FilterSubjects specified"},
688
                JSConsumerDurableNameNotInSubjectErr:         {Code: 400, ErrCode: 10016, Description: "consumer expected to be durable but no durable name set in subject"},
689
                JSConsumerDurableNameNotMatchSubjectErr:      {Code: 400, ErrCode: 10017, Description: "consumer name in subject does not match durable name in request"},
690
                JSConsumerDurableNameNotSetErr:               {Code: 400, ErrCode: 10018, Description: "consumer expected to be durable but a durable name was not set"},
691
                JSConsumerEmptyFilter:                        {Code: 400, ErrCode: 10139, Description: "consumer filter in FilterSubjects cannot be empty"},
692
                JSConsumerEmptyGroupName:                     {Code: 400, ErrCode: 10161, Description: "Group name cannot be an empty string"},
693
                JSConsumerEphemeralWithDurableInSubjectErr:   {Code: 400, ErrCode: 10019, Description: "consumer expected to be ephemeral but detected a durable name set in subject"},
694
                JSConsumerEphemeralWithDurableNameErr:        {Code: 400, ErrCode: 10020, Description: "consumer expected to be ephemeral but a durable name was set in request"},
695
                JSConsumerExistingActiveErr:                  {Code: 400, ErrCode: 10105, Description: "consumer already exists and is still active"},
696
                JSConsumerFCRequiresPushErr:                  {Code: 400, ErrCode: 10089, Description: "consumer flow control requires a push based consumer"},
697
                JSConsumerFilterNotSubsetErr:                 {Code: 400, ErrCode: 10093, Description: "consumer filter subject is not a valid subset of the interest subjects"},
698
                JSConsumerHBRequiresPushErr:                  {Code: 400, ErrCode: 10088, Description: "consumer idle heartbeat requires a push based consumer"},
699
                JSConsumerInactiveThresholdExcess:            {Code: 400, ErrCode: 10153, Description: "consumer inactive threshold exceeds system limit of {limit}"},
700
                JSConsumerInvalidDeliverSubject:              {Code: 400, ErrCode: 10112, Description: "invalid push consumer deliver subject"},
701
                JSConsumerInvalidGroupNameErr:                {Code: 400, ErrCode: 10162, Description: "Valid priority group name must match A-Z, a-z, 0-9, -_/=)+ and may not exceed 16 characters"},
702
                JSConsumerInvalidPolicyErrF:                  {Code: 400, ErrCode: 10094, Description: "{err}"},
703
                JSConsumerInvalidPriorityGroupErr:            {Code: 400, ErrCode: 10160, Description: "Provided priority group does not exist for this consumer"},
704
                JSConsumerInvalidResetErr:                    {Code: 400, ErrCode: 10204, Description: "invalid reset: {err}"},
705
                JSConsumerInvalidSamplingErrF:                {Code: 400, ErrCode: 10095, Description: "failed to parse consumer sampling configuration: {err}"},
706
                JSConsumerMaxDeliverBackoffErr:               {Code: 400, ErrCode: 10116, Description: "max deliver is required to be > length of backoff values"},
707
                JSConsumerMaxPendingAckExcessErrF:            {Code: 400, ErrCode: 10121, Description: "consumer max ack pending exceeds system limit of {limit}"},
708
                JSConsumerMaxPendingAckPolicyRequiredErr:     {Code: 400, ErrCode: 10082, Description: "consumer requires ack policy for max ack pending"},
709
                JSConsumerMaxRequestBatchExceededF:           {Code: 400, ErrCode: 10125, Description: "consumer max request batch exceeds server limit of {limit}"},
710
                JSConsumerMaxRequestBatchNegativeErr:         {Code: 400, ErrCode: 10114, Description: "consumer max request batch needs to be > 0"},
711
                JSConsumerMaxRequestExpiresTooSmall:          {Code: 400, ErrCode: 10115, Description: "consumer max request expires needs to be >= 1ms"},
712
                JSConsumerMaxWaitingNegativeErr:              {Code: 400, ErrCode: 10087, Description: "consumer max waiting needs to be positive"},
713
                JSConsumerMetadataLengthErrF:                 {Code: 400, ErrCode: 10135, Description: "consumer metadata exceeds maximum size of {limit}"},
714
                JSConsumerMultipleFiltersNotAllowed:          {Code: 400, ErrCode: 10137, Description: "consumer with multiple subject filters cannot use subject based API"},
715
                JSConsumerNameContainsPathSeparatorsErr:      {Code: 400, ErrCode: 10127, Description: "Consumer name can not contain path separators"},
716
                JSConsumerNameExistErr:                       {Code: 400, ErrCode: 10013, Description: "consumer name already in use"},
717
                JSConsumerNameTooLongErrF:                    {Code: 400, ErrCode: 10102, Description: "consumer name is too long, maximum allowed is {max}"},
718
                JSConsumerNotFoundErr:                        {Code: 404, ErrCode: 10014, Description: "consumer not found"},
719
                JSConsumerOfflineErr:                         {Code: 500, ErrCode: 10119, Description: "consumer is offline"},
720
                JSConsumerOfflineReasonErrF:                  {Code: 500, ErrCode: 10195, Description: "consumer is offline: {err}"},
721
                JSConsumerOnMappedErr:                        {Code: 400, ErrCode: 10092, Description: "consumer direct on a mapped consumer"},
722
                JSConsumerOverlappingSubjectFilters:          {Code: 400, ErrCode: 10138, Description: "consumer subject filters cannot overlap"},
723
                JSConsumerPinnedTTLWithoutPriorityPolicyNone: {Code: 400, ErrCode: 10197, Description: "PinnedTTL cannot be set when PriorityPolicy is none"},
724
                JSConsumerPriorityGroupWithPolicyNone:        {Code: 400, ErrCode: 10196, Description: "consumer can not have priority groups when policy is none"},
725
                JSConsumerPriorityPolicyWithoutGroup:         {Code: 400, ErrCode: 10159, Description: "Setting PriorityPolicy requires at least one PriorityGroup to be set"},
726
                JSConsumerPullNotDurableErr:                  {Code: 400, ErrCode: 10085, Description: "consumer in pull mode requires a durable name"},
727
                JSConsumerPullRequiresAckErr:                 {Code: 400, ErrCode: 10084, Description: "consumer in pull mode requires explicit ack policy on workqueue stream"},
728
                JSConsumerPullWithRateLimitErr:               {Code: 400, ErrCode: 10086, Description: "consumer in pull mode can not have rate limit set"},
729
                JSConsumerPushMaxWaitingErr:                  {Code: 400, ErrCode: 10080, Description: "consumer in push mode can not set max waiting"},
730
                JSConsumerPushWithPriorityGroupErr:           {Code: 400, ErrCode: 10178, Description: "priority groups can not be used with push consumers"},
731
                JSConsumerReplacementWithDifferentNameErr:    {Code: 400, ErrCode: 10106, Description: "consumer replacement durable config not the same"},
732
                JSConsumerReplayPolicyInvalidErr:             {Code: 400, ErrCode: 10182, Description: "consumer replay policy invalid"},
733
                JSConsumerReplicasExceedsStream:              {Code: 400, ErrCode: 10126, Description: "consumer config replica count exceeds parent stream"},
734
                JSConsumerReplicasShouldMatchStream:          {Code: 400, ErrCode: 10134, Description: "consumer config replicas must match interest retention stream's replicas"},
735
                JSConsumerSmallHeartbeatErr:                  {Code: 400, ErrCode: 10083, Description: "consumer idle heartbeat needs to be >= 100ms"},
736
                JSConsumerStoreFailedErrF:                    {Code: 500, ErrCode: 10104, Description: "error creating store for consumer: {err}"},
737
                JSConsumerWQConsumerNotDeliverAllErr:         {Code: 400, ErrCode: 10101, Description: "consumer must be deliver all on workqueue stream"},
738
                JSConsumerWQConsumerNotUniqueErr:             {Code: 400, ErrCode: 10100, Description: "filtered consumer not unique on workqueue stream"},
739
                JSConsumerWQMultipleUnfilteredErr:            {Code: 400, ErrCode: 10099, Description: "multiple non-filtered consumers not allowed on workqueue stream"},
740
                JSConsumerWQRequiresExplicitAckErr:           {Code: 400, ErrCode: 10098, Description: "workqueue stream requires explicit ack"},
741
                JSConsumerWithFlowControlNeedsHeartbeats:     {Code: 400, ErrCode: 10108, Description: "consumer with flow control also needs heartbeats"},
742
                JSInsufficientResourcesErr:                   {Code: 503, ErrCode: 10023, Description: "insufficient resources"},
743
                JSInvalidJSONErr:                             {Code: 400, ErrCode: 10025, Description: "invalid JSON: {err}"},
744
                JSMaximumConsumersLimitErr:                   {Code: 400, ErrCode: 10026, Description: "maximum consumers limit reached"},
745
                JSMaximumStreamsLimitErr:                     {Code: 400, ErrCode: 10027, Description: "maximum number of streams reached"},
746
                JSMemoryResourcesExceededErr:                 {Code: 500, ErrCode: 10028, Description: "insufficient memory resources available"},
747
                JSMessageCounterBrokenErr:                    {Code: 400, ErrCode: 10172, Description: "message counter is broken"},
748
                JSMessageIncrDisabledErr:                     {Code: 400, ErrCode: 10168, Description: "message counters is disabled"},
749
                JSMessageIncrInvalidErr:                      {Code: 400, ErrCode: 10171, Description: "message counter increment is invalid"},
750
                JSMessageIncrMissingErr:                      {Code: 400, ErrCode: 10169, Description: "message counter increment is missing"},
751
                JSMessageIncrPayloadErr:                      {Code: 400, ErrCode: 10170, Description: "message counter has payload"},
752
                JSMessageSchedulesDisabledErr:                {Code: 400, ErrCode: 10188, Description: "message schedules is disabled"},
753
                JSMessageSchedulesPatternInvalidErr:          {Code: 400, ErrCode: 10189, Description: "message schedules pattern is invalid"},
754
                JSMessageSchedulesRollupInvalidErr:           {Code: 400, ErrCode: 10192, Description: "message schedules invalid rollup"},
755
                JSMessageSchedulesSchedulerInvalidErr:        {Code: 400, ErrCode: 10212, Description: "message schedules invalid scheduler"},
756
                JSMessageSchedulesSourceInvalidErr:           {Code: 400, ErrCode: 10203, Description: "message schedules source is invalid"},
757
                JSMessageSchedulesTTLInvalidErr:              {Code: 400, ErrCode: 10191, Description: "message schedules invalid per-message TTL"},
758
                JSMessageSchedulesTargetInvalidErr:           {Code: 400, ErrCode: 10190, Description: "message schedules target is invalid"},
759
                JSMessageTTLDisabledErr:                      {Code: 400, ErrCode: 10166, Description: "per-message TTL is disabled"},
760
                JSMessageTTLInvalidErr:                       {Code: 400, ErrCode: 10165, Description: "invalid per-message TTL"},
761
                JSMirrorConsumerSetupFailedErrF:              {Code: 500, ErrCode: 10029, Description: "{err}"},
762
                JSMirrorInvalidStreamName:                    {Code: 400, ErrCode: 10142, Description: "mirrored stream name is invalid"},
763
                JSMirrorInvalidSubjectFilter:                 {Code: 400, ErrCode: 10151, Description: "mirror transform source: {err}"},
764
                JSMirrorInvalidTransformDestination:          {Code: 400, ErrCode: 10154, Description: "mirror transform: {err}"},
765
                JSMirrorMaxMessageSizeTooBigErr:              {Code: 400, ErrCode: 10030, Description: "stream mirror must have max message size >= source"},
766
                JSMirrorMultipleFiltersNotAllowed:            {Code: 400, ErrCode: 10150, Description: "mirror with multiple subject transforms cannot also have a single subject filter"},
767
                JSMirrorOverlappingSubjectFilters:            {Code: 400, ErrCode: 10152, Description: "mirror subject filters can not overlap"},
768
                JSMirrorWithAtomicPublishErr:                 {Code: 400, ErrCode: 10198, Description: "stream mirrors can not also use atomic publishing"},
769
                JSMirrorWithBatchPublishErr:                  {Code: 400, ErrCode: 10209, Description: "stream mirrors can not also use batch publishing"},
770
                JSMirrorWithCountersErr:                      {Code: 400, ErrCode: 10173, Description: "stream mirrors can not also calculate counters"},
771
                JSMirrorWithFirstSeqErr:                      {Code: 400, ErrCode: 10143, Description: "stream mirrors can not have first sequence configured"},
772
                JSMirrorWithMsgSchedulesErr:                  {Code: 400, ErrCode: 10186, Description: "stream mirrors can not also schedule messages"},
773
                JSMirrorWithSourcesErr:                       {Code: 400, ErrCode: 10031, Description: "stream mirrors can not also contain other sources"},
774
                JSMirrorWithStartSeqAndTimeErr:               {Code: 400, ErrCode: 10032, Description: "stream mirrors can not have both start seq and start time configured"},
775
                JSMirrorWithSubjectFiltersErr:                {Code: 400, ErrCode: 10033, Description: "stream mirrors can not contain filtered subjects"},
776
                JSMirrorWithSubjectsErr:                      {Code: 400, ErrCode: 10034, Description: "stream mirrors can not contain subjects"},
777
                JSNoAccountErr:                               {Code: 503, ErrCode: 10035, Description: "account not found"},
778
                JSNoLimitsErr:                                {Code: 400, ErrCode: 10120, Description: "no JetStream default or applicable tiered limit present"},
779
                JSNoMessageFoundErr:                          {Code: 404, ErrCode: 10037, Description: "no message found"},
780
                JSNotEmptyRequestErr:                         {Code: 400, ErrCode: 10038, Description: "expected an empty request payload"},
781
                JSNotEnabledErr:                              {Code: 503, ErrCode: 10076, Description: "JetStream not enabled"},
782
                JSNotEnabledForAccountErr:                    {Code: 503, ErrCode: 10039, Description: "JetStream not enabled for account"},
783
                JSPedanticErrF:                               {Code: 400, ErrCode: 10157, Description: "pedantic mode: {err}"},
784
                JSPeerRemapErr:                               {Code: 503, ErrCode: 10075, Description: "peer remap failed"},
785
                JSRaftGeneralErrF:                            {Code: 500, ErrCode: 10041, Description: "{err}"},
786
                JSReplicasCountCannotBeNegative:              {Code: 400, ErrCode: 10133, Description: "replicas count cannot be negative"},
787
                JSRequiredApiLevelErr:                        {Code: 412, ErrCode: 10185, Description: "JetStream minimum api level required"},
788
                JSRestoreSubscribeFailedErrF:                 {Code: 500, ErrCode: 10042, Description: "JetStream unable to subscribe to restore snapshot {subject}: {err}"},
789
                JSSequenceNotFoundErrF:                       {Code: 400, ErrCode: 10043, Description: "sequence {seq} not found"},
790
                JSSnapshotDeliverSubjectInvalidErr:           {Code: 400, ErrCode: 10015, Description: "deliver subject not valid"},
791
                JSSourceConsumerSetupFailedErrF:              {Code: 500, ErrCode: 10045, Description: "{err}"},
792
                JSSourceDuplicateDetected:                    {Code: 400, ErrCode: 10140, Description: "duplicate source configuration detected"},
793
                JSSourceInvalidStreamName:                    {Code: 400, ErrCode: 10141, Description: "sourced stream name is invalid"},
794
                JSSourceInvalidSubjectFilter:                 {Code: 400, ErrCode: 10145, Description: "source transform source: {err}"},
795
                JSSourceInvalidTransformDestination:          {Code: 400, ErrCode: 10146, Description: "source transform: {err}"},
796
                JSSourceMaxMessageSizeTooBigErr:              {Code: 400, ErrCode: 10046, Description: "stream source must have max message size >= target"},
797
                JSSourceMultipleFiltersNotAllowed:            {Code: 400, ErrCode: 10144, Description: "source with multiple subject transforms cannot also have a single subject filter"},
798
                JSSourceOverlappingSubjectFilters:            {Code: 400, ErrCode: 10147, Description: "source filters can not overlap"},
799
                JSSourceWithMsgSchedulesErr:                  {Code: 400, ErrCode: 10187, Description: "stream source can not also schedule messages"},
800
                JSStorageResourcesExceededErr:                {Code: 500, ErrCode: 10047, Description: "insufficient storage resources available"},
801
                JSStreamAssignmentErrF:                       {Code: 500, ErrCode: 10048, Description: "{err}"},
802
                JSStreamCreateErrF:                           {Code: 500, ErrCode: 10049, Description: "{err}"},
803
                JSStreamDeleteErrF:                           {Code: 500, ErrCode: 10050, Description: "{err}"},
804
                JSStreamDuplicateMessageConflict:             {Code: 409, ErrCode: 10158, Description: "duplicate message id is in process"},
805
                JSStreamExpectedLastSeqPerSubjectInvalid:     {Code: 400, ErrCode: 10193, Description: "missing sequence for expected last sequence per subject"},
806
                JSStreamExpectedLastSeqPerSubjectNotReady:    {Code: 503, ErrCode: 10163, Description: "expected last sequence per subject temporarily unavailable"},
807
                JSStreamExternalApiOverlapErrF:               {Code: 400, ErrCode: 10021, Description: "stream external api prefix {prefix} must not overlap with {subject}"},
808
                JSStreamExternalDelPrefixOverlapsErrF:        {Code: 400, ErrCode: 10022, Description: "stream external delivery prefix {prefix} overlaps with stream subject {subject}"},
809
                JSStreamGeneralErrorF:                        {Code: 500, ErrCode: 10051, Description: "{err}"},
810
                JSStreamHeaderExceedsMaximumErr:              {Code: 400, ErrCode: 10097, Description: "header size exceeds maximum allowed of 64k"},
811
                JSStreamInfoMaxSubjectsErr:                   {Code: 500, ErrCode: 10117, Description: "subject details would exceed maximum allowed"},
812
                JSStreamInvalidConfigF:                       {Code: 500, ErrCode: 10052, Description: "{err}"},
813
                JSStreamInvalidErr:                           {Code: 500, ErrCode: 10096, Description: "stream not valid"},
814
                JSStreamInvalidExternalDeliverySubjErrF:      {Code: 400, ErrCode: 10024, Description: "stream external delivery prefix {prefix} must not contain wildcards"},
815
                JSStreamLimitsErrF:                           {Code: 500, ErrCode: 10053, Description: "{err}"},
816
                JSStreamMaxBytesRequired:                     {Code: 400, ErrCode: 10113, Description: "account requires a stream config to have max bytes set"},
817
                JSStreamMaxStreamBytesExceeded:               {Code: 400, ErrCode: 10122, Description: "stream max bytes exceeds account limit max stream bytes"},
818
                JSStreamMessageExceedsMaximumErr:             {Code: 400, ErrCode: 10054, Description: "message size exceeds maximum allowed"},
819
                JSStreamMinLastSeqErr:                        {Code: 412, ErrCode: 10180, Description: "min last sequence"},
820
                JSStreamMirrorNotUpdatableErr:                {Code: 400, ErrCode: 10055, Description: "stream mirror configuration can not be updated"},
821
                JSStreamMismatchErr:                          {Code: 400, ErrCode: 10056, Description: "stream name in subject does not match request"},
822
                JSStreamMoveAndScaleErr:                      {Code: 400, ErrCode: 10123, Description: "can not move and scale a stream in a single update"},
823
                JSStreamMoveInProgressF:                      {Code: 400, ErrCode: 10124, Description: "stream move already in progress: {msg}"},
824
                JSStreamMoveNotInProgress:                    {Code: 400, ErrCode: 10129, Description: "stream move not in progress"},
825
                JSStreamMsgDeleteFailedF:                     {Code: 500, ErrCode: 10057, Description: "{err}"},
826
                JSStreamNameContainsPathSeparatorsErr:        {Code: 400, ErrCode: 10128, Description: "Stream name can not contain path separators"},
827
                JSStreamNameExistErr:                         {Code: 400, ErrCode: 10058, Description: "stream name already in use with a different configuration"},
828
                JSStreamNameExistRestoreFailedErr:            {Code: 400, ErrCode: 10130, Description: "stream name already in use, cannot restore"},
829
                JSStreamNotFoundErr:                          {Code: 404, ErrCode: 10059, Description: "stream not found"},
830
                JSStreamNotMatchErr:                          {Code: 400, ErrCode: 10060, Description: "expected stream does not match"},
831
                JSStreamOfflineErr:                           {Code: 500, ErrCode: 10118, Description: "stream is offline"},
832
                JSStreamOfflineReasonErrF:                    {Code: 500, ErrCode: 10194, Description: "stream is offline: {err}"},
833
                JSStreamPurgeFailedF:                         {Code: 500, ErrCode: 10110, Description: "{err}"},
834
                JSStreamReplicasNotSupportedErr:              {Code: 500, ErrCode: 10074, Description: "replicas > 1 not supported in non-clustered mode"},
835
                JSStreamReplicasNotUpdatableErr:              {Code: 400, ErrCode: 10061, Description: "Replicas configuration can not be updated"},
836
                JSStreamRestoreErrF:                          {Code: 500, ErrCode: 10062, Description: "restore failed: {err}"},
837
                JSStreamRollupFailedF:                        {Code: 500, ErrCode: 10111, Description: "{err}"},
838
                JSStreamSealedErr:                            {Code: 400, ErrCode: 10109, Description: "invalid operation on sealed stream"},
839
                JSStreamSequenceNotMatchErr:                  {Code: 503, ErrCode: 10063, Description: "expected stream sequence does not match"},
840
                JSStreamSnapshotErrF:                         {Code: 500, ErrCode: 10064, Description: "snapshot failed: {err}"},
841
                JSStreamStoreFailedF:                         {Code: 503, ErrCode: 10077, Description: "{err}"},
842
                JSStreamSubjectOverlapErr:                    {Code: 400, ErrCode: 10065, Description: "subjects overlap with an existing stream"},
843
                JSStreamTemplateCreateErrF:                   {Code: 500, ErrCode: 10066, Description: "{err}"},
844
                JSStreamTemplateDeleteErrF:                   {Code: 500, ErrCode: 10067, Description: "{err}"},
845
                JSStreamTemplateNotFoundErr:                  {Code: 404, ErrCode: 10068, Description: "template not found"},
846
                JSStreamTooManyRequests:                      {Code: 429, ErrCode: 10167, Description: "too many requests"},
847
                JSStreamTransformInvalidDestination:          {Code: 400, ErrCode: 10156, Description: "stream transform: {err}"},
848
                JSStreamTransformInvalidSource:               {Code: 400, ErrCode: 10155, Description: "stream transform source: {err}"},
849
                JSStreamUpdateErrF:                           {Code: 500, ErrCode: 10069, Description: "{err}"},
850
                JSStreamWrongLastMsgIDErrF:                   {Code: 400, ErrCode: 10070, Description: "wrong last msg ID: {id}"},
851
                JSStreamWrongLastSequenceConstantErr:         {Code: 400, ErrCode: 10164, Description: "wrong last sequence"},
852
                JSStreamWrongLastSequenceErrF:                {Code: 400, ErrCode: 10071, Description: "wrong last sequence: {seq}"},
853
                JSTempStorageFailedErr:                       {Code: 500, ErrCode: 10072, Description: "JetStream unable to open temp storage for restore"},
854
                JSTemplateNameNotMatchSubjectErr:             {Code: 400, ErrCode: 10073, Description: "template name in subject does not match request"},
855
        }
856
        // ErrJetStreamNotClustered Deprecated by JSClusterNotActiveErr ApiError, use IsNatsError() for comparisons
857
        ErrJetStreamNotClustered = ApiErrors[JSClusterNotActiveErr]
858
        // ErrJetStreamNotAssigned Deprecated by JSClusterNotAssignedErr ApiError, use IsNatsError() for comparisons
859
        ErrJetStreamNotAssigned = ApiErrors[JSClusterNotAssignedErr]
860
        // ErrJetStreamNotLeader Deprecated by JSClusterNotLeaderErr ApiError, use IsNatsError() for comparisons
861
        ErrJetStreamNotLeader = ApiErrors[JSClusterNotLeaderErr]
862
        // ErrJetStreamConsumerAlreadyUsed Deprecated by JSConsumerNameExistErr ApiError, use IsNatsError() for comparisons
863
        ErrJetStreamConsumerAlreadyUsed = ApiErrors[JSConsumerNameExistErr]
864
        // ErrJetStreamResourcesExceeded Deprecated by JSInsufficientResourcesErr ApiError, use IsNatsError() for comparisons
865
        ErrJetStreamResourcesExceeded = ApiErrors[JSInsufficientResourcesErr]
866
        // ErrMemoryResourcesExceeded Deprecated by JSMemoryResourcesExceededErr ApiError, use IsNatsError() for comparisons
867
        ErrMemoryResourcesExceeded = ApiErrors[JSMemoryResourcesExceededErr]
868
        // ErrJetStreamNotEnabled Deprecated by JSNotEnabledErr ApiError, use IsNatsError() for comparisons
869
        ErrJetStreamNotEnabled = ApiErrors[JSNotEnabledErr]
870
        // ErrStorageResourcesExceeded Deprecated by JSStorageResourcesExceededErr ApiError, use IsNatsError() for comparisons
871
        ErrStorageResourcesExceeded = ApiErrors[JSStorageResourcesExceededErr]
872
        // ErrJetStreamStreamAlreadyUsed Deprecated by JSStreamNameExistErr ApiError, use IsNatsError() for comparisons
873
        ErrJetStreamStreamAlreadyUsed = ApiErrors[JSStreamNameExistErr]
874
        // ErrJetStreamStreamNotFound Deprecated by JSStreamNotFoundErr ApiError, use IsNatsError() for comparisons
875
        ErrJetStreamStreamNotFound = ApiErrors[JSStreamNotFoundErr]
876
        // ErrReplicasNotSupported Deprecated by JSStreamReplicasNotSupportedErr ApiError, use IsNatsError() for comparisons
877
        ErrReplicasNotSupported = ApiErrors[JSStreamReplicasNotSupportedErr]
878
)
879

880
// NewJSAccountResourcesExceededError creates a new JSAccountResourcesExceededErr error: "resource limits exceeded for account"
881
func NewJSAccountResourcesExceededError(opts ...ErrorOption) *ApiError {
20,067✔
882
        eopts := parseOpts(opts)
20,067✔
883
        if ae, ok := eopts.err.(*ApiError); ok {
20,067✔
884
                return ae
×
885
        }
×
886

887
        return ApiErrors[JSAccountResourcesExceededErr]
20,067✔
888
}
889

890
// NewJSAtomicPublishContainsDuplicateMessageError creates a new JSAtomicPublishContainsDuplicateMessageErr error: "atomic publish batch contains duplicate message id"
891
func NewJSAtomicPublishContainsDuplicateMessageError(opts ...ErrorOption) *ApiError {
22,081✔
892
        eopts := parseOpts(opts)
22,081✔
893
        if ae, ok := eopts.err.(*ApiError); ok {
22,081✔
894
                return ae
×
895
        }
×
896

897
        return ApiErrors[JSAtomicPublishContainsDuplicateMessageErr]
22,081✔
898
}
899

900
// NewJSAtomicPublishDisabledError creates a new JSAtomicPublishDisabledErr error: "atomic publish is disabled"
901
func NewJSAtomicPublishDisabledError(opts ...ErrorOption) *ApiError {
24✔
902
        eopts := parseOpts(opts)
24✔
903
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
904
                return ae
×
905
        }
×
906

907
        return ApiErrors[JSAtomicPublishDisabledErr]
24✔
908
}
909

910
// NewJSAtomicPublishIncompleteBatchError creates a new JSAtomicPublishIncompleteBatchErr error: "atomic publish batch is incomplete"
911
func NewJSAtomicPublishIncompleteBatchError(opts ...ErrorOption) *ApiError {
54✔
912
        eopts := parseOpts(opts)
54✔
913
        if ae, ok := eopts.err.(*ApiError); ok {
54✔
914
                return ae
×
915
        }
×
916

917
        return ApiErrors[JSAtomicPublishIncompleteBatchErr]
54✔
918
}
919

920
// NewJSAtomicPublishInvalidBatchCommitError creates a new JSAtomicPublishInvalidBatchCommitErr error: "atomic publish batch commit is invalid"
921
func NewJSAtomicPublishInvalidBatchCommitError(opts ...ErrorOption) *ApiError {
6✔
922
        eopts := parseOpts(opts)
6✔
923
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
924
                return ae
×
925
        }
×
926

927
        return ApiErrors[JSAtomicPublishInvalidBatchCommitErr]
6✔
928
}
929

930
// NewJSAtomicPublishInvalidBatchIDError creates a new JSAtomicPublishInvalidBatchIDErr error: "atomic publish batch ID is invalid"
931
func NewJSAtomicPublishInvalidBatchIDError(opts ...ErrorOption) *ApiError {
4✔
932
        eopts := parseOpts(opts)
4✔
933
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
934
                return ae
×
935
        }
×
936

937
        return ApiErrors[JSAtomicPublishInvalidBatchIDErr]
4✔
938
}
939

940
// NewJSAtomicPublishMissingSeqError creates a new JSAtomicPublishMissingSeqErr error: "atomic publish sequence is missing"
941
func NewJSAtomicPublishMissingSeqError(opts ...ErrorOption) *ApiError {
24✔
942
        eopts := parseOpts(opts)
24✔
943
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
944
                return ae
×
945
        }
×
946

947
        return ApiErrors[JSAtomicPublishMissingSeqErr]
24✔
948
}
949

950
// NewJSAtomicPublishTooLargeBatchError creates a new JSAtomicPublishTooLargeBatchErrF error: "atomic publish batch is too large: {size}"
951
func NewJSAtomicPublishTooLargeBatchError(size interface{}, opts ...ErrorOption) *ApiError {
10✔
952
        eopts := parseOpts(opts)
10✔
953
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
954
                return ae
×
955
        }
×
956

957
        e := ApiErrors[JSAtomicPublishTooLargeBatchErrF]
10✔
958
        args := e.toReplacerArgs([]interface{}{"{size}", size})
10✔
959
        return &ApiError{
10✔
960
                Code:        e.Code,
10✔
961
                ErrCode:     e.ErrCode,
10✔
962
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
963
        }
10✔
964
}
965

966
// NewJSAtomicPublishTooManyInflightError creates a new JSAtomicPublishTooManyInflight error: "atomic publish too many inflight"
967
func NewJSAtomicPublishTooManyInflightError(opts ...ErrorOption) *ApiError {
8✔
968
        eopts := parseOpts(opts)
8✔
969
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
970
                return ae
×
971
        }
×
972

973
        return ApiErrors[JSAtomicPublishTooManyInflight]
8✔
974
}
975

976
// NewJSAtomicPublishUnsupportedHeaderBatchError creates a new JSAtomicPublishUnsupportedHeaderBatchErr error: "atomic publish unsupported header used: {header}"
977
func NewJSAtomicPublishUnsupportedHeaderBatchError(header interface{}, opts ...ErrorOption) *ApiError {
4✔
978
        eopts := parseOpts(opts)
4✔
979
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
980
                return ae
×
981
        }
×
982

983
        e := ApiErrors[JSAtomicPublishUnsupportedHeaderBatchErr]
4✔
984
        args := e.toReplacerArgs([]interface{}{"{header}", header})
4✔
985
        return &ApiError{
4✔
986
                Code:        e.Code,
4✔
987
                ErrCode:     e.ErrCode,
4✔
988
                Description: strings.NewReplacer(args...).Replace(e.Description),
4✔
989
        }
4✔
990
}
991

992
// NewJSBadRequestError creates a new JSBadRequestErr error: "bad request"
993
func NewJSBadRequestError(opts ...ErrorOption) *ApiError {
10✔
994
        eopts := parseOpts(opts)
10✔
995
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
996
                return ae
×
997
        }
×
998

999
        return ApiErrors[JSBadRequestErr]
10✔
1000
}
1001

1002
// NewJSBatchPublishDisabledError creates a new JSBatchPublishDisabledErr error: "batch publish is disabled"
1003
func NewJSBatchPublishDisabledError(opts ...ErrorOption) *ApiError {
24✔
1004
        eopts := parseOpts(opts)
24✔
1005
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
1006
                return ae
×
1007
        }
×
1008

1009
        return ApiErrors[JSBatchPublishDisabledErr]
24✔
1010
}
1011

1012
// NewJSBatchPublishInvalidBatchIDError creates a new JSBatchPublishInvalidBatchIDErr error: "batch publish ID is invalid"
1013
func NewJSBatchPublishInvalidBatchIDError(opts ...ErrorOption) *ApiError {
28✔
1014
        eopts := parseOpts(opts)
28✔
1015
        if ae, ok := eopts.err.(*ApiError); ok {
28✔
1016
                return ae
×
1017
        }
×
1018

1019
        return ApiErrors[JSBatchPublishInvalidBatchIDErr]
28✔
1020
}
1021

1022
// NewJSBatchPublishInvalidPatternError creates a new JSBatchPublishInvalidPatternErr error: "batch publish pattern is invalid"
1023
func NewJSBatchPublishInvalidPatternError(opts ...ErrorOption) *ApiError {
28✔
1024
        eopts := parseOpts(opts)
28✔
1025
        if ae, ok := eopts.err.(*ApiError); ok {
28✔
1026
                return ae
×
1027
        }
×
1028

1029
        return ApiErrors[JSBatchPublishInvalidPatternErr]
28✔
1030
}
1031

1032
// NewJSBatchPublishTooManyInflightError creates a new JSBatchPublishTooManyInflight error: "batch publish too many inflight"
1033
func NewJSBatchPublishTooManyInflightError(opts ...ErrorOption) *ApiError {
8✔
1034
        eopts := parseOpts(opts)
8✔
1035
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1036
                return ae
×
1037
        }
×
1038

1039
        return ApiErrors[JSBatchPublishTooManyInflight]
8✔
1040
}
1041

1042
// NewJSBatchPublishUnknownBatchIDError creates a new JSBatchPublishUnknownBatchIDErr error: "batch publish ID unknown"
1043
func NewJSBatchPublishUnknownBatchIDError(opts ...ErrorOption) *ApiError {
28✔
1044
        eopts := parseOpts(opts)
28✔
1045
        if ae, ok := eopts.err.(*ApiError); ok {
28✔
1046
                return ae
×
1047
        }
×
1048

1049
        return ApiErrors[JSBatchPublishUnknownBatchIDErr]
28✔
1050
}
1051

1052
// NewJSClusterIncompleteError creates a new JSClusterIncompleteErr error: "incomplete results"
1053
func NewJSClusterIncompleteError(opts ...ErrorOption) *ApiError {
×
1054
        eopts := parseOpts(opts)
×
1055
        if ae, ok := eopts.err.(*ApiError); ok {
×
1056
                return ae
×
1057
        }
×
1058

1059
        return ApiErrors[JSClusterIncompleteErr]
×
1060
}
1061

1062
// NewJSClusterNoPeersError creates a new JSClusterNoPeersErrF error: "{err}"
1063
func NewJSClusterNoPeersError(err error, opts ...ErrorOption) *ApiError {
59✔
1064
        eopts := parseOpts(opts)
59✔
1065
        if ae, ok := eopts.err.(*ApiError); ok {
59✔
1066
                return ae
×
1067
        }
×
1068

1069
        e := ApiErrors[JSClusterNoPeersErrF]
59✔
1070
        args := e.toReplacerArgs([]interface{}{"{err}", err})
59✔
1071
        return &ApiError{
59✔
1072
                Code:        e.Code,
59✔
1073
                ErrCode:     e.ErrCode,
59✔
1074
                Description: strings.NewReplacer(args...).Replace(e.Description),
59✔
1075
        }
59✔
1076
}
1077

1078
// NewJSClusterNotActiveError creates a new JSClusterNotActiveErr error: "JetStream not in clustered mode"
1079
func NewJSClusterNotActiveError(opts ...ErrorOption) *ApiError {
1✔
1080
        eopts := parseOpts(opts)
1✔
1081
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1082
                return ae
×
1083
        }
×
1084

1085
        return ApiErrors[JSClusterNotActiveErr]
1✔
1086
}
1087

1088
// NewJSClusterNotAssignedError creates a new JSClusterNotAssignedErr error: "JetStream cluster not assigned to this server"
1089
func NewJSClusterNotAssignedError(opts ...ErrorOption) *ApiError {
1✔
1090
        eopts := parseOpts(opts)
1✔
1091
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1092
                return ae
×
1093
        }
×
1094

1095
        return ApiErrors[JSClusterNotAssignedErr]
1✔
1096
}
1097

1098
// NewJSClusterNotAvailError creates a new JSClusterNotAvailErr error: "JetStream system temporarily unavailable"
1099
func NewJSClusterNotAvailError(opts ...ErrorOption) *ApiError {
13✔
1100
        eopts := parseOpts(opts)
13✔
1101
        if ae, ok := eopts.err.(*ApiError); ok {
13✔
1102
                return ae
×
1103
        }
×
1104

1105
        return ApiErrors[JSClusterNotAvailErr]
13✔
1106
}
1107

1108
// NewJSClusterNotLeaderError creates a new JSClusterNotLeaderErr error: "JetStream cluster can not handle request"
1109
func NewJSClusterNotLeaderError(opts ...ErrorOption) *ApiError {
50✔
1110
        eopts := parseOpts(opts)
50✔
1111
        if ae, ok := eopts.err.(*ApiError); ok {
50✔
1112
                return ae
×
1113
        }
×
1114

1115
        return ApiErrors[JSClusterNotLeaderErr]
50✔
1116
}
1117

1118
// NewJSClusterPeerNotMemberError creates a new JSClusterPeerNotMemberErr error: "peer not a member"
1119
func NewJSClusterPeerNotMemberError(opts ...ErrorOption) *ApiError {
1✔
1120
        eopts := parseOpts(opts)
1✔
1121
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1122
                return ae
×
1123
        }
×
1124

1125
        return ApiErrors[JSClusterPeerNotMemberErr]
1✔
1126
}
1127

1128
// NewJSClusterRequiredError creates a new JSClusterRequiredErr error: "JetStream clustering support required"
1129
func NewJSClusterRequiredError(opts ...ErrorOption) *ApiError {
6✔
1130
        eopts := parseOpts(opts)
6✔
1131
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1132
                return ae
×
1133
        }
×
1134

1135
        return ApiErrors[JSClusterRequiredErr]
6✔
1136
}
1137

1138
// NewJSClusterServerMemberChangeInflightError creates a new JSClusterServerMemberChangeInflightErr error: "cluster member change is in progress"
1139
func NewJSClusterServerMemberChangeInflightError(opts ...ErrorOption) *ApiError {
6✔
1140
        eopts := parseOpts(opts)
6✔
1141
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1142
                return ae
×
1143
        }
×
1144

1145
        return ApiErrors[JSClusterServerMemberChangeInflightErr]
6✔
1146
}
1147

1148
// NewJSClusterServerNotMemberError creates a new JSClusterServerNotMemberErr error: "server is not a member of the cluster"
1149
func NewJSClusterServerNotMemberError(opts ...ErrorOption) *ApiError {
6✔
1150
        eopts := parseOpts(opts)
6✔
1151
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1152
                return ae
×
1153
        }
×
1154

1155
        return ApiErrors[JSClusterServerNotMemberErr]
6✔
1156
}
1157

1158
// NewJSClusterTagsError creates a new JSClusterTagsErr error: "tags placement not supported for operation"
1159
func NewJSClusterTagsError(opts ...ErrorOption) *ApiError {
×
1160
        eopts := parseOpts(opts)
×
1161
        if ae, ok := eopts.err.(*ApiError); ok {
×
1162
                return ae
×
1163
        }
×
1164

1165
        return ApiErrors[JSClusterTagsErr]
×
1166
}
1167

1168
// NewJSClusterUnSupportFeatureError creates a new JSClusterUnSupportFeatureErr error: "not currently supported in clustered mode"
1169
func NewJSClusterUnSupportFeatureError(opts ...ErrorOption) *ApiError {
×
1170
        eopts := parseOpts(opts)
×
1171
        if ae, ok := eopts.err.(*ApiError); ok {
×
1172
                return ae
×
1173
        }
×
1174

1175
        return ApiErrors[JSClusterUnSupportFeatureErr]
×
1176
}
1177

1178
// NewJSConsumerAckPolicyInvalidError creates a new JSConsumerAckPolicyInvalidErr error: "consumer ack policy invalid"
1179
func NewJSConsumerAckPolicyInvalidError(opts ...ErrorOption) *ApiError {
2✔
1180
        eopts := parseOpts(opts)
2✔
1181
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1182
                return ae
×
1183
        }
×
1184

1185
        return ApiErrors[JSConsumerAckPolicyInvalidErr]
2✔
1186
}
1187

1188
// NewJSConsumerAckWaitNegativeError creates a new JSConsumerAckWaitNegativeErr error: "consumer ack wait needs to be positive"
1189
func NewJSConsumerAckWaitNegativeError(opts ...ErrorOption) *ApiError {
2✔
1190
        eopts := parseOpts(opts)
2✔
1191
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1192
                return ae
×
1193
        }
×
1194

1195
        return ApiErrors[JSConsumerAckWaitNegativeErr]
2✔
1196
}
1197

1198
// NewJSConsumerAlreadyExistsError creates a new JSConsumerAlreadyExists error: "consumer already exists"
1199
func NewJSConsumerAlreadyExistsError(opts ...ErrorOption) *ApiError {
5✔
1200
        eopts := parseOpts(opts)
5✔
1201
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
1202
                return ae
×
1203
        }
×
1204

1205
        return ApiErrors[JSConsumerAlreadyExists]
5✔
1206
}
1207

1208
// NewJSConsumerBackOffNegativeError creates a new JSConsumerBackOffNegativeErr error: "consumer backoff needs to be positive"
1209
func NewJSConsumerBackOffNegativeError(opts ...ErrorOption) *ApiError {
2✔
1210
        eopts := parseOpts(opts)
2✔
1211
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1212
                return ae
×
1213
        }
×
1214

1215
        return ApiErrors[JSConsumerBackOffNegativeErr]
2✔
1216
}
1217

1218
// NewJSConsumerBadDurableNameError creates a new JSConsumerBadDurableNameErr error: "durable name can not contain '.', '*', '>'"
1219
func NewJSConsumerBadDurableNameError(opts ...ErrorOption) *ApiError {
×
1220
        eopts := parseOpts(opts)
×
1221
        if ae, ok := eopts.err.(*ApiError); ok {
×
1222
                return ae
×
1223
        }
×
1224

1225
        return ApiErrors[JSConsumerBadDurableNameErr]
×
1226
}
1227

1228
// NewJSConsumerConfigRequiredError creates a new JSConsumerConfigRequiredErr error: "consumer config required"
1229
func NewJSConsumerConfigRequiredError(opts ...ErrorOption) *ApiError {
2✔
1230
        eopts := parseOpts(opts)
2✔
1231
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1232
                return ae
×
1233
        }
×
1234

1235
        return ApiErrors[JSConsumerConfigRequiredErr]
2✔
1236
}
1237

1238
// NewJSConsumerCreateDurableAndNameMismatchError creates a new JSConsumerCreateDurableAndNameMismatch error: "Consumer Durable and Name have to be equal if both are provided"
1239
func NewJSConsumerCreateDurableAndNameMismatchError(opts ...ErrorOption) *ApiError {
1✔
1240
        eopts := parseOpts(opts)
1✔
1241
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1242
                return ae
×
1243
        }
×
1244

1245
        return ApiErrors[JSConsumerCreateDurableAndNameMismatch]
1✔
1246
}
1247

1248
// NewJSConsumerCreateError creates a new JSConsumerCreateErrF error: "{err}"
1249
func NewJSConsumerCreateError(err error, opts ...ErrorOption) *ApiError {
75✔
1250
        eopts := parseOpts(opts)
75✔
1251
        if ae, ok := eopts.err.(*ApiError); ok {
132✔
1252
                return ae
57✔
1253
        }
57✔
1254

1255
        e := ApiErrors[JSConsumerCreateErrF]
18✔
1256
        args := e.toReplacerArgs([]interface{}{"{err}", err})
18✔
1257
        return &ApiError{
18✔
1258
                Code:        e.Code,
18✔
1259
                ErrCode:     e.ErrCode,
18✔
1260
                Description: strings.NewReplacer(args...).Replace(e.Description),
18✔
1261
        }
18✔
1262
}
1263

1264
// NewJSConsumerCreateFilterSubjectMismatchError creates a new JSConsumerCreateFilterSubjectMismatchErr error: "Consumer create request did not match filtered subject from create subject"
1265
func NewJSConsumerCreateFilterSubjectMismatchError(opts ...ErrorOption) *ApiError {
2✔
1266
        eopts := parseOpts(opts)
2✔
1267
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1268
                return ae
×
1269
        }
×
1270

1271
        return ApiErrors[JSConsumerCreateFilterSubjectMismatchErr]
2✔
1272
}
1273

1274
// NewJSConsumerDeliverCycleError creates a new JSConsumerDeliverCycleErr error: "consumer deliver subject forms a cycle"
1275
func NewJSConsumerDeliverCycleError(opts ...ErrorOption) *ApiError {
4✔
1276
        eopts := parseOpts(opts)
4✔
1277
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1278
                return ae
×
1279
        }
×
1280

1281
        return ApiErrors[JSConsumerDeliverCycleErr]
4✔
1282
}
1283

1284
// NewJSConsumerDeliverToWildcardsError creates a new JSConsumerDeliverToWildcardsErr error: "consumer deliver subject has wildcards"
1285
func NewJSConsumerDeliverToWildcardsError(opts ...ErrorOption) *ApiError {
4✔
1286
        eopts := parseOpts(opts)
4✔
1287
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1288
                return ae
×
1289
        }
×
1290

1291
        return ApiErrors[JSConsumerDeliverToWildcardsErr]
4✔
1292
}
1293

1294
// NewJSConsumerDescriptionTooLongError creates a new JSConsumerDescriptionTooLongErrF error: "consumer description is too long, maximum allowed is {max}"
1295
func NewJSConsumerDescriptionTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
1✔
1296
        eopts := parseOpts(opts)
1✔
1297
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1298
                return ae
×
1299
        }
×
1300

1301
        e := ApiErrors[JSConsumerDescriptionTooLongErrF]
1✔
1302
        args := e.toReplacerArgs([]interface{}{"{max}", max})
1✔
1303
        return &ApiError{
1✔
1304
                Code:        e.Code,
1✔
1305
                ErrCode:     e.ErrCode,
1✔
1306
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1307
        }
1✔
1308
}
1309

1310
// NewJSConsumerDirectRequiresEphemeralError creates a new JSConsumerDirectRequiresEphemeralErr error: "consumer direct requires an ephemeral consumer"
1311
func NewJSConsumerDirectRequiresEphemeralError(opts ...ErrorOption) *ApiError {
×
1312
        eopts := parseOpts(opts)
×
1313
        if ae, ok := eopts.err.(*ApiError); ok {
×
1314
                return ae
×
1315
        }
×
1316

1317
        return ApiErrors[JSConsumerDirectRequiresEphemeralErr]
×
1318
}
1319

1320
// NewJSConsumerDirectRequiresPushError creates a new JSConsumerDirectRequiresPushErr error: "consumer direct requires a push based consumer"
1321
func NewJSConsumerDirectRequiresPushError(opts ...ErrorOption) *ApiError {
×
1322
        eopts := parseOpts(opts)
×
1323
        if ae, ok := eopts.err.(*ApiError); ok {
×
1324
                return ae
×
1325
        }
×
1326

1327
        return ApiErrors[JSConsumerDirectRequiresPushErr]
×
1328
}
1329

1330
// NewJSConsumerDoesNotExistError creates a new JSConsumerDoesNotExist error: "consumer does not exist"
1331
func NewJSConsumerDoesNotExistError(opts ...ErrorOption) *ApiError {
3✔
1332
        eopts := parseOpts(opts)
3✔
1333
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1334
                return ae
×
1335
        }
×
1336

1337
        return ApiErrors[JSConsumerDoesNotExist]
3✔
1338
}
1339

1340
// NewJSConsumerDuplicateFilterSubjectsError creates a new JSConsumerDuplicateFilterSubjects error: "consumer cannot have both FilterSubject and FilterSubjects specified"
1341
func NewJSConsumerDuplicateFilterSubjectsError(opts ...ErrorOption) *ApiError {
1✔
1342
        eopts := parseOpts(opts)
1✔
1343
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1344
                return ae
×
1345
        }
×
1346

1347
        return ApiErrors[JSConsumerDuplicateFilterSubjects]
1✔
1348
}
1349

1350
// NewJSConsumerDurableNameNotInSubjectError creates a new JSConsumerDurableNameNotInSubjectErr error: "consumer expected to be durable but no durable name set in subject"
1351
func NewJSConsumerDurableNameNotInSubjectError(opts ...ErrorOption) *ApiError {
×
1352
        eopts := parseOpts(opts)
×
1353
        if ae, ok := eopts.err.(*ApiError); ok {
×
1354
                return ae
×
1355
        }
×
1356

1357
        return ApiErrors[JSConsumerDurableNameNotInSubjectErr]
×
1358
}
1359

1360
// NewJSConsumerDurableNameNotMatchSubjectError creates a new JSConsumerDurableNameNotMatchSubjectErr error: "consumer name in subject does not match durable name in request"
1361
func NewJSConsumerDurableNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
×
1362
        eopts := parseOpts(opts)
×
1363
        if ae, ok := eopts.err.(*ApiError); ok {
×
1364
                return ae
×
1365
        }
×
1366

1367
        return ApiErrors[JSConsumerDurableNameNotMatchSubjectErr]
×
1368
}
1369

1370
// NewJSConsumerDurableNameNotSetError creates a new JSConsumerDurableNameNotSetErr error: "consumer expected to be durable but a durable name was not set"
1371
func NewJSConsumerDurableNameNotSetError(opts ...ErrorOption) *ApiError {
1✔
1372
        eopts := parseOpts(opts)
1✔
1373
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1374
                return ae
×
1375
        }
×
1376

1377
        return ApiErrors[JSConsumerDurableNameNotSetErr]
1✔
1378
}
1379

1380
// NewJSConsumerEmptyFilterError creates a new JSConsumerEmptyFilter error: "consumer filter in FilterSubjects cannot be empty"
1381
func NewJSConsumerEmptyFilterError(opts ...ErrorOption) *ApiError {
1✔
1382
        eopts := parseOpts(opts)
1✔
1383
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1384
                return ae
×
1385
        }
×
1386

1387
        return ApiErrors[JSConsumerEmptyFilter]
1✔
1388
}
1389

1390
// NewJSConsumerEmptyGroupNameError creates a new JSConsumerEmptyGroupName error: "Group name cannot be an empty string"
1391
func NewJSConsumerEmptyGroupNameError(opts ...ErrorOption) *ApiError {
4✔
1392
        eopts := parseOpts(opts)
4✔
1393
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1394
                return ae
×
1395
        }
×
1396

1397
        return ApiErrors[JSConsumerEmptyGroupName]
4✔
1398
}
1399

1400
// NewJSConsumerEphemeralWithDurableInSubjectError creates a new JSConsumerEphemeralWithDurableInSubjectErr error: "consumer expected to be ephemeral but detected a durable name set in subject"
1401
func NewJSConsumerEphemeralWithDurableInSubjectError(opts ...ErrorOption) *ApiError {
×
1402
        eopts := parseOpts(opts)
×
1403
        if ae, ok := eopts.err.(*ApiError); ok {
×
1404
                return ae
×
1405
        }
×
1406

1407
        return ApiErrors[JSConsumerEphemeralWithDurableInSubjectErr]
×
1408
}
1409

1410
// NewJSConsumerEphemeralWithDurableNameError creates a new JSConsumerEphemeralWithDurableNameErr error: "consumer expected to be ephemeral but a durable name was set in request"
1411
func NewJSConsumerEphemeralWithDurableNameError(opts ...ErrorOption) *ApiError {
3✔
1412
        eopts := parseOpts(opts)
3✔
1413
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1414
                return ae
×
1415
        }
×
1416

1417
        return ApiErrors[JSConsumerEphemeralWithDurableNameErr]
3✔
1418
}
1419

1420
// NewJSConsumerExistingActiveError creates a new JSConsumerExistingActiveErr error: "consumer already exists and is still active"
1421
func NewJSConsumerExistingActiveError(opts ...ErrorOption) *ApiError {
×
1422
        eopts := parseOpts(opts)
×
1423
        if ae, ok := eopts.err.(*ApiError); ok {
×
1424
                return ae
×
1425
        }
×
1426

1427
        return ApiErrors[JSConsumerExistingActiveErr]
×
1428
}
1429

1430
// NewJSConsumerFCRequiresPushError creates a new JSConsumerFCRequiresPushErr error: "consumer flow control requires a push based consumer"
1431
func NewJSConsumerFCRequiresPushError(opts ...ErrorOption) *ApiError {
×
1432
        eopts := parseOpts(opts)
×
1433
        if ae, ok := eopts.err.(*ApiError); ok {
×
1434
                return ae
×
1435
        }
×
1436

1437
        return ApiErrors[JSConsumerFCRequiresPushErr]
×
1438
}
1439

1440
// NewJSConsumerFilterNotSubsetError creates a new JSConsumerFilterNotSubsetErr error: "consumer filter subject is not a valid subset of the interest subjects"
1441
func NewJSConsumerFilterNotSubsetError(opts ...ErrorOption) *ApiError {
×
1442
        eopts := parseOpts(opts)
×
1443
        if ae, ok := eopts.err.(*ApiError); ok {
×
1444
                return ae
×
1445
        }
×
1446

1447
        return ApiErrors[JSConsumerFilterNotSubsetErr]
×
1448
}
1449

1450
// NewJSConsumerHBRequiresPushError creates a new JSConsumerHBRequiresPushErr error: "consumer idle heartbeat requires a push based consumer"
1451
func NewJSConsumerHBRequiresPushError(opts ...ErrorOption) *ApiError {
×
1452
        eopts := parseOpts(opts)
×
1453
        if ae, ok := eopts.err.(*ApiError); ok {
×
1454
                return ae
×
1455
        }
×
1456

1457
        return ApiErrors[JSConsumerHBRequiresPushErr]
×
1458
}
1459

1460
// NewJSConsumerInactiveThresholdExcessError creates a new JSConsumerInactiveThresholdExcess error: "consumer inactive threshold exceeds system limit of {limit}"
1461
func NewJSConsumerInactiveThresholdExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
2✔
1462
        eopts := parseOpts(opts)
2✔
1463
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1464
                return ae
×
1465
        }
×
1466

1467
        e := ApiErrors[JSConsumerInactiveThresholdExcess]
2✔
1468
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
2✔
1469
        return &ApiError{
2✔
1470
                Code:        e.Code,
2✔
1471
                ErrCode:     e.ErrCode,
2✔
1472
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1473
        }
2✔
1474
}
1475

1476
// NewJSConsumerInvalidDeliverSubjectError creates a new JSConsumerInvalidDeliverSubject error: "invalid push consumer deliver subject"
1477
func NewJSConsumerInvalidDeliverSubjectError(opts ...ErrorOption) *ApiError {
2✔
1478
        eopts := parseOpts(opts)
2✔
1479
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1480
                return ae
×
1481
        }
×
1482

1483
        return ApiErrors[JSConsumerInvalidDeliverSubject]
2✔
1484
}
1485

1486
// NewJSConsumerInvalidGroupNameError creates a new JSConsumerInvalidGroupNameErr error: "Valid priority group name must match A-Z, a-z, 0-9, -_/=)+ and may not exceed 16 characters"
1487
func NewJSConsumerInvalidGroupNameError(opts ...ErrorOption) *ApiError {
2✔
1488
        eopts := parseOpts(opts)
2✔
1489
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1490
                return ae
×
1491
        }
×
1492

1493
        return ApiErrors[JSConsumerInvalidGroupNameErr]
2✔
1494
}
1495

1496
// NewJSConsumerInvalidPolicyError creates a new JSConsumerInvalidPolicyErrF error: "{err}"
1497
func NewJSConsumerInvalidPolicyError(err error, opts ...ErrorOption) *ApiError {
10✔
1498
        eopts := parseOpts(opts)
10✔
1499
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1500
                return ae
×
1501
        }
×
1502

1503
        e := ApiErrors[JSConsumerInvalidPolicyErrF]
10✔
1504
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1505
        return &ApiError{
10✔
1506
                Code:        e.Code,
10✔
1507
                ErrCode:     e.ErrCode,
10✔
1508
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1509
        }
10✔
1510
}
1511

1512
// NewJSConsumerInvalidPriorityGroupError creates a new JSConsumerInvalidPriorityGroupErr error: "Provided priority group does not exist for this consumer"
1513
func NewJSConsumerInvalidPriorityGroupError(opts ...ErrorOption) *ApiError {
2✔
1514
        eopts := parseOpts(opts)
2✔
1515
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1516
                return ae
×
1517
        }
×
1518

1519
        return ApiErrors[JSConsumerInvalidPriorityGroupErr]
2✔
1520
}
1521

1522
// NewJSConsumerInvalidResetError creates a new JSConsumerInvalidResetErr error: "invalid reset: {err}"
1523
func NewJSConsumerInvalidResetError(err error, opts ...ErrorOption) *ApiError {
4✔
1524
        eopts := parseOpts(opts)
4✔
1525
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1526
                return ae
×
1527
        }
×
1528

1529
        e := ApiErrors[JSConsumerInvalidResetErr]
4✔
1530
        args := e.toReplacerArgs([]interface{}{"{err}", err})
4✔
1531
        return &ApiError{
4✔
1532
                Code:        e.Code,
4✔
1533
                ErrCode:     e.ErrCode,
4✔
1534
                Description: strings.NewReplacer(args...).Replace(e.Description),
4✔
1535
        }
4✔
1536
}
1537

1538
// NewJSConsumerInvalidSamplingError creates a new JSConsumerInvalidSamplingErrF error: "failed to parse consumer sampling configuration: {err}"
1539
func NewJSConsumerInvalidSamplingError(err error, opts ...ErrorOption) *ApiError {
×
1540
        eopts := parseOpts(opts)
×
1541
        if ae, ok := eopts.err.(*ApiError); ok {
×
1542
                return ae
×
1543
        }
×
1544

1545
        e := ApiErrors[JSConsumerInvalidSamplingErrF]
×
1546
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1547
        return &ApiError{
×
1548
                Code:        e.Code,
×
1549
                ErrCode:     e.ErrCode,
×
1550
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1551
        }
×
1552
}
1553

1554
// NewJSConsumerMaxDeliverBackoffError creates a new JSConsumerMaxDeliverBackoffErr error: "max deliver is required to be > length of backoff values"
1555
func NewJSConsumerMaxDeliverBackoffError(opts ...ErrorOption) *ApiError {
3✔
1556
        eopts := parseOpts(opts)
3✔
1557
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1558
                return ae
×
1559
        }
×
1560

1561
        return ApiErrors[JSConsumerMaxDeliverBackoffErr]
3✔
1562
}
1563

1564
// NewJSConsumerMaxPendingAckExcessError creates a new JSConsumerMaxPendingAckExcessErrF error: "consumer max ack pending exceeds system limit of {limit}"
1565
func NewJSConsumerMaxPendingAckExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
12✔
1566
        eopts := parseOpts(opts)
12✔
1567
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
1568
                return ae
×
1569
        }
×
1570

1571
        e := ApiErrors[JSConsumerMaxPendingAckExcessErrF]
12✔
1572
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
12✔
1573
        return &ApiError{
12✔
1574
                Code:        e.Code,
12✔
1575
                ErrCode:     e.ErrCode,
12✔
1576
                Description: strings.NewReplacer(args...).Replace(e.Description),
12✔
1577
        }
12✔
1578
}
1579

1580
// NewJSConsumerMaxPendingAckPolicyRequiredError creates a new JSConsumerMaxPendingAckPolicyRequiredErr error: "consumer requires ack policy for max ack pending"
1581
func NewJSConsumerMaxPendingAckPolicyRequiredError(opts ...ErrorOption) *ApiError {
2✔
1582
        eopts := parseOpts(opts)
2✔
1583
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1584
                return ae
×
1585
        }
×
1586

1587
        return ApiErrors[JSConsumerMaxPendingAckPolicyRequiredErr]
2✔
1588
}
1589

1590
// NewJSConsumerMaxRequestBatchExceededError creates a new JSConsumerMaxRequestBatchExceededF error: "consumer max request batch exceeds server limit of {limit}"
1591
func NewJSConsumerMaxRequestBatchExceededError(limit interface{}, opts ...ErrorOption) *ApiError {
4✔
1592
        eopts := parseOpts(opts)
4✔
1593
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1594
                return ae
×
1595
        }
×
1596

1597
        e := ApiErrors[JSConsumerMaxRequestBatchExceededF]
4✔
1598
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
4✔
1599
        return &ApiError{
4✔
1600
                Code:        e.Code,
4✔
1601
                ErrCode:     e.ErrCode,
4✔
1602
                Description: strings.NewReplacer(args...).Replace(e.Description),
4✔
1603
        }
4✔
1604
}
1605

1606
// NewJSConsumerMaxRequestBatchNegativeError creates a new JSConsumerMaxRequestBatchNegativeErr error: "consumer max request batch needs to be > 0"
1607
func NewJSConsumerMaxRequestBatchNegativeError(opts ...ErrorOption) *ApiError {
×
1608
        eopts := parseOpts(opts)
×
1609
        if ae, ok := eopts.err.(*ApiError); ok {
×
1610
                return ae
×
1611
        }
×
1612

1613
        return ApiErrors[JSConsumerMaxRequestBatchNegativeErr]
×
1614
}
1615

1616
// NewJSConsumerMaxRequestExpiresTooSmallError creates a new JSConsumerMaxRequestExpiresTooSmall error: "consumer max request expires needs to be >= 1ms"
1617
func NewJSConsumerMaxRequestExpiresTooSmallError(opts ...ErrorOption) *ApiError {
×
1618
        eopts := parseOpts(opts)
×
1619
        if ae, ok := eopts.err.(*ApiError); ok {
×
1620
                return ae
×
1621
        }
×
1622

1623
        return ApiErrors[JSConsumerMaxRequestExpiresTooSmall]
×
1624
}
1625

1626
// NewJSConsumerMaxWaitingNegativeError creates a new JSConsumerMaxWaitingNegativeErr error: "consumer max waiting needs to be positive"
1627
func NewJSConsumerMaxWaitingNegativeError(opts ...ErrorOption) *ApiError {
×
1628
        eopts := parseOpts(opts)
×
1629
        if ae, ok := eopts.err.(*ApiError); ok {
×
1630
                return ae
×
1631
        }
×
1632

1633
        return ApiErrors[JSConsumerMaxWaitingNegativeErr]
×
1634
}
1635

1636
// NewJSConsumerMetadataLengthError creates a new JSConsumerMetadataLengthErrF error: "consumer metadata exceeds maximum size of {limit}"
1637
func NewJSConsumerMetadataLengthError(limit interface{}, opts ...ErrorOption) *ApiError {
1✔
1638
        eopts := parseOpts(opts)
1✔
1639
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1640
                return ae
×
1641
        }
×
1642

1643
        e := ApiErrors[JSConsumerMetadataLengthErrF]
1✔
1644
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
1✔
1645
        return &ApiError{
1✔
1646
                Code:        e.Code,
1✔
1647
                ErrCode:     e.ErrCode,
1✔
1648
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1649
        }
1✔
1650
}
1651

1652
// NewJSConsumerMultipleFiltersNotAllowedError creates a new JSConsumerMultipleFiltersNotAllowed error: "consumer with multiple subject filters cannot use subject based API"
1653
func NewJSConsumerMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
1654
        eopts := parseOpts(opts)
1✔
1655
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1656
                return ae
×
1657
        }
×
1658

1659
        return ApiErrors[JSConsumerMultipleFiltersNotAllowed]
1✔
1660
}
1661

1662
// NewJSConsumerNameContainsPathSeparatorsError creates a new JSConsumerNameContainsPathSeparatorsErr error: "Consumer name can not contain path separators"
1663
func NewJSConsumerNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
8✔
1664
        eopts := parseOpts(opts)
8✔
1665
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1666
                return ae
×
1667
        }
×
1668

1669
        return ApiErrors[JSConsumerNameContainsPathSeparatorsErr]
8✔
1670
}
1671

1672
// NewJSConsumerNameExistError creates a new JSConsumerNameExistErr error: "consumer name already in use"
1673
func NewJSConsumerNameExistError(opts ...ErrorOption) *ApiError {
2✔
1674
        eopts := parseOpts(opts)
2✔
1675
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1676
                return ae
×
1677
        }
×
1678

1679
        return ApiErrors[JSConsumerNameExistErr]
2✔
1680
}
1681

1682
// NewJSConsumerNameTooLongError creates a new JSConsumerNameTooLongErrF error: "consumer name is too long, maximum allowed is {max}"
1683
func NewJSConsumerNameTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
×
1684
        eopts := parseOpts(opts)
×
1685
        if ae, ok := eopts.err.(*ApiError); ok {
×
1686
                return ae
×
1687
        }
×
1688

1689
        e := ApiErrors[JSConsumerNameTooLongErrF]
×
1690
        args := e.toReplacerArgs([]interface{}{"{max}", max})
×
1691
        return &ApiError{
×
1692
                Code:        e.Code,
×
1693
                ErrCode:     e.ErrCode,
×
1694
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1695
        }
×
1696
}
1697

1698
// NewJSConsumerNotFoundError creates a new JSConsumerNotFoundErr error: "consumer not found"
1699
func NewJSConsumerNotFoundError(opts ...ErrorOption) *ApiError {
2,874✔
1700
        eopts := parseOpts(opts)
2,874✔
1701
        if ae, ok := eopts.err.(*ApiError); ok {
2,874✔
1702
                return ae
×
1703
        }
×
1704

1705
        return ApiErrors[JSConsumerNotFoundErr]
2,874✔
1706
}
1707

1708
// NewJSConsumerOfflineError creates a new JSConsumerOfflineErr error: "consumer is offline"
1709
func NewJSConsumerOfflineError(opts ...ErrorOption) *ApiError {
6✔
1710
        eopts := parseOpts(opts)
6✔
1711
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1712
                return ae
×
1713
        }
×
1714

1715
        return ApiErrors[JSConsumerOfflineErr]
6✔
1716
}
1717

1718
// NewJSConsumerOfflineReasonError creates a new JSConsumerOfflineReasonErrF error: "consumer is offline: {err}"
1719
func NewJSConsumerOfflineReasonError(err error, opts ...ErrorOption) *ApiError {
24✔
1720
        eopts := parseOpts(opts)
24✔
1721
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
1722
                return ae
×
1723
        }
×
1724

1725
        e := ApiErrors[JSConsumerOfflineReasonErrF]
24✔
1726
        args := e.toReplacerArgs([]interface{}{"{err}", err})
24✔
1727
        return &ApiError{
24✔
1728
                Code:        e.Code,
24✔
1729
                ErrCode:     e.ErrCode,
24✔
1730
                Description: strings.NewReplacer(args...).Replace(e.Description),
24✔
1731
        }
24✔
1732
}
1733

1734
// NewJSConsumerOnMappedError creates a new JSConsumerOnMappedErr error: "consumer direct on a mapped consumer"
1735
func NewJSConsumerOnMappedError(opts ...ErrorOption) *ApiError {
×
1736
        eopts := parseOpts(opts)
×
1737
        if ae, ok := eopts.err.(*ApiError); ok {
×
1738
                return ae
×
1739
        }
×
1740

1741
        return ApiErrors[JSConsumerOnMappedErr]
×
1742
}
1743

1744
// NewJSConsumerOverlappingSubjectFiltersError creates a new JSConsumerOverlappingSubjectFilters error: "consumer subject filters cannot overlap"
1745
func NewJSConsumerOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
3✔
1746
        eopts := parseOpts(opts)
3✔
1747
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1748
                return ae
×
1749
        }
×
1750

1751
        return ApiErrors[JSConsumerOverlappingSubjectFilters]
3✔
1752
}
1753

1754
// NewJSConsumerPinnedTTLWithoutPriorityPolicyNoneError creates a new JSConsumerPinnedTTLWithoutPriorityPolicyNone error: "PinnedTTL cannot be set when PriorityPolicy is none"
1755
func NewJSConsumerPinnedTTLWithoutPriorityPolicyNoneError(opts ...ErrorOption) *ApiError {
1✔
1756
        eopts := parseOpts(opts)
1✔
1757
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1758
                return ae
×
1759
        }
×
1760

1761
        return ApiErrors[JSConsumerPinnedTTLWithoutPriorityPolicyNone]
1✔
1762
}
1763

1764
// NewJSConsumerPriorityGroupWithPolicyNoneError creates a new JSConsumerPriorityGroupWithPolicyNone error: "consumer can not have priority groups when policy is none"
1765
func NewJSConsumerPriorityGroupWithPolicyNoneError(opts ...ErrorOption) *ApiError {
1✔
1766
        eopts := parseOpts(opts)
1✔
1767
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1768
                return ae
×
1769
        }
×
1770

1771
        return ApiErrors[JSConsumerPriorityGroupWithPolicyNone]
1✔
1772
}
1773

1774
// NewJSConsumerPriorityPolicyWithoutGroupError creates a new JSConsumerPriorityPolicyWithoutGroup error: "Setting PriorityPolicy requires at least one PriorityGroup to be set"
1775
func NewJSConsumerPriorityPolicyWithoutGroupError(opts ...ErrorOption) *ApiError {
4✔
1776
        eopts := parseOpts(opts)
4✔
1777
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1778
                return ae
×
1779
        }
×
1780

1781
        return ApiErrors[JSConsumerPriorityPolicyWithoutGroup]
4✔
1782
}
1783

1784
// NewJSConsumerPullNotDurableError creates a new JSConsumerPullNotDurableErr error: "consumer in pull mode requires a durable name"
1785
func NewJSConsumerPullNotDurableError(opts ...ErrorOption) *ApiError {
×
1786
        eopts := parseOpts(opts)
×
1787
        if ae, ok := eopts.err.(*ApiError); ok {
×
1788
                return ae
×
1789
        }
×
1790

1791
        return ApiErrors[JSConsumerPullNotDurableErr]
×
1792
}
1793

1794
// NewJSConsumerPullRequiresAckError creates a new JSConsumerPullRequiresAckErr error: "consumer in pull mode requires explicit ack policy on workqueue stream"
1795
func NewJSConsumerPullRequiresAckError(opts ...ErrorOption) *ApiError {
6✔
1796
        eopts := parseOpts(opts)
6✔
1797
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1798
                return ae
×
1799
        }
×
1800

1801
        return ApiErrors[JSConsumerPullRequiresAckErr]
6✔
1802
}
1803

1804
// NewJSConsumerPullWithRateLimitError creates a new JSConsumerPullWithRateLimitErr error: "consumer in pull mode can not have rate limit set"
1805
func NewJSConsumerPullWithRateLimitError(opts ...ErrorOption) *ApiError {
1✔
1806
        eopts := parseOpts(opts)
1✔
1807
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1808
                return ae
×
1809
        }
×
1810

1811
        return ApiErrors[JSConsumerPullWithRateLimitErr]
1✔
1812
}
1813

1814
// NewJSConsumerPushMaxWaitingError creates a new JSConsumerPushMaxWaitingErr error: "consumer in push mode can not set max waiting"
1815
func NewJSConsumerPushMaxWaitingError(opts ...ErrorOption) *ApiError {
3✔
1816
        eopts := parseOpts(opts)
3✔
1817
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1818
                return ae
×
1819
        }
×
1820

1821
        return ApiErrors[JSConsumerPushMaxWaitingErr]
3✔
1822
}
1823

1824
// NewJSConsumerPushWithPriorityGroupError creates a new JSConsumerPushWithPriorityGroupErr error: "priority groups can not be used with push consumers"
1825
func NewJSConsumerPushWithPriorityGroupError(opts ...ErrorOption) *ApiError {
1✔
1826
        eopts := parseOpts(opts)
1✔
1827
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1828
                return ae
×
1829
        }
×
1830

1831
        return ApiErrors[JSConsumerPushWithPriorityGroupErr]
1✔
1832
}
1833

1834
// NewJSConsumerReplacementWithDifferentNameError creates a new JSConsumerReplacementWithDifferentNameErr error: "consumer replacement durable config not the same"
1835
func NewJSConsumerReplacementWithDifferentNameError(opts ...ErrorOption) *ApiError {
×
1836
        eopts := parseOpts(opts)
×
1837
        if ae, ok := eopts.err.(*ApiError); ok {
×
1838
                return ae
×
1839
        }
×
1840

1841
        return ApiErrors[JSConsumerReplacementWithDifferentNameErr]
×
1842
}
1843

1844
// NewJSConsumerReplayPolicyInvalidError creates a new JSConsumerReplayPolicyInvalidErr error: "consumer replay policy invalid"
1845
func NewJSConsumerReplayPolicyInvalidError(opts ...ErrorOption) *ApiError {
2✔
1846
        eopts := parseOpts(opts)
2✔
1847
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1848
                return ae
×
1849
        }
×
1850

1851
        return ApiErrors[JSConsumerReplayPolicyInvalidErr]
2✔
1852
}
1853

1854
// NewJSConsumerReplicasExceedsStreamError creates a new JSConsumerReplicasExceedsStream error: "consumer config replica count exceeds parent stream"
1855
func NewJSConsumerReplicasExceedsStreamError(opts ...ErrorOption) *ApiError {
1✔
1856
        eopts := parseOpts(opts)
1✔
1857
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1858
                return ae
×
1859
        }
×
1860

1861
        return ApiErrors[JSConsumerReplicasExceedsStream]
1✔
1862
}
1863

1864
// NewJSConsumerReplicasShouldMatchStreamError creates a new JSConsumerReplicasShouldMatchStream error: "consumer config replicas must match interest retention stream's replicas"
1865
func NewJSConsumerReplicasShouldMatchStreamError(opts ...ErrorOption) *ApiError {
2✔
1866
        eopts := parseOpts(opts)
2✔
1867
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1868
                return ae
×
1869
        }
×
1870

1871
        return ApiErrors[JSConsumerReplicasShouldMatchStream]
2✔
1872
}
1873

1874
// NewJSConsumerSmallHeartbeatError creates a new JSConsumerSmallHeartbeatErr error: "consumer idle heartbeat needs to be >= 100ms"
1875
func NewJSConsumerSmallHeartbeatError(opts ...ErrorOption) *ApiError {
1✔
1876
        eopts := parseOpts(opts)
1✔
1877
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1878
                return ae
×
1879
        }
×
1880

1881
        return ApiErrors[JSConsumerSmallHeartbeatErr]
1✔
1882
}
1883

1884
// NewJSConsumerStoreFailedError creates a new JSConsumerStoreFailedErrF error: "error creating store for consumer: {err}"
1885
func NewJSConsumerStoreFailedError(err error, opts ...ErrorOption) *ApiError {
9✔
1886
        eopts := parseOpts(opts)
9✔
1887
        if ae, ok := eopts.err.(*ApiError); ok {
9✔
1888
                return ae
×
1889
        }
×
1890

1891
        e := ApiErrors[JSConsumerStoreFailedErrF]
9✔
1892
        args := e.toReplacerArgs([]interface{}{"{err}", err})
9✔
1893
        return &ApiError{
9✔
1894
                Code:        e.Code,
9✔
1895
                ErrCode:     e.ErrCode,
9✔
1896
                Description: strings.NewReplacer(args...).Replace(e.Description),
9✔
1897
        }
9✔
1898
}
1899

1900
// NewJSConsumerWQConsumerNotDeliverAllError creates a new JSConsumerWQConsumerNotDeliverAllErr error: "consumer must be deliver all on workqueue stream"
1901
func NewJSConsumerWQConsumerNotDeliverAllError(opts ...ErrorOption) *ApiError {
×
1902
        eopts := parseOpts(opts)
×
1903
        if ae, ok := eopts.err.(*ApiError); ok {
×
1904
                return ae
×
1905
        }
×
1906

1907
        return ApiErrors[JSConsumerWQConsumerNotDeliverAllErr]
×
1908
}
1909

1910
// NewJSConsumerWQConsumerNotUniqueError creates a new JSConsumerWQConsumerNotUniqueErr error: "filtered consumer not unique on workqueue stream"
1911
func NewJSConsumerWQConsumerNotUniqueError(opts ...ErrorOption) *ApiError {
11✔
1912
        eopts := parseOpts(opts)
11✔
1913
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
1914
                return ae
×
1915
        }
×
1916

1917
        return ApiErrors[JSConsumerWQConsumerNotUniqueErr]
11✔
1918
}
1919

1920
// NewJSConsumerWQMultipleUnfilteredError creates a new JSConsumerWQMultipleUnfilteredErr error: "multiple non-filtered consumers not allowed on workqueue stream"
1921
func NewJSConsumerWQMultipleUnfilteredError(opts ...ErrorOption) *ApiError {
2✔
1922
        eopts := parseOpts(opts)
2✔
1923
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1924
                return ae
×
1925
        }
×
1926

1927
        return ApiErrors[JSConsumerWQMultipleUnfilteredErr]
2✔
1928
}
1929

1930
// NewJSConsumerWQRequiresExplicitAckError creates a new JSConsumerWQRequiresExplicitAckErr error: "workqueue stream requires explicit ack"
1931
func NewJSConsumerWQRequiresExplicitAckError(opts ...ErrorOption) *ApiError {
×
1932
        eopts := parseOpts(opts)
×
1933
        if ae, ok := eopts.err.(*ApiError); ok {
×
1934
                return ae
×
1935
        }
×
1936

1937
        return ApiErrors[JSConsumerWQRequiresExplicitAckErr]
×
1938
}
1939

1940
// NewJSConsumerWithFlowControlNeedsHeartbeatsError creates a new JSConsumerWithFlowControlNeedsHeartbeats error: "consumer with flow control also needs heartbeats"
1941
func NewJSConsumerWithFlowControlNeedsHeartbeatsError(opts ...ErrorOption) *ApiError {
4✔
1942
        eopts := parseOpts(opts)
4✔
1943
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1944
                return ae
×
1945
        }
×
1946

1947
        return ApiErrors[JSConsumerWithFlowControlNeedsHeartbeats]
4✔
1948
}
1949

1950
// NewJSInsufficientResourcesError creates a new JSInsufficientResourcesErr error: "insufficient resources"
1951
func NewJSInsufficientResourcesError(opts ...ErrorOption) *ApiError {
9✔
1952
        eopts := parseOpts(opts)
9✔
1953
        if ae, ok := eopts.err.(*ApiError); ok {
9✔
1954
                return ae
×
1955
        }
×
1956

1957
        return ApiErrors[JSInsufficientResourcesErr]
9✔
1958
}
1959

1960
// NewJSInvalidJSONError creates a new JSInvalidJSONErr error: "invalid JSON: {err}"
1961
func NewJSInvalidJSONError(err error, opts ...ErrorOption) *ApiError {
8✔
1962
        eopts := parseOpts(opts)
8✔
1963
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1964
                return ae
×
1965
        }
×
1966

1967
        e := ApiErrors[JSInvalidJSONErr]
8✔
1968
        args := e.toReplacerArgs([]interface{}{"{err}", err})
8✔
1969
        return &ApiError{
8✔
1970
                Code:        e.Code,
8✔
1971
                ErrCode:     e.ErrCode,
8✔
1972
                Description: strings.NewReplacer(args...).Replace(e.Description),
8✔
1973
        }
8✔
1974
}
1975

1976
// NewJSMaximumConsumersLimitError creates a new JSMaximumConsumersLimitErr error: "maximum consumers limit reached"
1977
func NewJSMaximumConsumersLimitError(opts ...ErrorOption) *ApiError {
43✔
1978
        eopts := parseOpts(opts)
43✔
1979
        if ae, ok := eopts.err.(*ApiError); ok {
43✔
1980
                return ae
×
1981
        }
×
1982

1983
        return ApiErrors[JSMaximumConsumersLimitErr]
43✔
1984
}
1985

1986
// NewJSMaximumStreamsLimitError creates a new JSMaximumStreamsLimitErr error: "maximum number of streams reached"
1987
func NewJSMaximumStreamsLimitError(opts ...ErrorOption) *ApiError {
16✔
1988
        eopts := parseOpts(opts)
16✔
1989
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
1990
                return ae
×
1991
        }
×
1992

1993
        return ApiErrors[JSMaximumStreamsLimitErr]
16✔
1994
}
1995

1996
// NewJSMemoryResourcesExceededError creates a new JSMemoryResourcesExceededErr error: "insufficient memory resources available"
1997
func NewJSMemoryResourcesExceededError(opts ...ErrorOption) *ApiError {
11✔
1998
        eopts := parseOpts(opts)
11✔
1999
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
2000
                return ae
×
2001
        }
×
2002

2003
        return ApiErrors[JSMemoryResourcesExceededErr]
11✔
2004
}
2005

2006
// NewJSMessageCounterBrokenError creates a new JSMessageCounterBrokenErr error: "message counter is broken"
2007
func NewJSMessageCounterBrokenError(opts ...ErrorOption) *ApiError {
4✔
2008
        eopts := parseOpts(opts)
4✔
2009
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2010
                return ae
×
2011
        }
×
2012

2013
        return ApiErrors[JSMessageCounterBrokenErr]
4✔
2014
}
2015

2016
// NewJSMessageIncrDisabledError creates a new JSMessageIncrDisabledErr error: "message counters is disabled"
2017
func NewJSMessageIncrDisabledError(opts ...ErrorOption) *ApiError {
4✔
2018
        eopts := parseOpts(opts)
4✔
2019
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2020
                return ae
×
2021
        }
×
2022

2023
        return ApiErrors[JSMessageIncrDisabledErr]
4✔
2024
}
2025

2026
// NewJSMessageIncrInvalidError creates a new JSMessageIncrInvalidErr error: "message counter increment is invalid"
2027
func NewJSMessageIncrInvalidError(opts ...ErrorOption) *ApiError {
24✔
2028
        eopts := parseOpts(opts)
24✔
2029
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
2030
                return ae
×
2031
        }
×
2032

2033
        return ApiErrors[JSMessageIncrInvalidErr]
24✔
2034
}
2035

2036
// NewJSMessageIncrMissingError creates a new JSMessageIncrMissingErr error: "message counter increment is missing"
2037
func NewJSMessageIncrMissingError(opts ...ErrorOption) *ApiError {
8✔
2038
        eopts := parseOpts(opts)
8✔
2039
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
2040
                return ae
×
2041
        }
×
2042

2043
        return ApiErrors[JSMessageIncrMissingErr]
8✔
2044
}
2045

2046
// NewJSMessageIncrPayloadError creates a new JSMessageIncrPayloadErr error: "message counter has payload"
2047
func NewJSMessageIncrPayloadError(opts ...ErrorOption) *ApiError {
4✔
2048
        eopts := parseOpts(opts)
4✔
2049
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2050
                return ae
×
2051
        }
×
2052

2053
        return ApiErrors[JSMessageIncrPayloadErr]
4✔
2054
}
2055

2056
// NewJSMessageSchedulesDisabledError creates a new JSMessageSchedulesDisabledErr error: "message schedules is disabled"
2057
func NewJSMessageSchedulesDisabledError(opts ...ErrorOption) *ApiError {
20✔
2058
        eopts := parseOpts(opts)
20✔
2059
        if ae, ok := eopts.err.(*ApiError); ok {
20✔
2060
                return ae
×
2061
        }
×
2062

2063
        return ApiErrors[JSMessageSchedulesDisabledErr]
20✔
2064
}
2065

2066
// NewJSMessageSchedulesPatternInvalidError creates a new JSMessageSchedulesPatternInvalidErr error: "message schedules pattern is invalid"
2067
func NewJSMessageSchedulesPatternInvalidError(opts ...ErrorOption) *ApiError {
15✔
2068
        eopts := parseOpts(opts)
15✔
2069
        if ae, ok := eopts.err.(*ApiError); ok {
15✔
2070
                return ae
×
2071
        }
×
2072

2073
        return ApiErrors[JSMessageSchedulesPatternInvalidErr]
15✔
2074
}
2075

2076
// NewJSMessageSchedulesRollupInvalidError creates a new JSMessageSchedulesRollupInvalidErr error: "message schedules invalid rollup"
2077
func NewJSMessageSchedulesRollupInvalidError(opts ...ErrorOption) *ApiError {
18✔
2078
        eopts := parseOpts(opts)
18✔
2079
        if ae, ok := eopts.err.(*ApiError); ok {
18✔
2080
                return ae
×
2081
        }
×
2082

2083
        return ApiErrors[JSMessageSchedulesRollupInvalidErr]
18✔
2084
}
2085

2086
// NewJSMessageSchedulesSchedulerInvalidError creates a new JSMessageSchedulesSchedulerInvalidErr error: "message schedules invalid scheduler"
2087
func NewJSMessageSchedulesSchedulerInvalidError(opts ...ErrorOption) *ApiError {
12✔
2088
        eopts := parseOpts(opts)
12✔
2089
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
2090
                return ae
×
2091
        }
×
2092

2093
        return ApiErrors[JSMessageSchedulesSchedulerInvalidErr]
12✔
2094
}
2095

2096
// NewJSMessageSchedulesSourceInvalidError creates a new JSMessageSchedulesSourceInvalidErr error: "message schedules source is invalid"
2097
func NewJSMessageSchedulesSourceInvalidError(opts ...ErrorOption) *ApiError {
32✔
2098
        eopts := parseOpts(opts)
32✔
2099
        if ae, ok := eopts.err.(*ApiError); ok {
32✔
2100
                return ae
×
2101
        }
×
2102

2103
        return ApiErrors[JSMessageSchedulesSourceInvalidErr]
32✔
2104
}
2105

2106
// NewJSMessageSchedulesTTLInvalidError creates a new JSMessageSchedulesTTLInvalidErr error: "message schedules invalid per-message TTL"
2107
func NewJSMessageSchedulesTTLInvalidError(opts ...ErrorOption) *ApiError {
10✔
2108
        eopts := parseOpts(opts)
10✔
2109
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2110
                return ae
×
2111
        }
×
2112

2113
        return ApiErrors[JSMessageSchedulesTTLInvalidErr]
10✔
2114
}
2115

2116
// NewJSMessageSchedulesTargetInvalidError creates a new JSMessageSchedulesTargetInvalidErr error: "message schedules target is invalid"
2117
func NewJSMessageSchedulesTargetInvalidError(opts ...ErrorOption) *ApiError {
30✔
2118
        eopts := parseOpts(opts)
30✔
2119
        if ae, ok := eopts.err.(*ApiError); ok {
30✔
2120
                return ae
×
2121
        }
×
2122

2123
        return ApiErrors[JSMessageSchedulesTargetInvalidErr]
30✔
2124
}
2125

2126
// NewJSMessageTTLDisabledError creates a new JSMessageTTLDisabledErr error: "per-message TTL is disabled"
2127
func NewJSMessageTTLDisabledError(opts ...ErrorOption) *ApiError {
16✔
2128
        eopts := parseOpts(opts)
16✔
2129
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2130
                return ae
×
2131
        }
×
2132

2133
        return ApiErrors[JSMessageTTLDisabledErr]
16✔
2134
}
2135

2136
// NewJSMessageTTLInvalidError creates a new JSMessageTTLInvalidErr error: "invalid per-message TTL"
2137
func NewJSMessageTTLInvalidError(opts ...ErrorOption) *ApiError {
23✔
2138
        eopts := parseOpts(opts)
23✔
2139
        if ae, ok := eopts.err.(*ApiError); ok {
23✔
2140
                return ae
×
2141
        }
×
2142

2143
        return ApiErrors[JSMessageTTLInvalidErr]
23✔
2144
}
2145

2146
// NewJSMirrorConsumerSetupFailedError creates a new JSMirrorConsumerSetupFailedErrF error: "{err}"
2147
func NewJSMirrorConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
2148
        eopts := parseOpts(opts)
×
2149
        if ae, ok := eopts.err.(*ApiError); ok {
×
2150
                return ae
×
2151
        }
×
2152

2153
        e := ApiErrors[JSMirrorConsumerSetupFailedErrF]
×
2154
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2155
        return &ApiError{
×
2156
                Code:        e.Code,
×
2157
                ErrCode:     e.ErrCode,
×
2158
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2159
        }
×
2160
}
2161

2162
// NewJSMirrorInvalidStreamNameError creates a new JSMirrorInvalidStreamName error: "mirrored stream name is invalid"
2163
func NewJSMirrorInvalidStreamNameError(opts ...ErrorOption) *ApiError {
×
2164
        eopts := parseOpts(opts)
×
2165
        if ae, ok := eopts.err.(*ApiError); ok {
×
2166
                return ae
×
2167
        }
×
2168

2169
        return ApiErrors[JSMirrorInvalidStreamName]
×
2170
}
2171

2172
// NewJSMirrorInvalidSubjectFilterError creates a new JSMirrorInvalidSubjectFilter error: "mirror transform source: {err}"
2173
func NewJSMirrorInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
2✔
2174
        eopts := parseOpts(opts)
2✔
2175
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2176
                return ae
×
2177
        }
×
2178

2179
        e := ApiErrors[JSMirrorInvalidSubjectFilter]
2✔
2180
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2✔
2181
        return &ApiError{
2✔
2182
                Code:        e.Code,
2✔
2183
                ErrCode:     e.ErrCode,
2✔
2184
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2185
        }
2✔
2186
}
2187

2188
// NewJSMirrorInvalidTransformDestinationError creates a new JSMirrorInvalidTransformDestination error: "mirror transform: {err}"
2189
func NewJSMirrorInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
2✔
2190
        eopts := parseOpts(opts)
2✔
2191
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2192
                return ae
×
2193
        }
×
2194

2195
        e := ApiErrors[JSMirrorInvalidTransformDestination]
2✔
2196
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2✔
2197
        return &ApiError{
2✔
2198
                Code:        e.Code,
2✔
2199
                ErrCode:     e.ErrCode,
2✔
2200
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2201
        }
2✔
2202
}
2203

2204
// NewJSMirrorMaxMessageSizeTooBigError creates a new JSMirrorMaxMessageSizeTooBigErr error: "stream mirror must have max message size >= source"
2205
func NewJSMirrorMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
2206
        eopts := parseOpts(opts)
×
2207
        if ae, ok := eopts.err.(*ApiError); ok {
×
2208
                return ae
×
2209
        }
×
2210

2211
        return ApiErrors[JSMirrorMaxMessageSizeTooBigErr]
×
2212
}
2213

2214
// NewJSMirrorMultipleFiltersNotAllowedError creates a new JSMirrorMultipleFiltersNotAllowed error: "mirror with multiple subject transforms cannot also have a single subject filter"
2215
func NewJSMirrorMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
2216
        eopts := parseOpts(opts)
1✔
2217
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2218
                return ae
×
2219
        }
×
2220

2221
        return ApiErrors[JSMirrorMultipleFiltersNotAllowed]
1✔
2222
}
2223

2224
// NewJSMirrorOverlappingSubjectFiltersError creates a new JSMirrorOverlappingSubjectFilters error: "mirror subject filters can not overlap"
2225
func NewJSMirrorOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
2✔
2226
        eopts := parseOpts(opts)
2✔
2227
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2228
                return ae
×
2229
        }
×
2230

2231
        return ApiErrors[JSMirrorOverlappingSubjectFilters]
2✔
2232
}
2233

2234
// NewJSMirrorWithAtomicPublishError creates a new JSMirrorWithAtomicPublishErr error: "stream mirrors can not also use atomic publishing"
2235
func NewJSMirrorWithAtomicPublishError(opts ...ErrorOption) *ApiError {
4✔
2236
        eopts := parseOpts(opts)
4✔
2237
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2238
                return ae
×
2239
        }
×
2240

2241
        return ApiErrors[JSMirrorWithAtomicPublishErr]
4✔
2242
}
2243

2244
// NewJSMirrorWithBatchPublishError creates a new JSMirrorWithBatchPublishErr error: "stream mirrors can not also use batch publishing"
2245
func NewJSMirrorWithBatchPublishError(opts ...ErrorOption) *ApiError {
4✔
2246
        eopts := parseOpts(opts)
4✔
2247
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2248
                return ae
×
2249
        }
×
2250

2251
        return ApiErrors[JSMirrorWithBatchPublishErr]
4✔
2252
}
2253

2254
// NewJSMirrorWithCountersError creates a new JSMirrorWithCountersErr error: "stream mirrors can not also calculate counters"
2255
func NewJSMirrorWithCountersError(opts ...ErrorOption) *ApiError {
4✔
2256
        eopts := parseOpts(opts)
4✔
2257
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2258
                return ae
×
2259
        }
×
2260

2261
        return ApiErrors[JSMirrorWithCountersErr]
4✔
2262
}
2263

2264
// NewJSMirrorWithFirstSeqError creates a new JSMirrorWithFirstSeqErr error: "stream mirrors can not have first sequence configured"
2265
func NewJSMirrorWithFirstSeqError(opts ...ErrorOption) *ApiError {
2✔
2266
        eopts := parseOpts(opts)
2✔
2267
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2268
                return ae
×
2269
        }
×
2270

2271
        return ApiErrors[JSMirrorWithFirstSeqErr]
2✔
2272
}
2273

2274
// NewJSMirrorWithMsgSchedulesError creates a new JSMirrorWithMsgSchedulesErr error: "stream mirrors can not also schedule messages"
2275
func NewJSMirrorWithMsgSchedulesError(opts ...ErrorOption) *ApiError {
2✔
2276
        eopts := parseOpts(opts)
2✔
2277
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2278
                return ae
×
2279
        }
×
2280

2281
        return ApiErrors[JSMirrorWithMsgSchedulesErr]
2✔
2282
}
2283

2284
// NewJSMirrorWithSourcesError creates a new JSMirrorWithSourcesErr error: "stream mirrors can not also contain other sources"
2285
func NewJSMirrorWithSourcesError(opts ...ErrorOption) *ApiError {
×
2286
        eopts := parseOpts(opts)
×
2287
        if ae, ok := eopts.err.(*ApiError); ok {
×
2288
                return ae
×
2289
        }
×
2290

2291
        return ApiErrors[JSMirrorWithSourcesErr]
×
2292
}
2293

2294
// NewJSMirrorWithStartSeqAndTimeError creates a new JSMirrorWithStartSeqAndTimeErr error: "stream mirrors can not have both start seq and start time configured"
2295
func NewJSMirrorWithStartSeqAndTimeError(opts ...ErrorOption) *ApiError {
×
2296
        eopts := parseOpts(opts)
×
2297
        if ae, ok := eopts.err.(*ApiError); ok {
×
2298
                return ae
×
2299
        }
×
2300

2301
        return ApiErrors[JSMirrorWithStartSeqAndTimeErr]
×
2302
}
2303

2304
// NewJSMirrorWithSubjectFiltersError creates a new JSMirrorWithSubjectFiltersErr error: "stream mirrors can not contain filtered subjects"
2305
func NewJSMirrorWithSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
2306
        eopts := parseOpts(opts)
×
2307
        if ae, ok := eopts.err.(*ApiError); ok {
×
2308
                return ae
×
2309
        }
×
2310

2311
        return ApiErrors[JSMirrorWithSubjectFiltersErr]
×
2312
}
2313

2314
// NewJSMirrorWithSubjectsError creates a new JSMirrorWithSubjectsErr error: "stream mirrors can not contain subjects"
2315
func NewJSMirrorWithSubjectsError(opts ...ErrorOption) *ApiError {
2✔
2316
        eopts := parseOpts(opts)
2✔
2317
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2318
                return ae
×
2319
        }
×
2320

2321
        return ApiErrors[JSMirrorWithSubjectsErr]
2✔
2322
}
2323

2324
// NewJSNoAccountError creates a new JSNoAccountErr error: "account not found"
2325
func NewJSNoAccountError(opts ...ErrorOption) *ApiError {
1✔
2326
        eopts := parseOpts(opts)
1✔
2327
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2328
                return ae
×
2329
        }
×
2330

2331
        return ApiErrors[JSNoAccountErr]
1✔
2332
}
2333

2334
// NewJSNoLimitsError creates a new JSNoLimitsErr error: "no JetStream default or applicable tiered limit present"
2335
func NewJSNoLimitsError(opts ...ErrorOption) *ApiError {
4✔
2336
        eopts := parseOpts(opts)
4✔
2337
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2338
                return ae
×
2339
        }
×
2340

2341
        return ApiErrors[JSNoLimitsErr]
4✔
2342
}
2343

2344
// NewJSNoMessageFoundError creates a new JSNoMessageFoundErr error: "no message found"
2345
func NewJSNoMessageFoundError(opts ...ErrorOption) *ApiError {
862✔
2346
        eopts := parseOpts(opts)
862✔
2347
        if ae, ok := eopts.err.(*ApiError); ok {
862✔
2348
                return ae
×
2349
        }
×
2350

2351
        return ApiErrors[JSNoMessageFoundErr]
862✔
2352
}
2353

2354
// NewJSNotEmptyRequestError creates a new JSNotEmptyRequestErr error: "expected an empty request payload"
2355
func NewJSNotEmptyRequestError(opts ...ErrorOption) *ApiError {
3✔
2356
        eopts := parseOpts(opts)
3✔
2357
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2358
                return ae
×
2359
        }
×
2360

2361
        return ApiErrors[JSNotEmptyRequestErr]
3✔
2362
}
2363

2364
// NewJSNotEnabledError creates a new JSNotEnabledErr error: "JetStream not enabled"
2365
func NewJSNotEnabledError(opts ...ErrorOption) *ApiError {
11✔
2366
        eopts := parseOpts(opts)
11✔
2367
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
2368
                return ae
×
2369
        }
×
2370

2371
        return ApiErrors[JSNotEnabledErr]
11✔
2372
}
2373

2374
// NewJSNotEnabledForAccountError creates a new JSNotEnabledForAccountErr error: "JetStream not enabled for account"
2375
func NewJSNotEnabledForAccountError(opts ...ErrorOption) *ApiError {
302✔
2376
        eopts := parseOpts(opts)
302✔
2377
        if ae, ok := eopts.err.(*ApiError); ok {
302✔
2378
                return ae
×
2379
        }
×
2380

2381
        return ApiErrors[JSNotEnabledForAccountErr]
302✔
2382
}
2383

2384
// NewJSPedanticError creates a new JSPedanticErrF error: "pedantic mode: {err}"
2385
func NewJSPedanticError(err error, opts ...ErrorOption) *ApiError {
36✔
2386
        eopts := parseOpts(opts)
36✔
2387
        if ae, ok := eopts.err.(*ApiError); ok {
36✔
2388
                return ae
×
2389
        }
×
2390

2391
        e := ApiErrors[JSPedanticErrF]
36✔
2392
        args := e.toReplacerArgs([]interface{}{"{err}", err})
36✔
2393
        return &ApiError{
36✔
2394
                Code:        e.Code,
36✔
2395
                ErrCode:     e.ErrCode,
36✔
2396
                Description: strings.NewReplacer(args...).Replace(e.Description),
36✔
2397
        }
36✔
2398
}
2399

2400
// NewJSPeerRemapError creates a new JSPeerRemapErr error: "peer remap failed"
2401
func NewJSPeerRemapError(opts ...ErrorOption) *ApiError {
5✔
2402
        eopts := parseOpts(opts)
5✔
2403
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2404
                return ae
1✔
2405
        }
1✔
2406

2407
        return ApiErrors[JSPeerRemapErr]
4✔
2408
}
2409

2410
// NewJSRaftGeneralError creates a new JSRaftGeneralErrF error: "{err}"
2411
func NewJSRaftGeneralError(err error, opts ...ErrorOption) *ApiError {
×
2412
        eopts := parseOpts(opts)
×
2413
        if ae, ok := eopts.err.(*ApiError); ok {
×
2414
                return ae
×
2415
        }
×
2416

2417
        e := ApiErrors[JSRaftGeneralErrF]
×
2418
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2419
        return &ApiError{
×
2420
                Code:        e.Code,
×
2421
                ErrCode:     e.ErrCode,
×
2422
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2423
        }
×
2424
}
2425

2426
// NewJSReplicasCountCannotBeNegativeError creates a new JSReplicasCountCannotBeNegative error: "replicas count cannot be negative"
2427
func NewJSReplicasCountCannotBeNegativeError(opts ...ErrorOption) *ApiError {
16✔
2428
        eopts := parseOpts(opts)
16✔
2429
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2430
                return ae
×
2431
        }
×
2432

2433
        return ApiErrors[JSReplicasCountCannotBeNegative]
16✔
2434
}
2435

2436
// NewJSRequiredApiLevelError creates a new JSRequiredApiLevelErr error: "JetStream minimum api level required"
2437
func NewJSRequiredApiLevelError(opts ...ErrorOption) *ApiError {
44✔
2438
        eopts := parseOpts(opts)
44✔
2439
        if ae, ok := eopts.err.(*ApiError); ok {
44✔
2440
                return ae
×
2441
        }
×
2442

2443
        return ApiErrors[JSRequiredApiLevelErr]
44✔
2444
}
2445

2446
// NewJSRestoreSubscribeFailedError creates a new JSRestoreSubscribeFailedErrF error: "JetStream unable to subscribe to restore snapshot {subject}: {err}"
2447
func NewJSRestoreSubscribeFailedError(err error, subject interface{}, opts ...ErrorOption) *ApiError {
1✔
2448
        eopts := parseOpts(opts)
1✔
2449
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2450
                return ae
×
2451
        }
×
2452

2453
        e := ApiErrors[JSRestoreSubscribeFailedErrF]
1✔
2454
        args := e.toReplacerArgs([]interface{}{"{err}", err, "{subject}", subject})
1✔
2455
        return &ApiError{
1✔
2456
                Code:        e.Code,
1✔
2457
                ErrCode:     e.ErrCode,
1✔
2458
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2459
        }
1✔
2460
}
2461

2462
// NewJSSequenceNotFoundError creates a new JSSequenceNotFoundErrF error: "sequence {seq} not found"
2463
func NewJSSequenceNotFoundError(seq uint64, opts ...ErrorOption) *ApiError {
1,531✔
2464
        eopts := parseOpts(opts)
1,531✔
2465
        if ae, ok := eopts.err.(*ApiError); ok {
1,531✔
2466
                return ae
×
2467
        }
×
2468

2469
        e := ApiErrors[JSSequenceNotFoundErrF]
1,531✔
2470
        args := e.toReplacerArgs([]interface{}{"{seq}", seq})
1,531✔
2471
        return &ApiError{
1,531✔
2472
                Code:        e.Code,
1,531✔
2473
                ErrCode:     e.ErrCode,
1,531✔
2474
                Description: strings.NewReplacer(args...).Replace(e.Description),
1,531✔
2475
        }
1,531✔
2476
}
2477

2478
// NewJSSnapshotDeliverSubjectInvalidError creates a new JSSnapshotDeliverSubjectInvalidErr error: "deliver subject not valid"
2479
func NewJSSnapshotDeliverSubjectInvalidError(opts ...ErrorOption) *ApiError {
1✔
2480
        eopts := parseOpts(opts)
1✔
2481
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2482
                return ae
×
2483
        }
×
2484

2485
        return ApiErrors[JSSnapshotDeliverSubjectInvalidErr]
1✔
2486
}
2487

2488
// NewJSSourceConsumerSetupFailedError creates a new JSSourceConsumerSetupFailedErrF error: "{err}"
2489
func NewJSSourceConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
2490
        eopts := parseOpts(opts)
×
2491
        if ae, ok := eopts.err.(*ApiError); ok {
×
2492
                return ae
×
2493
        }
×
2494

2495
        e := ApiErrors[JSSourceConsumerSetupFailedErrF]
×
2496
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2497
        return &ApiError{
×
2498
                Code:        e.Code,
×
2499
                ErrCode:     e.ErrCode,
×
2500
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2501
        }
×
2502
}
2503

2504
// NewJSSourceDuplicateDetectedError creates a new JSSourceDuplicateDetected error: "duplicate source configuration detected"
2505
func NewJSSourceDuplicateDetectedError(opts ...ErrorOption) *ApiError {
×
2506
        eopts := parseOpts(opts)
×
2507
        if ae, ok := eopts.err.(*ApiError); ok {
×
2508
                return ae
×
2509
        }
×
2510

2511
        return ApiErrors[JSSourceDuplicateDetected]
×
2512
}
2513

2514
// NewJSSourceInvalidStreamNameError creates a new JSSourceInvalidStreamName error: "sourced stream name is invalid"
2515
func NewJSSourceInvalidStreamNameError(opts ...ErrorOption) *ApiError {
2✔
2516
        eopts := parseOpts(opts)
2✔
2517
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2518
                return ae
×
2519
        }
×
2520

2521
        return ApiErrors[JSSourceInvalidStreamName]
2✔
2522
}
2523

2524
// NewJSSourceInvalidSubjectFilterError creates a new JSSourceInvalidSubjectFilter error: "source transform source: {err}"
2525
func NewJSSourceInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
5✔
2526
        eopts := parseOpts(opts)
5✔
2527
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2528
                return ae
×
2529
        }
×
2530

2531
        e := ApiErrors[JSSourceInvalidSubjectFilter]
5✔
2532
        args := e.toReplacerArgs([]interface{}{"{err}", err})
5✔
2533
        return &ApiError{
5✔
2534
                Code:        e.Code,
5✔
2535
                ErrCode:     e.ErrCode,
5✔
2536
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
2537
        }
5✔
2538
}
2539

2540
// NewJSSourceInvalidTransformDestinationError creates a new JSSourceInvalidTransformDestination error: "source transform: {err}"
2541
func NewJSSourceInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
5✔
2542
        eopts := parseOpts(opts)
5✔
2543
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2544
                return ae
×
2545
        }
×
2546

2547
        e := ApiErrors[JSSourceInvalidTransformDestination]
5✔
2548
        args := e.toReplacerArgs([]interface{}{"{err}", err})
5✔
2549
        return &ApiError{
5✔
2550
                Code:        e.Code,
5✔
2551
                ErrCode:     e.ErrCode,
5✔
2552
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
2553
        }
5✔
2554
}
2555

2556
// NewJSSourceMaxMessageSizeTooBigError creates a new JSSourceMaxMessageSizeTooBigErr error: "stream source must have max message size >= target"
2557
func NewJSSourceMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
2558
        eopts := parseOpts(opts)
×
2559
        if ae, ok := eopts.err.(*ApiError); ok {
×
2560
                return ae
×
2561
        }
×
2562

2563
        return ApiErrors[JSSourceMaxMessageSizeTooBigErr]
×
2564
}
2565

2566
// NewJSSourceMultipleFiltersNotAllowedError creates a new JSSourceMultipleFiltersNotAllowed error: "source with multiple subject transforms cannot also have a single subject filter"
2567
func NewJSSourceMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
4✔
2568
        eopts := parseOpts(opts)
4✔
2569
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2570
                return ae
×
2571
        }
×
2572

2573
        return ApiErrors[JSSourceMultipleFiltersNotAllowed]
4✔
2574
}
2575

2576
// NewJSSourceOverlappingSubjectFiltersError creates a new JSSourceOverlappingSubjectFilters error: "source filters can not overlap"
2577
func NewJSSourceOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
4✔
2578
        eopts := parseOpts(opts)
4✔
2579
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2580
                return ae
×
2581
        }
×
2582

2583
        return ApiErrors[JSSourceOverlappingSubjectFilters]
4✔
2584
}
2585

2586
// NewJSSourceWithMsgSchedulesError creates a new JSSourceWithMsgSchedulesErr error: "stream source can not also schedule messages"
2587
func NewJSSourceWithMsgSchedulesError(opts ...ErrorOption) *ApiError {
2✔
2588
        eopts := parseOpts(opts)
2✔
2589
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2590
                return ae
×
2591
        }
×
2592

2593
        return ApiErrors[JSSourceWithMsgSchedulesErr]
2✔
2594
}
2595

2596
// NewJSStorageResourcesExceededError creates a new JSStorageResourcesExceededErr error: "insufficient storage resources available"
2597
func NewJSStorageResourcesExceededError(opts ...ErrorOption) *ApiError {
37✔
2598
        eopts := parseOpts(opts)
37✔
2599
        if ae, ok := eopts.err.(*ApiError); ok {
37✔
2600
                return ae
×
2601
        }
×
2602

2603
        return ApiErrors[JSStorageResourcesExceededErr]
37✔
2604
}
2605

2606
// NewJSStreamAssignmentError creates a new JSStreamAssignmentErrF error: "{err}"
2607
func NewJSStreamAssignmentError(err error, opts ...ErrorOption) *ApiError {
×
2608
        eopts := parseOpts(opts)
×
2609
        if ae, ok := eopts.err.(*ApiError); ok {
×
2610
                return ae
×
2611
        }
×
2612

2613
        e := ApiErrors[JSStreamAssignmentErrF]
×
2614
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2615
        return &ApiError{
×
2616
                Code:        e.Code,
×
2617
                ErrCode:     e.ErrCode,
×
2618
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2619
        }
×
2620
}
2621

2622
// NewJSStreamCreateError creates a new JSStreamCreateErrF error: "{err}"
2623
func NewJSStreamCreateError(err error, opts ...ErrorOption) *ApiError {
65✔
2624
        eopts := parseOpts(opts)
65✔
2625
        if ae, ok := eopts.err.(*ApiError); ok {
130✔
2626
                return ae
65✔
2627
        }
65✔
2628

2629
        e := ApiErrors[JSStreamCreateErrF]
×
2630
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2631
        return &ApiError{
×
2632
                Code:        e.Code,
×
2633
                ErrCode:     e.ErrCode,
×
2634
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2635
        }
×
2636
}
2637

2638
// NewJSStreamDeleteError creates a new JSStreamDeleteErrF error: "{err}"
2639
func NewJSStreamDeleteError(err error, opts ...ErrorOption) *ApiError {
×
2640
        eopts := parseOpts(opts)
×
2641
        if ae, ok := eopts.err.(*ApiError); ok {
×
2642
                return ae
×
2643
        }
×
2644

2645
        e := ApiErrors[JSStreamDeleteErrF]
×
2646
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2647
        return &ApiError{
×
2648
                Code:        e.Code,
×
2649
                ErrCode:     e.ErrCode,
×
2650
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2651
        }
×
2652
}
2653

2654
// NewJSStreamDuplicateMessageConflictError creates a new JSStreamDuplicateMessageConflict error: "duplicate message id is in process"
2655
func NewJSStreamDuplicateMessageConflictError(opts ...ErrorOption) *ApiError {
20✔
2656
        eopts := parseOpts(opts)
20✔
2657
        if ae, ok := eopts.err.(*ApiError); ok {
20✔
2658
                return ae
×
2659
        }
×
2660

2661
        return ApiErrors[JSStreamDuplicateMessageConflict]
20✔
2662
}
2663

2664
// NewJSStreamExpectedLastSeqPerSubjectInvalidError creates a new JSStreamExpectedLastSeqPerSubjectInvalid error: "missing sequence for expected last sequence per subject"
2665
func NewJSStreamExpectedLastSeqPerSubjectInvalidError(opts ...ErrorOption) *ApiError {
8✔
2666
        eopts := parseOpts(opts)
8✔
2667
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
2668
                return ae
×
2669
        }
×
2670

2671
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectInvalid]
8✔
2672
}
2673

2674
// NewJSStreamExpectedLastSeqPerSubjectNotReadyError creates a new JSStreamExpectedLastSeqPerSubjectNotReady error: "expected last sequence per subject temporarily unavailable"
2675
func NewJSStreamExpectedLastSeqPerSubjectNotReadyError(opts ...ErrorOption) *ApiError {
×
2676
        eopts := parseOpts(opts)
×
2677
        if ae, ok := eopts.err.(*ApiError); ok {
×
2678
                return ae
×
2679
        }
×
2680

2681
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectNotReady]
×
2682
}
2683

2684
// NewJSStreamExternalApiOverlapError creates a new JSStreamExternalApiOverlapErrF error: "stream external api prefix {prefix} must not overlap with {subject}"
2685
func NewJSStreamExternalApiOverlapError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
2✔
2686
        eopts := parseOpts(opts)
2✔
2687
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2688
                return ae
×
2689
        }
×
2690

2691
        e := ApiErrors[JSStreamExternalApiOverlapErrF]
2✔
2692
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
2✔
2693
        return &ApiError{
2✔
2694
                Code:        e.Code,
2✔
2695
                ErrCode:     e.ErrCode,
2✔
2696
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2697
        }
2✔
2698
}
2699

2700
// NewJSStreamExternalDelPrefixOverlapsError creates a new JSStreamExternalDelPrefixOverlapsErrF error: "stream external delivery prefix {prefix} overlaps with stream subject {subject}"
2701
func NewJSStreamExternalDelPrefixOverlapsError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
×
2702
        eopts := parseOpts(opts)
×
2703
        if ae, ok := eopts.err.(*ApiError); ok {
×
2704
                return ae
×
2705
        }
×
2706

2707
        e := ApiErrors[JSStreamExternalDelPrefixOverlapsErrF]
×
2708
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
×
2709
        return &ApiError{
×
2710
                Code:        e.Code,
×
2711
                ErrCode:     e.ErrCode,
×
2712
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2713
        }
×
2714
}
2715

2716
// NewJSStreamGeneralError creates a new JSStreamGeneralErrorF error: "{err}"
2717
func NewJSStreamGeneralError(err error, opts ...ErrorOption) *ApiError {
5✔
2718
        eopts := parseOpts(opts)
5✔
2719
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2720
                return ae
×
2721
        }
×
2722

2723
        e := ApiErrors[JSStreamGeneralErrorF]
5✔
2724
        args := e.toReplacerArgs([]interface{}{"{err}", err})
5✔
2725
        return &ApiError{
5✔
2726
                Code:        e.Code,
5✔
2727
                ErrCode:     e.ErrCode,
5✔
2728
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
2729
        }
5✔
2730
}
2731

2732
// NewJSStreamHeaderExceedsMaximumError creates a new JSStreamHeaderExceedsMaximumErr error: "header size exceeds maximum allowed of 64k"
2733
func NewJSStreamHeaderExceedsMaximumError(opts ...ErrorOption) *ApiError {
1✔
2734
        eopts := parseOpts(opts)
1✔
2735
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2736
                return ae
×
2737
        }
×
2738

2739
        return ApiErrors[JSStreamHeaderExceedsMaximumErr]
1✔
2740
}
2741

2742
// NewJSStreamInfoMaxSubjectsError creates a new JSStreamInfoMaxSubjectsErr error: "subject details would exceed maximum allowed"
2743
func NewJSStreamInfoMaxSubjectsError(opts ...ErrorOption) *ApiError {
×
2744
        eopts := parseOpts(opts)
×
2745
        if ae, ok := eopts.err.(*ApiError); ok {
×
2746
                return ae
×
2747
        }
×
2748

2749
        return ApiErrors[JSStreamInfoMaxSubjectsErr]
×
2750
}
2751

2752
// NewJSStreamInvalidConfigError creates a new JSStreamInvalidConfigF error: "{err}"
2753
func NewJSStreamInvalidConfigError(err error, opts ...ErrorOption) *ApiError {
163✔
2754
        eopts := parseOpts(opts)
163✔
2755
        if ae, ok := eopts.err.(*ApiError); ok {
182✔
2756
                return ae
19✔
2757
        }
19✔
2758

2759
        e := ApiErrors[JSStreamInvalidConfigF]
144✔
2760
        args := e.toReplacerArgs([]interface{}{"{err}", err})
144✔
2761
        return &ApiError{
144✔
2762
                Code:        e.Code,
144✔
2763
                ErrCode:     e.ErrCode,
144✔
2764
                Description: strings.NewReplacer(args...).Replace(e.Description),
144✔
2765
        }
144✔
2766
}
2767

2768
// NewJSStreamInvalidError creates a new JSStreamInvalidErr error: "stream not valid"
2769
func NewJSStreamInvalidError(opts ...ErrorOption) *ApiError {
×
2770
        eopts := parseOpts(opts)
×
2771
        if ae, ok := eopts.err.(*ApiError); ok {
×
2772
                return ae
×
2773
        }
×
2774

2775
        return ApiErrors[JSStreamInvalidErr]
×
2776
}
2777

2778
// NewJSStreamInvalidExternalDeliverySubjError creates a new JSStreamInvalidExternalDeliverySubjErrF error: "stream external delivery prefix {prefix} must not contain wildcards"
2779
func NewJSStreamInvalidExternalDeliverySubjError(prefix interface{}, opts ...ErrorOption) *ApiError {
×
2780
        eopts := parseOpts(opts)
×
2781
        if ae, ok := eopts.err.(*ApiError); ok {
×
2782
                return ae
×
2783
        }
×
2784

2785
        e := ApiErrors[JSStreamInvalidExternalDeliverySubjErrF]
×
2786
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix})
×
2787
        return &ApiError{
×
2788
                Code:        e.Code,
×
2789
                ErrCode:     e.ErrCode,
×
2790
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2791
        }
×
2792
}
2793

2794
// NewJSStreamLimitsError creates a new JSStreamLimitsErrF error: "{err}"
2795
func NewJSStreamLimitsError(err error, opts ...ErrorOption) *ApiError {
18✔
2796
        eopts := parseOpts(opts)
18✔
2797
        if ae, ok := eopts.err.(*ApiError); ok {
36✔
2798
                return ae
18✔
2799
        }
18✔
2800

2801
        e := ApiErrors[JSStreamLimitsErrF]
×
2802
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2803
        return &ApiError{
×
2804
                Code:        e.Code,
×
2805
                ErrCode:     e.ErrCode,
×
2806
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2807
        }
×
2808
}
2809

2810
// NewJSStreamMaxBytesRequiredError creates a new JSStreamMaxBytesRequired error: "account requires a stream config to have max bytes set"
2811
func NewJSStreamMaxBytesRequiredError(opts ...ErrorOption) *ApiError {
11✔
2812
        eopts := parseOpts(opts)
11✔
2813
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
2814
                return ae
×
2815
        }
×
2816

2817
        return ApiErrors[JSStreamMaxBytesRequired]
11✔
2818
}
2819

2820
// NewJSStreamMaxStreamBytesExceededError creates a new JSStreamMaxStreamBytesExceeded error: "stream max bytes exceeds account limit max stream bytes"
2821
func NewJSStreamMaxStreamBytesExceededError(opts ...ErrorOption) *ApiError {
12✔
2822
        eopts := parseOpts(opts)
12✔
2823
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
2824
                return ae
×
2825
        }
×
2826

2827
        return ApiErrors[JSStreamMaxStreamBytesExceeded]
12✔
2828
}
2829

2830
// NewJSStreamMessageExceedsMaximumError creates a new JSStreamMessageExceedsMaximumErr error: "message size exceeds maximum allowed"
2831
func NewJSStreamMessageExceedsMaximumError(opts ...ErrorOption) *ApiError {
15✔
2832
        eopts := parseOpts(opts)
15✔
2833
        if ae, ok := eopts.err.(*ApiError); ok {
15✔
2834
                return ae
×
2835
        }
×
2836

2837
        return ApiErrors[JSStreamMessageExceedsMaximumErr]
15✔
2838
}
2839

2840
// NewJSStreamMinLastSeqError creates a new JSStreamMinLastSeqErr error: "min last sequence"
2841
func NewJSStreamMinLastSeqError(opts ...ErrorOption) *ApiError {
×
2842
        eopts := parseOpts(opts)
×
2843
        if ae, ok := eopts.err.(*ApiError); ok {
×
2844
                return ae
×
2845
        }
×
2846

2847
        return ApiErrors[JSStreamMinLastSeqErr]
×
2848
}
2849

2850
// NewJSStreamMirrorNotUpdatableError creates a new JSStreamMirrorNotUpdatableErr error: "stream mirror configuration can not be updated"
2851
func NewJSStreamMirrorNotUpdatableError(opts ...ErrorOption) *ApiError {
2✔
2852
        eopts := parseOpts(opts)
2✔
2853
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2854
                return ae
×
2855
        }
×
2856

2857
        return ApiErrors[JSStreamMirrorNotUpdatableErr]
2✔
2858
}
2859

2860
// NewJSStreamMismatchError creates a new JSStreamMismatchErr error: "stream name in subject does not match request"
2861
func NewJSStreamMismatchError(opts ...ErrorOption) *ApiError {
7✔
2862
        eopts := parseOpts(opts)
7✔
2863
        if ae, ok := eopts.err.(*ApiError); ok {
7✔
2864
                return ae
×
2865
        }
×
2866

2867
        return ApiErrors[JSStreamMismatchErr]
7✔
2868
}
2869

2870
// NewJSStreamMoveAndScaleError creates a new JSStreamMoveAndScaleErr error: "can not move and scale a stream in a single update"
2871
func NewJSStreamMoveAndScaleError(opts ...ErrorOption) *ApiError {
4✔
2872
        eopts := parseOpts(opts)
4✔
2873
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2874
                return ae
×
2875
        }
×
2876

2877
        return ApiErrors[JSStreamMoveAndScaleErr]
4✔
2878
}
2879

2880
// NewJSStreamMoveInProgressError creates a new JSStreamMoveInProgressF error: "stream move already in progress: {msg}"
2881
func NewJSStreamMoveInProgressError(msg interface{}, opts ...ErrorOption) *ApiError {
2✔
2882
        eopts := parseOpts(opts)
2✔
2883
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2884
                return ae
×
2885
        }
×
2886

2887
        e := ApiErrors[JSStreamMoveInProgressF]
2✔
2888
        args := e.toReplacerArgs([]interface{}{"{msg}", msg})
2✔
2889
        return &ApiError{
2✔
2890
                Code:        e.Code,
2✔
2891
                ErrCode:     e.ErrCode,
2✔
2892
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2893
        }
2✔
2894
}
2895

2896
// NewJSStreamMoveNotInProgressError creates a new JSStreamMoveNotInProgress error: "stream move not in progress"
2897
func NewJSStreamMoveNotInProgressError(opts ...ErrorOption) *ApiError {
×
2898
        eopts := parseOpts(opts)
×
2899
        if ae, ok := eopts.err.(*ApiError); ok {
×
2900
                return ae
×
2901
        }
×
2902

2903
        return ApiErrors[JSStreamMoveNotInProgress]
×
2904
}
2905

2906
// NewJSStreamMsgDeleteFailedError creates a new JSStreamMsgDeleteFailedF error: "{err}"
2907
func NewJSStreamMsgDeleteFailedError(err error, opts ...ErrorOption) *ApiError {
1,362✔
2908
        eopts := parseOpts(opts)
1,362✔
2909
        if ae, ok := eopts.err.(*ApiError); ok {
1,362✔
2910
                return ae
×
2911
        }
×
2912

2913
        e := ApiErrors[JSStreamMsgDeleteFailedF]
1,362✔
2914
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1,362✔
2915
        return &ApiError{
1,362✔
2916
                Code:        e.Code,
1,362✔
2917
                ErrCode:     e.ErrCode,
1,362✔
2918
                Description: strings.NewReplacer(args...).Replace(e.Description),
1,362✔
2919
        }
1,362✔
2920
}
2921

2922
// NewJSStreamNameContainsPathSeparatorsError creates a new JSStreamNameContainsPathSeparatorsErr error: "Stream name can not contain path separators"
2923
func NewJSStreamNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
6✔
2924
        eopts := parseOpts(opts)
6✔
2925
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2926
                return ae
×
2927
        }
×
2928

2929
        return ApiErrors[JSStreamNameContainsPathSeparatorsErr]
6✔
2930
}
2931

2932
// NewJSStreamNameExistError creates a new JSStreamNameExistErr error: "stream name already in use with a different configuration"
2933
func NewJSStreamNameExistError(opts ...ErrorOption) *ApiError {
10✔
2934
        eopts := parseOpts(opts)
10✔
2935
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2936
                return ae
×
2937
        }
×
2938

2939
        return ApiErrors[JSStreamNameExistErr]
10✔
2940
}
2941

2942
// NewJSStreamNameExistRestoreFailedError creates a new JSStreamNameExistRestoreFailedErr error: "stream name already in use, cannot restore"
2943
func NewJSStreamNameExistRestoreFailedError(opts ...ErrorOption) *ApiError {
7✔
2944
        eopts := parseOpts(opts)
7✔
2945
        if ae, ok := eopts.err.(*ApiError); ok {
7✔
2946
                return ae
×
2947
        }
×
2948

2949
        return ApiErrors[JSStreamNameExistRestoreFailedErr]
7✔
2950
}
2951

2952
// NewJSStreamNotFoundError creates a new JSStreamNotFoundErr error: "stream not found"
2953
func NewJSStreamNotFoundError(opts ...ErrorOption) *ApiError {
30,521✔
2954
        eopts := parseOpts(opts)
30,521✔
2955
        if ae, ok := eopts.err.(*ApiError); ok {
31,308✔
2956
                return ae
787✔
2957
        }
787✔
2958

2959
        return ApiErrors[JSStreamNotFoundErr]
29,734✔
2960
}
2961

2962
// NewJSStreamNotMatchError creates a new JSStreamNotMatchErr error: "expected stream does not match"
2963
func NewJSStreamNotMatchError(opts ...ErrorOption) *ApiError {
1✔
2964
        eopts := parseOpts(opts)
1✔
2965
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2966
                return ae
×
2967
        }
×
2968

2969
        return ApiErrors[JSStreamNotMatchErr]
1✔
2970
}
2971

2972
// NewJSStreamOfflineError creates a new JSStreamOfflineErr error: "stream is offline"
2973
func NewJSStreamOfflineError(opts ...ErrorOption) *ApiError {
6✔
2974
        eopts := parseOpts(opts)
6✔
2975
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2976
                return ae
×
2977
        }
×
2978

2979
        return ApiErrors[JSStreamOfflineErr]
6✔
2980
}
2981

2982
// NewJSStreamOfflineReasonError creates a new JSStreamOfflineReasonErrF error: "stream is offline: {err}"
2983
func NewJSStreamOfflineReasonError(err error, opts ...ErrorOption) *ApiError {
40✔
2984
        eopts := parseOpts(opts)
40✔
2985
        if ae, ok := eopts.err.(*ApiError); ok {
40✔
2986
                return ae
×
2987
        }
×
2988

2989
        e := ApiErrors[JSStreamOfflineReasonErrF]
40✔
2990
        args := e.toReplacerArgs([]interface{}{"{err}", err})
40✔
2991
        return &ApiError{
40✔
2992
                Code:        e.Code,
40✔
2993
                ErrCode:     e.ErrCode,
40✔
2994
                Description: strings.NewReplacer(args...).Replace(e.Description),
40✔
2995
        }
40✔
2996
}
2997

2998
// NewJSStreamPurgeFailedError creates a new JSStreamPurgeFailedF error: "{err}"
2999
func NewJSStreamPurgeFailedError(err error, opts ...ErrorOption) *ApiError {
1✔
3000
        eopts := parseOpts(opts)
1✔
3001
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3002
                return ae
×
3003
        }
×
3004

3005
        e := ApiErrors[JSStreamPurgeFailedF]
1✔
3006
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
3007
        return &ApiError{
1✔
3008
                Code:        e.Code,
1✔
3009
                ErrCode:     e.ErrCode,
1✔
3010
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
3011
        }
1✔
3012
}
3013

3014
// NewJSStreamReplicasNotSupportedError creates a new JSStreamReplicasNotSupportedErr error: "replicas > 1 not supported in non-clustered mode"
3015
func NewJSStreamReplicasNotSupportedError(opts ...ErrorOption) *ApiError {
1✔
3016
        eopts := parseOpts(opts)
1✔
3017
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3018
                return ae
×
3019
        }
×
3020

3021
        return ApiErrors[JSStreamReplicasNotSupportedErr]
1✔
3022
}
3023

3024
// NewJSStreamReplicasNotUpdatableError creates a new JSStreamReplicasNotUpdatableErr error: "Replicas configuration can not be updated"
3025
func NewJSStreamReplicasNotUpdatableError(opts ...ErrorOption) *ApiError {
×
3026
        eopts := parseOpts(opts)
×
3027
        if ae, ok := eopts.err.(*ApiError); ok {
×
3028
                return ae
×
3029
        }
×
3030

3031
        return ApiErrors[JSStreamReplicasNotUpdatableErr]
×
3032
}
3033

3034
// NewJSStreamRestoreError creates a new JSStreamRestoreErrF error: "restore failed: {err}"
3035
func NewJSStreamRestoreError(err error, opts ...ErrorOption) *ApiError {
7✔
3036
        eopts := parseOpts(opts)
7✔
3037
        if ae, ok := eopts.err.(*ApiError); ok {
9✔
3038
                return ae
2✔
3039
        }
2✔
3040

3041
        e := ApiErrors[JSStreamRestoreErrF]
5✔
3042
        args := e.toReplacerArgs([]interface{}{"{err}", err})
5✔
3043
        return &ApiError{
5✔
3044
                Code:        e.Code,
5✔
3045
                ErrCode:     e.ErrCode,
5✔
3046
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
3047
        }
5✔
3048
}
3049

3050
// NewJSStreamRollupFailedError creates a new JSStreamRollupFailedF error: "{err}"
3051
func NewJSStreamRollupFailedError(err error, opts ...ErrorOption) *ApiError {
5✔
3052
        eopts := parseOpts(opts)
5✔
3053
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
3054
                return ae
×
3055
        }
×
3056

3057
        e := ApiErrors[JSStreamRollupFailedF]
5✔
3058
        args := e.toReplacerArgs([]interface{}{"{err}", err})
5✔
3059
        return &ApiError{
5✔
3060
                Code:        e.Code,
5✔
3061
                ErrCode:     e.ErrCode,
5✔
3062
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
3063
        }
5✔
3064
}
3065

3066
// NewJSStreamSealedError creates a new JSStreamSealedErr error: "invalid operation on sealed stream"
3067
func NewJSStreamSealedError(opts ...ErrorOption) *ApiError {
6✔
3068
        eopts := parseOpts(opts)
6✔
3069
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
3070
                return ae
×
3071
        }
×
3072

3073
        return ApiErrors[JSStreamSealedErr]
6✔
3074
}
3075

3076
// NewJSStreamSequenceNotMatchError creates a new JSStreamSequenceNotMatchErr error: "expected stream sequence does not match"
3077
func NewJSStreamSequenceNotMatchError(opts ...ErrorOption) *ApiError {
×
3078
        eopts := parseOpts(opts)
×
3079
        if ae, ok := eopts.err.(*ApiError); ok {
×
3080
                return ae
×
3081
        }
×
3082

3083
        return ApiErrors[JSStreamSequenceNotMatchErr]
×
3084
}
3085

3086
// NewJSStreamSnapshotError creates a new JSStreamSnapshotErrF error: "snapshot failed: {err}"
3087
func NewJSStreamSnapshotError(err error, opts ...ErrorOption) *ApiError {
×
3088
        eopts := parseOpts(opts)
×
3089
        if ae, ok := eopts.err.(*ApiError); ok {
×
3090
                return ae
×
3091
        }
×
3092

3093
        e := ApiErrors[JSStreamSnapshotErrF]
×
3094
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
3095
        return &ApiError{
×
3096
                Code:        e.Code,
×
3097
                ErrCode:     e.ErrCode,
×
3098
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
3099
        }
×
3100
}
3101

3102
// NewJSStreamStoreFailedError creates a new JSStreamStoreFailedF error: "{err}"
3103
func NewJSStreamStoreFailedError(err error, opts ...ErrorOption) *ApiError {
1,521✔
3104
        eopts := parseOpts(opts)
1,521✔
3105
        if ae, ok := eopts.err.(*ApiError); ok {
1,521✔
3106
                return ae
×
3107
        }
×
3108

3109
        e := ApiErrors[JSStreamStoreFailedF]
1,521✔
3110
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1,521✔
3111
        return &ApiError{
1,521✔
3112
                Code:        e.Code,
1,521✔
3113
                ErrCode:     e.ErrCode,
1,521✔
3114
                Description: strings.NewReplacer(args...).Replace(e.Description),
1,521✔
3115
        }
1,521✔
3116
}
3117

3118
// NewJSStreamSubjectOverlapError creates a new JSStreamSubjectOverlapErr error: "subjects overlap with an existing stream"
3119
func NewJSStreamSubjectOverlapError(opts ...ErrorOption) *ApiError {
25✔
3120
        eopts := parseOpts(opts)
25✔
3121
        if ae, ok := eopts.err.(*ApiError); ok {
25✔
3122
                return ae
×
3123
        }
×
3124

3125
        return ApiErrors[JSStreamSubjectOverlapErr]
25✔
3126
}
3127

3128
// NewJSStreamTemplateCreateError creates a new JSStreamTemplateCreateErrF error: "{err}"
3129
func NewJSStreamTemplateCreateError(err error, opts ...ErrorOption) *ApiError {
×
3130
        eopts := parseOpts(opts)
×
3131
        if ae, ok := eopts.err.(*ApiError); ok {
×
3132
                return ae
×
3133
        }
×
3134

3135
        e := ApiErrors[JSStreamTemplateCreateErrF]
×
3136
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
3137
        return &ApiError{
×
3138
                Code:        e.Code,
×
3139
                ErrCode:     e.ErrCode,
×
3140
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
3141
        }
×
3142
}
3143

3144
// NewJSStreamTemplateDeleteError creates a new JSStreamTemplateDeleteErrF error: "{err}"
3145
func NewJSStreamTemplateDeleteError(err error, opts ...ErrorOption) *ApiError {
×
3146
        eopts := parseOpts(opts)
×
3147
        if ae, ok := eopts.err.(*ApiError); ok {
×
3148
                return ae
×
3149
        }
×
3150

3151
        e := ApiErrors[JSStreamTemplateDeleteErrF]
×
3152
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
3153
        return &ApiError{
×
3154
                Code:        e.Code,
×
3155
                ErrCode:     e.ErrCode,
×
3156
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
3157
        }
×
3158
}
3159

3160
// NewJSStreamTemplateNotFoundError creates a new JSStreamTemplateNotFoundErr error: "template not found"
3161
func NewJSStreamTemplateNotFoundError(opts ...ErrorOption) *ApiError {
×
3162
        eopts := parseOpts(opts)
×
3163
        if ae, ok := eopts.err.(*ApiError); ok {
×
3164
                return ae
×
3165
        }
×
3166

3167
        return ApiErrors[JSStreamTemplateNotFoundErr]
×
3168
}
3169

3170
// NewJSStreamTooManyRequestsError creates a new JSStreamTooManyRequests error: "too many requests"
3171
func NewJSStreamTooManyRequestsError(opts ...ErrorOption) *ApiError {
122✔
3172
        eopts := parseOpts(opts)
122✔
3173
        if ae, ok := eopts.err.(*ApiError); ok {
122✔
3174
                return ae
×
3175
        }
×
3176

3177
        return ApiErrors[JSStreamTooManyRequests]
122✔
3178
}
3179

3180
// NewJSStreamTransformInvalidDestinationError creates a new JSStreamTransformInvalidDestination error: "stream transform: {err}"
3181
func NewJSStreamTransformInvalidDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
3182
        eopts := parseOpts(opts)
1✔
3183
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3184
                return ae
×
3185
        }
×
3186

3187
        e := ApiErrors[JSStreamTransformInvalidDestination]
1✔
3188
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
3189
        return &ApiError{
1✔
3190
                Code:        e.Code,
1✔
3191
                ErrCode:     e.ErrCode,
1✔
3192
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
3193
        }
1✔
3194
}
3195

3196
// NewJSStreamTransformInvalidSourceError creates a new JSStreamTransformInvalidSource error: "stream transform source: {err}"
3197
func NewJSStreamTransformInvalidSourceError(err error, opts ...ErrorOption) *ApiError {
1✔
3198
        eopts := parseOpts(opts)
1✔
3199
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3200
                return ae
×
3201
        }
×
3202

3203
        e := ApiErrors[JSStreamTransformInvalidSource]
1✔
3204
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
3205
        return &ApiError{
1✔
3206
                Code:        e.Code,
1✔
3207
                ErrCode:     e.ErrCode,
1✔
3208
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
3209
        }
1✔
3210
}
3211

3212
// NewJSStreamUpdateError creates a new JSStreamUpdateErrF error: "{err}"
3213
func NewJSStreamUpdateError(err error, opts ...ErrorOption) *ApiError {
30✔
3214
        eopts := parseOpts(opts)
30✔
3215
        if ae, ok := eopts.err.(*ApiError); ok {
54✔
3216
                return ae
24✔
3217
        }
24✔
3218

3219
        e := ApiErrors[JSStreamUpdateErrF]
6✔
3220
        args := e.toReplacerArgs([]interface{}{"{err}", err})
6✔
3221
        return &ApiError{
6✔
3222
                Code:        e.Code,
6✔
3223
                ErrCode:     e.ErrCode,
6✔
3224
                Description: strings.NewReplacer(args...).Replace(e.Description),
6✔
3225
        }
6✔
3226
}
3227

3228
// NewJSStreamWrongLastMsgIDError creates a new JSStreamWrongLastMsgIDErrF error: "wrong last msg ID: {id}"
3229
func NewJSStreamWrongLastMsgIDError(id interface{}, opts ...ErrorOption) *ApiError {
1✔
3230
        eopts := parseOpts(opts)
1✔
3231
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3232
                return ae
×
3233
        }
×
3234

3235
        e := ApiErrors[JSStreamWrongLastMsgIDErrF]
1✔
3236
        args := e.toReplacerArgs([]interface{}{"{id}", id})
1✔
3237
        return &ApiError{
1✔
3238
                Code:        e.Code,
1✔
3239
                ErrCode:     e.ErrCode,
1✔
3240
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
3241
        }
1✔
3242
}
3243

3244
// NewJSStreamWrongLastSequenceConstantError creates a new JSStreamWrongLastSequenceConstantErr error: "wrong last sequence"
3245
func NewJSStreamWrongLastSequenceConstantError(opts ...ErrorOption) *ApiError {
23✔
3246
        eopts := parseOpts(opts)
23✔
3247
        if ae, ok := eopts.err.(*ApiError); ok {
23✔
3248
                return ae
×
3249
        }
×
3250

3251
        return ApiErrors[JSStreamWrongLastSequenceConstantErr]
23✔
3252
}
3253

3254
// NewJSStreamWrongLastSequenceError creates a new JSStreamWrongLastSequenceErrF error: "wrong last sequence: {seq}"
3255
func NewJSStreamWrongLastSequenceError(seq uint64, opts ...ErrorOption) *ApiError {
98✔
3256
        eopts := parseOpts(opts)
98✔
3257
        if ae, ok := eopts.err.(*ApiError); ok {
98✔
3258
                return ae
×
3259
        }
×
3260

3261
        e := ApiErrors[JSStreamWrongLastSequenceErrF]
98✔
3262
        args := e.toReplacerArgs([]interface{}{"{seq}", seq})
98✔
3263
        return &ApiError{
98✔
3264
                Code:        e.Code,
98✔
3265
                ErrCode:     e.ErrCode,
98✔
3266
                Description: strings.NewReplacer(args...).Replace(e.Description),
98✔
3267
        }
98✔
3268
}
3269

3270
// NewJSTempStorageFailedError creates a new JSTempStorageFailedErr error: "JetStream unable to open temp storage for restore"
3271
func NewJSTempStorageFailedError(opts ...ErrorOption) *ApiError {
×
3272
        eopts := parseOpts(opts)
×
3273
        if ae, ok := eopts.err.(*ApiError); ok {
×
3274
                return ae
×
3275
        }
×
3276

3277
        return ApiErrors[JSTempStorageFailedErr]
×
3278
}
3279

3280
// NewJSTemplateNameNotMatchSubjectError creates a new JSTemplateNameNotMatchSubjectErr error: "template name in subject does not match request"
3281
func NewJSTemplateNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
×
3282
        eopts := parseOpts(opts)
×
3283
        if ae, ok := eopts.err.(*ApiError); ok {
×
3284
                return ae
×
3285
        }
×
3286

3287
        return ApiErrors[JSTemplateNameNotMatchSubjectErr]
×
3288
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc