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

nats-io / nats-server / 26435225498

22 May 2026 03:17PM UTC coverage: 80.674% (-0.5%) from 81.166%
26435225498

push

github

web-flow
Enforce cardinality threshold on `checkSkipFirstBlock` and `checkSkipFirstBlockMulti` (#8227)

At a certain threshold, intersecting the entire stream subject state
becomes considerably more expensive than just walking forward normally,
so we should avoid doing that. In other places in the filestore, we
tweak operations at 1 million subjects, and that seems to roughly align
here too.

Before:
```
goos: darwin
goarch: arm64
pkg: github.com/nats-io/nats-server/v2/server
cpu: Apple M2 Ultra
BenchmarkFileStoreCheckSkipFirstBlockMultiTippingPoint
BenchmarkFileStoreCheckSkipFirstBlockMultiTippingPoint/UniqueSubjects/1000
BenchmarkFileStoreCheckSkipFirstBlockMultiTippingPoint/UniqueSubjects/1000-24         	    6747	    173332 ns/op
BenchmarkFileStoreCheckSkipFirstBlockMultiTippingPoint/UniqueSubjects/10000
BenchmarkFileStoreCheckSkipFirstBlockMultiTippingPoint/UniqueSubjects/10000-24        	     735	   1651734 ns/op
BenchmarkFileStoreCheckSkipFirstBlockMultiTippingPoint/UniqueSubjects/100000
BenchmarkFileStoreCheckSkipFirstBlockMultiTippingPoint/UniqueSubjects/100000-24       	     144	   8261559 ns/op
BenchmarkFileStoreCheckSkipFirstBlockMultiTippingPoint/UniqueSubjects/500000
BenchmarkFileStoreCheckSkipFirstBlockMultiTippingPoint/UniqueSubjects/500000-24       	      27	  42628478 ns/op
BenchmarkFileStoreCheckSkipFirstBlockMultiTippingPoint/UniqueSubjects/1000000
BenchmarkFileStoreCheckSkipFirstBlockMultiTippingPoint/UniqueSubjects/1000000-24      	      13	  87825721 ns/op
BenchmarkFileStoreCheckSkipFirstBlockMultiTippingPoint/UniqueSubjects/1500000
BenchmarkFileStoreCheckSkipFirstBlockMultiTippingPoint/UniqueSubjects/1500000-24      	       8	 135479005 ns/op
BenchmarkFileStoreCheckSkipFirstBlockMultiTippingPoint/UniqueSubjects/2000000
BenchmarkFileStoreCheckSkipFirstBlockMultiTippingPoint/UniqueSubjects/2000000-24      	       6	 184404188 ns/op
PASS
ok  	github.com/nats-io/nats-server/v2/server	206.401s
```

After:
```
goos: darwin
goarch: arm64
pkg: ... (continued)

75386 of 93445 relevant lines covered (80.67%)

495966.5 hits per line

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

56.68
/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
        // JSConsumerAckFCRequiresFCErr flow control ack policy requires flow control
93
        JSConsumerAckFCRequiresFCErr ErrorIdentifier = 10219
94

95
        // JSConsumerAckFCRequiresMaxAckPendingErr flow control ack policy requires max ack pending
96
        JSConsumerAckFCRequiresMaxAckPendingErr ErrorIdentifier = 10220
97

98
        // JSConsumerAckFCRequiresNoAckWaitErr flow control ack policy requires unset ack wait
99
        JSConsumerAckFCRequiresNoAckWaitErr ErrorIdentifier = 10221
100

101
        // JSConsumerAckFCRequiresNoMaxDeliverErr flow control ack policy requires unset max deliver
102
        JSConsumerAckFCRequiresNoMaxDeliverErr ErrorIdentifier = 10222
103

104
        // JSConsumerAckFCRequiresPushErr flow control ack policy requires a push based consumer
105
        JSConsumerAckFCRequiresPushErr ErrorIdentifier = 10218
106

107
        // JSConsumerAckPolicyInvalidErr consumer ack policy invalid
108
        JSConsumerAckPolicyInvalidErr ErrorIdentifier = 10181
109

110
        // JSConsumerAckWaitNegativeErr consumer ack wait needs to be positive
111
        JSConsumerAckWaitNegativeErr ErrorIdentifier = 10183
112

113
        // JSConsumerAlreadyExists action CREATE is used for a existing consumer with a different config (consumer already exists)
114
        JSConsumerAlreadyExists ErrorIdentifier = 10148
115

116
        // JSConsumerBackOffNegativeErr consumer backoff needs to be positive
117
        JSConsumerBackOffNegativeErr ErrorIdentifier = 10184
118

119
        // JSConsumerBadDurableNameErr durable name can not contain '.', '*', '>'
120
        JSConsumerBadDurableNameErr ErrorIdentifier = 10103
121

122
        // JSConsumerConfigRequiredErr consumer config required
123
        JSConsumerConfigRequiredErr ErrorIdentifier = 10078
124

125
        // JSConsumerCreateDurableAndNameMismatch Consumer Durable and Name have to be equal if both are provided
126
        JSConsumerCreateDurableAndNameMismatch ErrorIdentifier = 10132
127

128
        // JSConsumerCreateErrF General consumer creation failure string ({err})
129
        JSConsumerCreateErrF ErrorIdentifier = 10012
130

131
        // JSConsumerCreateFilterSubjectMismatchErr Consumer create request did not match filtered subject from create subject
132
        JSConsumerCreateFilterSubjectMismatchErr ErrorIdentifier = 10131
133

134
        // JSConsumerDeliverCycleErr consumer deliver subject forms a cycle
135
        JSConsumerDeliverCycleErr ErrorIdentifier = 10081
136

137
        // JSConsumerDeliverToWildcardsErr consumer deliver subject has wildcards
138
        JSConsumerDeliverToWildcardsErr ErrorIdentifier = 10079
139

140
        // JSConsumerDescriptionTooLongErrF consumer description is too long, maximum allowed is {max}
141
        JSConsumerDescriptionTooLongErrF ErrorIdentifier = 10107
142

143
        // JSConsumerDirectRequiresEphemeralErr consumer direct requires an ephemeral consumer
144
        JSConsumerDirectRequiresEphemeralErr ErrorIdentifier = 10091
145

146
        // JSConsumerDirectRequiresPushErr consumer direct requires a push based consumer
147
        JSConsumerDirectRequiresPushErr ErrorIdentifier = 10090
148

149
        // JSConsumerDoesNotExist action UPDATE is used for a nonexisting consumer (consumer does not exist)
150
        JSConsumerDoesNotExist ErrorIdentifier = 10149
151

152
        // JSConsumerDuplicateFilterSubjects consumer cannot have both FilterSubject and FilterSubjects specified
153
        JSConsumerDuplicateFilterSubjects ErrorIdentifier = 10136
154

155
        // JSConsumerDurableNameNotInSubjectErr consumer expected to be durable but no durable name set in subject
156
        JSConsumerDurableNameNotInSubjectErr ErrorIdentifier = 10016
157

158
        // JSConsumerDurableNameNotMatchSubjectErr consumer name in subject does not match durable name in request
159
        JSConsumerDurableNameNotMatchSubjectErr ErrorIdentifier = 10017
160

161
        // JSConsumerDurableNameNotSetErr consumer expected to be durable but a durable name was not set
162
        JSConsumerDurableNameNotSetErr ErrorIdentifier = 10018
163

164
        // JSConsumerEmptyFilter consumer filter in FilterSubjects cannot be empty
165
        JSConsumerEmptyFilter ErrorIdentifier = 10139
166

167
        // JSConsumerEmptyGroupName Group name cannot be an empty string
168
        JSConsumerEmptyGroupName ErrorIdentifier = 10161
169

170
        // JSConsumerEphemeralWithDurableInSubjectErr consumer expected to be ephemeral but detected a durable name set in subject
171
        JSConsumerEphemeralWithDurableInSubjectErr ErrorIdentifier = 10019
172

173
        // JSConsumerEphemeralWithDurableNameErr consumer expected to be ephemeral but a durable name was set in request
174
        JSConsumerEphemeralWithDurableNameErr ErrorIdentifier = 10020
175

176
        // JSConsumerExistingActiveErr consumer already exists and is still active
177
        JSConsumerExistingActiveErr ErrorIdentifier = 10105
178

179
        // JSConsumerFCRequiresPushErr consumer flow control requires a push based consumer
180
        JSConsumerFCRequiresPushErr ErrorIdentifier = 10089
181

182
        // JSConsumerFilterNotSubsetErr consumer filter subject is not a valid subset of the interest subjects
183
        JSConsumerFilterNotSubsetErr ErrorIdentifier = 10093
184

185
        // JSConsumerHBRequiresPushErr consumer idle heartbeat requires a push based consumer
186
        JSConsumerHBRequiresPushErr ErrorIdentifier = 10088
187

188
        // JSConsumerInactiveThresholdExcess consumer inactive threshold exceeds system limit of {limit}
189
        JSConsumerInactiveThresholdExcess ErrorIdentifier = 10153
190

191
        // JSConsumerInvalidDeliverSubject invalid push consumer deliver subject
192
        JSConsumerInvalidDeliverSubject ErrorIdentifier = 10112
193

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

197
        // JSConsumerInvalidPolicyErrF Generic delivery policy error ({err})
198
        JSConsumerInvalidPolicyErrF ErrorIdentifier = 10094
199

200
        // JSConsumerInvalidPriorityGroupErr Provided priority group does not exist for this consumer
201
        JSConsumerInvalidPriorityGroupErr ErrorIdentifier = 10160
202

203
        // JSConsumerInvalidResetErr invalid reset: {err}
204
        JSConsumerInvalidResetErr ErrorIdentifier = 10204
205

206
        // JSConsumerInvalidSamplingErrF failed to parse consumer sampling configuration: {err}
207
        JSConsumerInvalidSamplingErrF ErrorIdentifier = 10095
208

209
        // JSConsumerMaxDeliverBackoffErr max deliver is required to be > length of backoff values
210
        JSConsumerMaxDeliverBackoffErr ErrorIdentifier = 10116
211

212
        // JSConsumerMaxPendingAckExcessErrF consumer max ack pending exceeds system limit of {limit}
213
        JSConsumerMaxPendingAckExcessErrF ErrorIdentifier = 10121
214

215
        // JSConsumerMaxPendingAckPolicyRequiredErr consumer requires ack policy for max ack pending
216
        JSConsumerMaxPendingAckPolicyRequiredErr ErrorIdentifier = 10082
217

218
        // JSConsumerMaxRequestBatchExceededF consumer max request batch exceeds server limit of {limit}
219
        JSConsumerMaxRequestBatchExceededF ErrorIdentifier = 10125
220

221
        // JSConsumerMaxRequestBatchNegativeErr consumer max request batch needs to be > 0
222
        JSConsumerMaxRequestBatchNegativeErr ErrorIdentifier = 10114
223

224
        // JSConsumerMaxRequestExpiresTooSmall consumer max request expires needs to be >= 1ms
225
        JSConsumerMaxRequestExpiresTooSmall ErrorIdentifier = 10115
226

227
        // JSConsumerMaxWaitingNegativeErr consumer max waiting needs to be positive
228
        JSConsumerMaxWaitingNegativeErr ErrorIdentifier = 10087
229

230
        // JSConsumerMetadataLengthErrF consumer metadata exceeds maximum size of {limit}
231
        JSConsumerMetadataLengthErrF ErrorIdentifier = 10135
232

233
        // JSConsumerMultipleFiltersNotAllowed consumer with multiple subject filters cannot use subject based API
234
        JSConsumerMultipleFiltersNotAllowed ErrorIdentifier = 10137
235

236
        // JSConsumerNameContainsPathSeparatorsErr Consumer name can not contain path separators
237
        JSConsumerNameContainsPathSeparatorsErr ErrorIdentifier = 10127
238

239
        // JSConsumerNameExistErr consumer name already in use
240
        JSConsumerNameExistErr ErrorIdentifier = 10013
241

242
        // JSConsumerNameTooLongErrF consumer name is too long, maximum allowed is {max}
243
        JSConsumerNameTooLongErrF ErrorIdentifier = 10102
244

245
        // JSConsumerNotFoundErr consumer not found
246
        JSConsumerNotFoundErr ErrorIdentifier = 10014
247

248
        // JSConsumerOfflineErr consumer is offline
249
        JSConsumerOfflineErr ErrorIdentifier = 10119
250

251
        // JSConsumerOfflineReasonErrF consumer is offline: {err}
252
        JSConsumerOfflineReasonErrF ErrorIdentifier = 10195
253

254
        // JSConsumerOnMappedErr consumer direct on a mapped consumer
255
        JSConsumerOnMappedErr ErrorIdentifier = 10092
256

257
        // JSConsumerOverlappingSubjectFilters consumer subject filters cannot overlap
258
        JSConsumerOverlappingSubjectFilters ErrorIdentifier = 10138
259

260
        // JSConsumerPinnedTTLWithoutPriorityPolicyNone PinnedTTL cannot be set when PriorityPolicy is none
261
        JSConsumerPinnedTTLWithoutPriorityPolicyNone ErrorIdentifier = 10197
262

263
        // JSConsumerPriorityGroupWithPolicyNone consumer can not have priority groups when policy is none
264
        JSConsumerPriorityGroupWithPolicyNone ErrorIdentifier = 10196
265

266
        // JSConsumerPriorityPolicyWithoutGroup Setting PriorityPolicy requires at least one PriorityGroup to be set
267
        JSConsumerPriorityPolicyWithoutGroup ErrorIdentifier = 10159
268

269
        // JSConsumerPullNotDurableErr consumer in pull mode requires a durable name
270
        JSConsumerPullNotDurableErr ErrorIdentifier = 10085
271

272
        // JSConsumerPullRequiresAckErr consumer in pull mode requires explicit ack policy on workqueue stream
273
        JSConsumerPullRequiresAckErr ErrorIdentifier = 10084
274

275
        // JSConsumerPullWithRateLimitErr consumer in pull mode can not have rate limit set
276
        JSConsumerPullWithRateLimitErr ErrorIdentifier = 10086
277

278
        // JSConsumerPushMaxWaitingErr consumer in push mode can not set max waiting
279
        JSConsumerPushMaxWaitingErr ErrorIdentifier = 10080
280

281
        // JSConsumerPushWithPriorityGroupErr priority groups can not be used with push consumers
282
        JSConsumerPushWithPriorityGroupErr ErrorIdentifier = 10178
283

284
        // JSConsumerReplacementWithDifferentNameErr consumer replacement durable config not the same
285
        JSConsumerReplacementWithDifferentNameErr ErrorIdentifier = 10106
286

287
        // JSConsumerReplayPolicyInvalidErr consumer replay policy invalid
288
        JSConsumerReplayPolicyInvalidErr ErrorIdentifier = 10182
289

290
        // JSConsumerReplicasExceedsStream consumer config replica count exceeds parent stream
291
        JSConsumerReplicasExceedsStream ErrorIdentifier = 10126
292

293
        // JSConsumerReplicasShouldMatchStream consumer config replicas must match interest retention stream's replicas
294
        JSConsumerReplicasShouldMatchStream ErrorIdentifier = 10134
295

296
        // JSConsumerSmallHeartbeatErr consumer idle heartbeat needs to be >= 100ms
297
        JSConsumerSmallHeartbeatErr ErrorIdentifier = 10083
298

299
        // JSConsumerStoreFailedErrF error creating store for consumer: {err}
300
        JSConsumerStoreFailedErrF ErrorIdentifier = 10104
301

302
        // JSConsumerWQConsumerNotDeliverAllErr consumer must be deliver all on workqueue stream
303
        JSConsumerWQConsumerNotDeliverAllErr ErrorIdentifier = 10101
304

305
        // JSConsumerWQConsumerNotUniqueErr filtered consumer not unique on workqueue stream
306
        JSConsumerWQConsumerNotUniqueErr ErrorIdentifier = 10100
307

308
        // JSConsumerWQMultipleUnfilteredErr multiple non-filtered consumers not allowed on workqueue stream
309
        JSConsumerWQMultipleUnfilteredErr ErrorIdentifier = 10099
310

311
        // JSConsumerWQRequiresExplicitAckErr workqueue stream requires explicit ack
312
        JSConsumerWQRequiresExplicitAckErr ErrorIdentifier = 10098
313

314
        // JSConsumerWithFlowControlNeedsHeartbeats consumer with flow control also needs heartbeats
315
        JSConsumerWithFlowControlNeedsHeartbeats ErrorIdentifier = 10108
316

317
        // JSInsufficientResourcesErr insufficient resources
318
        JSInsufficientResourcesErr ErrorIdentifier = 10023
319

320
        // JSInvalidJSONErr invalid JSON: {err}
321
        JSInvalidJSONErr ErrorIdentifier = 10025
322

323
        // JSMaximumConsumersLimitErr maximum consumers limit reached
324
        JSMaximumConsumersLimitErr ErrorIdentifier = 10026
325

326
        // JSMaximumStreamsLimitErr maximum number of streams reached
327
        JSMaximumStreamsLimitErr ErrorIdentifier = 10027
328

329
        // JSMemoryResourcesExceededErr insufficient memory resources available
330
        JSMemoryResourcesExceededErr ErrorIdentifier = 10028
331

332
        // JSMessageCounterBrokenErr message counter is broken
333
        JSMessageCounterBrokenErr ErrorIdentifier = 10172
334

335
        // JSMessageIncrDisabledErr message counters is disabled
336
        JSMessageIncrDisabledErr ErrorIdentifier = 10168
337

338
        // JSMessageIncrInvalidErr message counter increment is invalid
339
        JSMessageIncrInvalidErr ErrorIdentifier = 10171
340

341
        // JSMessageIncrMissingErr message counter increment is missing
342
        JSMessageIncrMissingErr ErrorIdentifier = 10169
343

344
        // JSMessageIncrPayloadErr message counter has payload
345
        JSMessageIncrPayloadErr ErrorIdentifier = 10170
346

347
        // JSMessageSchedulesDisabledErr message schedules is disabled
348
        JSMessageSchedulesDisabledErr ErrorIdentifier = 10188
349

350
        // JSMessageSchedulesPatternInvalidErr message schedules pattern is invalid
351
        JSMessageSchedulesPatternInvalidErr ErrorIdentifier = 10189
352

353
        // JSMessageSchedulesRollupInvalidErr message schedules invalid rollup
354
        JSMessageSchedulesRollupInvalidErr ErrorIdentifier = 10192
355

356
        // JSMessageSchedulesSchedulerInvalidErr message schedules invalid scheduler
357
        JSMessageSchedulesSchedulerInvalidErr ErrorIdentifier = 10212
358

359
        // JSMessageSchedulesSourceInvalidErr message schedules source is invalid
360
        JSMessageSchedulesSourceInvalidErr ErrorIdentifier = 10203
361

362
        // JSMessageSchedulesTTLInvalidErr message schedules invalid per-message TTL
363
        JSMessageSchedulesTTLInvalidErr ErrorIdentifier = 10191
364

365
        // JSMessageSchedulesTargetInvalidErr message schedules target is invalid
366
        JSMessageSchedulesTargetInvalidErr ErrorIdentifier = 10190
367

368
        // JSMessageSchedulesTimeZoneInvalidErr message schedules time zone is invalid
369
        JSMessageSchedulesTimeZoneInvalidErr ErrorIdentifier = 10223
370

371
        // JSMessageTTLDisabledErr per-message TTL is disabled
372
        JSMessageTTLDisabledErr ErrorIdentifier = 10166
373

374
        // JSMessageTTLInvalidErr invalid per-message TTL
375
        JSMessageTTLInvalidErr ErrorIdentifier = 10165
376

377
        // JSMirrorConsumerRequiresAckFCErr stream mirror consumer requires flow control ack policy
378
        JSMirrorConsumerRequiresAckFCErr ErrorIdentifier = 10214
379

380
        // JSMirrorConsumerSetupFailedErrF generic mirror consumer setup failure string ({err})
381
        JSMirrorConsumerSetupFailedErrF ErrorIdentifier = 10029
382

383
        // JSMirrorDurableConsumerCfgInvalid stream mirror consumer config is invalid
384
        JSMirrorDurableConsumerCfgInvalid ErrorIdentifier = 10213
385

386
        // JSMirrorInvalidStreamName mirrored stream name is invalid
387
        JSMirrorInvalidStreamName ErrorIdentifier = 10142
388

389
        // JSMirrorInvalidSubjectFilter mirror transform source: {err}
390
        JSMirrorInvalidSubjectFilter ErrorIdentifier = 10151
391

392
        // JSMirrorInvalidTransformDestination mirror transform: {err}
393
        JSMirrorInvalidTransformDestination ErrorIdentifier = 10154
394

395
        // JSMirrorMaxMessageSizeTooBigErr stream mirror must have max message size >= source
396
        JSMirrorMaxMessageSizeTooBigErr ErrorIdentifier = 10030
397

398
        // JSMirrorMultipleFiltersNotAllowed mirror with multiple subject transforms cannot also have a single subject filter
399
        JSMirrorMultipleFiltersNotAllowed ErrorIdentifier = 10150
400

401
        // JSMirrorOverlappingSubjectFilters mirror subject filters can not overlap
402
        JSMirrorOverlappingSubjectFilters ErrorIdentifier = 10152
403

404
        // JSMirrorWithAtomicPublishErr stream mirrors can not also use atomic publishing
405
        JSMirrorWithAtomicPublishErr ErrorIdentifier = 10198
406

407
        // JSMirrorWithBatchPublishErr stream mirrors can not also use batch publishing
408
        JSMirrorWithBatchPublishErr ErrorIdentifier = 10209
409

410
        // JSMirrorWithCountersErr stream mirrors can not also calculate counters
411
        JSMirrorWithCountersErr ErrorIdentifier = 10173
412

413
        // JSMirrorWithFirstSeqErr stream mirrors can not have first sequence configured
414
        JSMirrorWithFirstSeqErr ErrorIdentifier = 10143
415

416
        // JSMirrorWithMsgSchedulesErr stream mirrors can not also schedule messages
417
        JSMirrorWithMsgSchedulesErr ErrorIdentifier = 10186
418

419
        // JSMirrorWithSourcesErr stream mirrors can not also contain other sources
420
        JSMirrorWithSourcesErr ErrorIdentifier = 10031
421

422
        // JSMirrorWithStartSeqAndTimeErr stream mirrors can not have both start seq and start time configured
423
        JSMirrorWithStartSeqAndTimeErr ErrorIdentifier = 10032
424

425
        // JSMirrorWithSubjectFiltersErr stream mirrors can not contain filtered subjects
426
        JSMirrorWithSubjectFiltersErr ErrorIdentifier = 10033
427

428
        // JSMirrorWithSubjectsErr stream mirrors can not contain subjects
429
        JSMirrorWithSubjectsErr ErrorIdentifier = 10034
430

431
        // JSNoAccountErr account not found
432
        JSNoAccountErr ErrorIdentifier = 10035
433

434
        // JSNoLimitsErr no JetStream default or applicable tiered limit present
435
        JSNoLimitsErr ErrorIdentifier = 10120
436

437
        // JSNoMessageFoundErr no message found
438
        JSNoMessageFoundErr ErrorIdentifier = 10037
439

440
        // JSNotEmptyRequestErr expected an empty request payload
441
        JSNotEmptyRequestErr ErrorIdentifier = 10038
442

443
        // JSNotEnabledErr JetStream not enabled
444
        JSNotEnabledErr ErrorIdentifier = 10076
445

446
        // JSNotEnabledForAccountErr JetStream not enabled for account
447
        JSNotEnabledForAccountErr ErrorIdentifier = 10039
448

449
        // JSPedanticErrF pedantic mode: {err}
450
        JSPedanticErrF ErrorIdentifier = 10157
451

452
        // JSPeerRemapErr peer remap failed
453
        JSPeerRemapErr ErrorIdentifier = 10075
454

455
        // JSRaftGeneralErrF General RAFT error string ({err})
456
        JSRaftGeneralErrF ErrorIdentifier = 10041
457

458
        // JSReplicasCountCannotBeNegative replicas count cannot be negative
459
        JSReplicasCountCannotBeNegative ErrorIdentifier = 10133
460

461
        // JSRequiredApiLevelErr JetStream minimum api level required
462
        JSRequiredApiLevelErr ErrorIdentifier = 10185
463

464
        // JSRestoreSubscribeFailedErrF JetStream unable to subscribe to restore snapshot {subject}: {err}
465
        JSRestoreSubscribeFailedErrF ErrorIdentifier = 10042
466

467
        // JSSequenceNotFoundErrF sequence {seq} not found
468
        JSSequenceNotFoundErrF ErrorIdentifier = 10043
469

470
        // JSSnapshotDeliverSubjectInvalidErr deliver subject not valid
471
        JSSnapshotDeliverSubjectInvalidErr ErrorIdentifier = 10015
472

473
        // JSSourceConsumerRequiresAckFCErr stream source consumer requires flow control ack policy
474
        JSSourceConsumerRequiresAckFCErr ErrorIdentifier = 10217
475

476
        // JSSourceConsumerSetupFailedErrF General source consumer setup failure string ({err})
477
        JSSourceConsumerSetupFailedErrF ErrorIdentifier = 10045
478

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

482
        // JSSourceDurableConsumerCfgInvalid stream source consumer config is invalid
483
        JSSourceDurableConsumerCfgInvalid ErrorIdentifier = 10215
484

485
        // JSSourceDurableConsumerDuplicateDetected duplicate stream source consumer detected
486
        JSSourceDurableConsumerDuplicateDetected ErrorIdentifier = 10216
487

488
        // JSSourceInvalidStreamName sourced stream name is invalid
489
        JSSourceInvalidStreamName ErrorIdentifier = 10141
490

491
        // JSSourceInvalidSubjectFilter source transform source: {err}
492
        JSSourceInvalidSubjectFilter ErrorIdentifier = 10145
493

494
        // JSSourceInvalidTransformDestination source transform: {err}
495
        JSSourceInvalidTransformDestination ErrorIdentifier = 10146
496

497
        // JSSourceMaxMessageSizeTooBigErr stream source must have max message size >= target
498
        JSSourceMaxMessageSizeTooBigErr ErrorIdentifier = 10046
499

500
        // JSSourceMultipleFiltersNotAllowed source with multiple subject transforms cannot also have a single subject filter
501
        JSSourceMultipleFiltersNotAllowed ErrorIdentifier = 10144
502

503
        // JSSourceOverlappingSubjectFilters source filters can not overlap
504
        JSSourceOverlappingSubjectFilters ErrorIdentifier = 10147
505

506
        // JSSourceWithMsgSchedulesErr stream source can not also schedule messages
507
        JSSourceWithMsgSchedulesErr ErrorIdentifier = 10187
508

509
        // JSStorageResourcesExceededErr insufficient storage resources available
510
        JSStorageResourcesExceededErr ErrorIdentifier = 10047
511

512
        // JSStreamAssignmentErrF Generic stream assignment error string ({err})
513
        JSStreamAssignmentErrF ErrorIdentifier = 10048
514

515
        // JSStreamCreateErrF Generic stream creation error string ({err})
516
        JSStreamCreateErrF ErrorIdentifier = 10049
517

518
        // JSStreamDeleteErrF General stream deletion error string ({err})
519
        JSStreamDeleteErrF ErrorIdentifier = 10050
520

521
        // JSStreamDuplicateMessageConflict duplicate message id is in process
522
        JSStreamDuplicateMessageConflict ErrorIdentifier = 10158
523

524
        // JSStreamExpectedLastSeqPerSubjectInvalid missing sequence for expected last sequence per subject
525
        JSStreamExpectedLastSeqPerSubjectInvalid ErrorIdentifier = 10193
526

527
        // JSStreamExpectedLastSeqPerSubjectNotReady expected last sequence per subject temporarily unavailable
528
        JSStreamExpectedLastSeqPerSubjectNotReady ErrorIdentifier = 10163
529

530
        // JSStreamExternalApiOverlapErrF stream external api prefix {prefix} must not overlap with {subject}
531
        JSStreamExternalApiOverlapErrF ErrorIdentifier = 10021
532

533
        // JSStreamExternalDelPrefixOverlapsErrF stream external delivery prefix {prefix} overlaps with stream subject {subject}
534
        JSStreamExternalDelPrefixOverlapsErrF ErrorIdentifier = 10022
535

536
        // JSStreamGeneralErrorF General stream failure string ({err})
537
        JSStreamGeneralErrorF ErrorIdentifier = 10051
538

539
        // JSStreamHeaderExceedsMaximumErr header size exceeds maximum allowed of 64k
540
        JSStreamHeaderExceedsMaximumErr ErrorIdentifier = 10097
541

542
        // JSStreamInfoMaxSubjectsErr subject details would exceed maximum allowed
543
        JSStreamInfoMaxSubjectsErr ErrorIdentifier = 10117
544

545
        // JSStreamInvalidConfigF Stream configuration validation error string ({err})
546
        JSStreamInvalidConfigF ErrorIdentifier = 10052
547

548
        // JSStreamInvalidErr stream not valid
549
        JSStreamInvalidErr ErrorIdentifier = 10096
550

551
        // JSStreamInvalidExternalDeliverySubjErrF stream external delivery prefix {prefix} must not contain wildcards
552
        JSStreamInvalidExternalDeliverySubjErrF ErrorIdentifier = 10024
553

554
        // JSStreamLimitsErrF General stream limits exceeded error string ({err})
555
        JSStreamLimitsErrF ErrorIdentifier = 10053
556

557
        // JSStreamMaxBytesRequired account requires a stream config to have max bytes set
558
        JSStreamMaxBytesRequired ErrorIdentifier = 10113
559

560
        // JSStreamMaxStreamBytesExceeded stream max bytes exceeds account limit max stream bytes
561
        JSStreamMaxStreamBytesExceeded ErrorIdentifier = 10122
562

563
        // JSStreamMessageExceedsMaximumErr message size exceeds maximum allowed
564
        JSStreamMessageExceedsMaximumErr ErrorIdentifier = 10054
565

566
        // JSStreamMinLastSeqErr min last sequence
567
        JSStreamMinLastSeqErr ErrorIdentifier = 10180
568

569
        // JSStreamMirrorNotUpdatableErr stream mirror configuration can not be updated
570
        JSStreamMirrorNotUpdatableErr ErrorIdentifier = 10055
571

572
        // JSStreamMismatchErr stream name in subject does not match request
573
        JSStreamMismatchErr ErrorIdentifier = 10056
574

575
        // JSStreamMoveAndScaleErr can not move and scale a stream in a single update
576
        JSStreamMoveAndScaleErr ErrorIdentifier = 10123
577

578
        // JSStreamMoveInProgressF stream move already in progress: {msg}
579
        JSStreamMoveInProgressF ErrorIdentifier = 10124
580

581
        // JSStreamMoveNotInProgress stream move not in progress
582
        JSStreamMoveNotInProgress ErrorIdentifier = 10129
583

584
        // JSStreamMsgDeleteFailedF Generic message deletion failure error string ({err})
585
        JSStreamMsgDeleteFailedF ErrorIdentifier = 10057
586

587
        // JSStreamNameContainsPathSeparatorsErr Stream name can not contain path separators
588
        JSStreamNameContainsPathSeparatorsErr ErrorIdentifier = 10128
589

590
        // JSStreamNameExistErr stream name already in use with a different configuration
591
        JSStreamNameExistErr ErrorIdentifier = 10058
592

593
        // JSStreamNameExistRestoreFailedErr stream name already in use, cannot restore
594
        JSStreamNameExistRestoreFailedErr ErrorIdentifier = 10130
595

596
        // JSStreamNotFoundErr stream not found
597
        JSStreamNotFoundErr ErrorIdentifier = 10059
598

599
        // JSStreamNotMatchErr expected stream does not match
600
        JSStreamNotMatchErr ErrorIdentifier = 10060
601

602
        // JSStreamOfflineErr stream is offline
603
        JSStreamOfflineErr ErrorIdentifier = 10118
604

605
        // JSStreamOfflineReasonErrF stream is offline: {err}
606
        JSStreamOfflineReasonErrF ErrorIdentifier = 10194
607

608
        // JSStreamPurgeFailedF Generic stream purge failure error string ({err})
609
        JSStreamPurgeFailedF ErrorIdentifier = 10110
610

611
        // JSStreamReplicasNotSupportedErr replicas > 1 not supported in non-clustered mode
612
        JSStreamReplicasNotSupportedErr ErrorIdentifier = 10074
613

614
        // JSStreamReplicasNotUpdatableErr Replicas configuration can not be updated
615
        JSStreamReplicasNotUpdatableErr ErrorIdentifier = 10061
616

617
        // JSStreamRestoreErrF restore failed: {err}
618
        JSStreamRestoreErrF ErrorIdentifier = 10062
619

620
        // JSStreamRollupFailedF Generic stream rollup failure error string ({err})
621
        JSStreamRollupFailedF ErrorIdentifier = 10111
622

623
        // JSStreamSealedErr invalid operation on sealed stream
624
        JSStreamSealedErr ErrorIdentifier = 10109
625

626
        // JSStreamSequenceNotMatchErr expected stream sequence does not match
627
        JSStreamSequenceNotMatchErr ErrorIdentifier = 10063
628

629
        // JSStreamSnapshotErrF snapshot failed: {err}
630
        JSStreamSnapshotErrF ErrorIdentifier = 10064
631

632
        // JSStreamStoreFailedF Generic error when storing a message failed ({err})
633
        JSStreamStoreFailedF ErrorIdentifier = 10077
634

635
        // JSStreamSubjectOverlapErr subjects overlap with an existing stream
636
        JSStreamSubjectOverlapErr ErrorIdentifier = 10065
637

638
        // JSStreamTemplateCreateErrF Generic template creation failed string ({err})
639
        JSStreamTemplateCreateErrF ErrorIdentifier = 10066
640

641
        // JSStreamTemplateDeleteErrF Generic stream template deletion failed error string ({err})
642
        JSStreamTemplateDeleteErrF ErrorIdentifier = 10067
643

644
        // JSStreamTemplateNotFoundErr template not found
645
        JSStreamTemplateNotFoundErr ErrorIdentifier = 10068
646

647
        // JSStreamTooManyRequests too many requests
648
        JSStreamTooManyRequests ErrorIdentifier = 10167
649

650
        // JSStreamTransformInvalidDestination stream transform: {err}
651
        JSStreamTransformInvalidDestination ErrorIdentifier = 10156
652

653
        // JSStreamTransformInvalidSource stream transform source: {err}
654
        JSStreamTransformInvalidSource ErrorIdentifier = 10155
655

656
        // JSStreamUpdateErrF Generic stream update error string ({err})
657
        JSStreamUpdateErrF ErrorIdentifier = 10069
658

659
        // JSStreamWrongLastMsgIDErrF wrong last msg ID: {id}
660
        JSStreamWrongLastMsgIDErrF ErrorIdentifier = 10070
661

662
        // JSStreamWrongLastSequenceConstantErr wrong last sequence
663
        JSStreamWrongLastSequenceConstantErr ErrorIdentifier = 10164
664

665
        // JSStreamWrongLastSequenceErrF wrong last sequence: {seq}
666
        JSStreamWrongLastSequenceErrF ErrorIdentifier = 10071
667

668
        // JSTempStorageFailedErr JetStream unable to open temp storage for restore
669
        JSTempStorageFailedErr ErrorIdentifier = 10072
670

671
        // JSTemplateNameNotMatchSubjectErr template name in subject does not match request
672
        JSTemplateNameNotMatchSubjectErr ErrorIdentifier = 10073
673
)
674

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

924
// NewJSAccountResourcesExceededError creates a new JSAccountResourcesExceededErr error: "resource limits exceeded for account"
925
func NewJSAccountResourcesExceededError(opts ...ErrorOption) *ApiError {
20,067✔
926
        eopts := parseOpts(opts)
20,067✔
927
        if ae, ok := eopts.err.(*ApiError); ok {
20,067✔
928
                return ae
×
929
        }
×
930

931
        return ApiErrors[JSAccountResourcesExceededErr]
20,067✔
932
}
933

934
// NewJSAtomicPublishContainsDuplicateMessageError creates a new JSAtomicPublishContainsDuplicateMessageErr error: "atomic publish batch contains duplicate message id"
935
func NewJSAtomicPublishContainsDuplicateMessageError(opts ...ErrorOption) *ApiError {
21,978✔
936
        eopts := parseOpts(opts)
21,978✔
937
        if ae, ok := eopts.err.(*ApiError); ok {
21,978✔
938
                return ae
×
939
        }
×
940

941
        return ApiErrors[JSAtomicPublishContainsDuplicateMessageErr]
21,978✔
942
}
943

944
// NewJSAtomicPublishDisabledError creates a new JSAtomicPublishDisabledErr error: "atomic publish is disabled"
945
func NewJSAtomicPublishDisabledError(opts ...ErrorOption) *ApiError {
24✔
946
        eopts := parseOpts(opts)
24✔
947
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
948
                return ae
×
949
        }
×
950

951
        return ApiErrors[JSAtomicPublishDisabledErr]
24✔
952
}
953

954
// NewJSAtomicPublishIncompleteBatchError creates a new JSAtomicPublishIncompleteBatchErr error: "atomic publish batch is incomplete"
955
func NewJSAtomicPublishIncompleteBatchError(opts ...ErrorOption) *ApiError {
78✔
956
        eopts := parseOpts(opts)
78✔
957
        if ae, ok := eopts.err.(*ApiError); ok {
78✔
958
                return ae
×
959
        }
×
960

961
        return ApiErrors[JSAtomicPublishIncompleteBatchErr]
78✔
962
}
963

964
// NewJSAtomicPublishInvalidBatchCommitError creates a new JSAtomicPublishInvalidBatchCommitErr error: "atomic publish batch commit is invalid"
965
func NewJSAtomicPublishInvalidBatchCommitError(opts ...ErrorOption) *ApiError {
6✔
966
        eopts := parseOpts(opts)
6✔
967
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
968
                return ae
×
969
        }
×
970

971
        return ApiErrors[JSAtomicPublishInvalidBatchCommitErr]
6✔
972
}
973

974
// NewJSAtomicPublishInvalidBatchIDError creates a new JSAtomicPublishInvalidBatchIDErr error: "atomic publish batch ID is invalid"
975
func NewJSAtomicPublishInvalidBatchIDError(opts ...ErrorOption) *ApiError {
4✔
976
        eopts := parseOpts(opts)
4✔
977
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
978
                return ae
×
979
        }
×
980

981
        return ApiErrors[JSAtomicPublishInvalidBatchIDErr]
4✔
982
}
983

984
// NewJSAtomicPublishMissingSeqError creates a new JSAtomicPublishMissingSeqErr error: "atomic publish sequence is missing"
985
func NewJSAtomicPublishMissingSeqError(opts ...ErrorOption) *ApiError {
24✔
986
        eopts := parseOpts(opts)
24✔
987
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
988
                return ae
×
989
        }
×
990

991
        return ApiErrors[JSAtomicPublishMissingSeqErr]
24✔
992
}
993

994
// NewJSAtomicPublishTooLargeBatchError creates a new JSAtomicPublishTooLargeBatchErrF error: "atomic publish batch is too large: {size}"
995
func NewJSAtomicPublishTooLargeBatchError(size interface{}, opts ...ErrorOption) *ApiError {
10✔
996
        eopts := parseOpts(opts)
10✔
997
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
998
                return ae
×
999
        }
×
1000

1001
        e := ApiErrors[JSAtomicPublishTooLargeBatchErrF]
10✔
1002
        args := e.toReplacerArgs([]interface{}{"{size}", size})
10✔
1003
        return &ApiError{
10✔
1004
                Code:        e.Code,
10✔
1005
                ErrCode:     e.ErrCode,
10✔
1006
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1007
        }
10✔
1008
}
1009

1010
// NewJSAtomicPublishTooManyInflightError creates a new JSAtomicPublishTooManyInflight error: "atomic publish too many inflight"
1011
func NewJSAtomicPublishTooManyInflightError(opts ...ErrorOption) *ApiError {
8✔
1012
        eopts := parseOpts(opts)
8✔
1013
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1014
                return ae
×
1015
        }
×
1016

1017
        return ApiErrors[JSAtomicPublishTooManyInflight]
8✔
1018
}
1019

1020
// NewJSAtomicPublishUnsupportedHeaderBatchError creates a new JSAtomicPublishUnsupportedHeaderBatchErr error: "atomic publish unsupported header used: {header}"
1021
func NewJSAtomicPublishUnsupportedHeaderBatchError(header interface{}, opts ...ErrorOption) *ApiError {
4✔
1022
        eopts := parseOpts(opts)
4✔
1023
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1024
                return ae
×
1025
        }
×
1026

1027
        e := ApiErrors[JSAtomicPublishUnsupportedHeaderBatchErr]
4✔
1028
        args := e.toReplacerArgs([]interface{}{"{header}", header})
4✔
1029
        return &ApiError{
4✔
1030
                Code:        e.Code,
4✔
1031
                ErrCode:     e.ErrCode,
4✔
1032
                Description: strings.NewReplacer(args...).Replace(e.Description),
4✔
1033
        }
4✔
1034
}
1035

1036
// NewJSBadRequestError creates a new JSBadRequestErr error: "bad request"
1037
func NewJSBadRequestError(opts ...ErrorOption) *ApiError {
10✔
1038
        eopts := parseOpts(opts)
10✔
1039
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1040
                return ae
×
1041
        }
×
1042

1043
        return ApiErrors[JSBadRequestErr]
10✔
1044
}
1045

1046
// NewJSBatchPublishDisabledError creates a new JSBatchPublishDisabledErr error: "batch publish is disabled"
1047
func NewJSBatchPublishDisabledError(opts ...ErrorOption) *ApiError {
24✔
1048
        eopts := parseOpts(opts)
24✔
1049
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
1050
                return ae
×
1051
        }
×
1052

1053
        return ApiErrors[JSBatchPublishDisabledErr]
24✔
1054
}
1055

1056
// NewJSBatchPublishInvalidBatchIDError creates a new JSBatchPublishInvalidBatchIDErr error: "batch publish ID is invalid"
1057
func NewJSBatchPublishInvalidBatchIDError(opts ...ErrorOption) *ApiError {
28✔
1058
        eopts := parseOpts(opts)
28✔
1059
        if ae, ok := eopts.err.(*ApiError); ok {
28✔
1060
                return ae
×
1061
        }
×
1062

1063
        return ApiErrors[JSBatchPublishInvalidBatchIDErr]
28✔
1064
}
1065

1066
// NewJSBatchPublishInvalidPatternError creates a new JSBatchPublishInvalidPatternErr error: "batch publish pattern is invalid"
1067
func NewJSBatchPublishInvalidPatternError(opts ...ErrorOption) *ApiError {
56✔
1068
        eopts := parseOpts(opts)
56✔
1069
        if ae, ok := eopts.err.(*ApiError); ok {
56✔
1070
                return ae
×
1071
        }
×
1072

1073
        return ApiErrors[JSBatchPublishInvalidPatternErr]
56✔
1074
}
1075

1076
// NewJSBatchPublishTooManyInflightError creates a new JSBatchPublishTooManyInflight error: "batch publish too many inflight"
1077
func NewJSBatchPublishTooManyInflightError(opts ...ErrorOption) *ApiError {
8✔
1078
        eopts := parseOpts(opts)
8✔
1079
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1080
                return ae
×
1081
        }
×
1082

1083
        return ApiErrors[JSBatchPublishTooManyInflight]
8✔
1084
}
1085

1086
// NewJSBatchPublishUnknownBatchIDError creates a new JSBatchPublishUnknownBatchIDErr error: "batch publish ID unknown"
1087
func NewJSBatchPublishUnknownBatchIDError(opts ...ErrorOption) *ApiError {
28✔
1088
        eopts := parseOpts(opts)
28✔
1089
        if ae, ok := eopts.err.(*ApiError); ok {
28✔
1090
                return ae
×
1091
        }
×
1092

1093
        return ApiErrors[JSBatchPublishUnknownBatchIDErr]
28✔
1094
}
1095

1096
// NewJSClusterIncompleteError creates a new JSClusterIncompleteErr error: "incomplete results"
1097
func NewJSClusterIncompleteError(opts ...ErrorOption) *ApiError {
×
1098
        eopts := parseOpts(opts)
×
1099
        if ae, ok := eopts.err.(*ApiError); ok {
×
1100
                return ae
×
1101
        }
×
1102

1103
        return ApiErrors[JSClusterIncompleteErr]
×
1104
}
1105

1106
// NewJSClusterNoPeersError creates a new JSClusterNoPeersErrF error: "{err}"
1107
func NewJSClusterNoPeersError(err error, opts ...ErrorOption) *ApiError {
57✔
1108
        eopts := parseOpts(opts)
57✔
1109
        if ae, ok := eopts.err.(*ApiError); ok {
57✔
1110
                return ae
×
1111
        }
×
1112

1113
        e := ApiErrors[JSClusterNoPeersErrF]
57✔
1114
        args := e.toReplacerArgs([]interface{}{"{err}", err})
57✔
1115
        return &ApiError{
57✔
1116
                Code:        e.Code,
57✔
1117
                ErrCode:     e.ErrCode,
57✔
1118
                Description: strings.NewReplacer(args...).Replace(e.Description),
57✔
1119
        }
57✔
1120
}
1121

1122
// NewJSClusterNotActiveError creates a new JSClusterNotActiveErr error: "JetStream not in clustered mode"
1123
func NewJSClusterNotActiveError(opts ...ErrorOption) *ApiError {
2✔
1124
        eopts := parseOpts(opts)
2✔
1125
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1126
                return ae
×
1127
        }
×
1128

1129
        return ApiErrors[JSClusterNotActiveErr]
2✔
1130
}
1131

1132
// NewJSClusterNotAssignedError creates a new JSClusterNotAssignedErr error: "JetStream cluster not assigned to this server"
1133
func NewJSClusterNotAssignedError(opts ...ErrorOption) *ApiError {
2✔
1134
        eopts := parseOpts(opts)
2✔
1135
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1136
                return ae
×
1137
        }
×
1138

1139
        return ApiErrors[JSClusterNotAssignedErr]
2✔
1140
}
1141

1142
// NewJSClusterNotAvailError creates a new JSClusterNotAvailErr error: "JetStream system temporarily unavailable"
1143
func NewJSClusterNotAvailError(opts ...ErrorOption) *ApiError {
13✔
1144
        eopts := parseOpts(opts)
13✔
1145
        if ae, ok := eopts.err.(*ApiError); ok {
13✔
1146
                return ae
×
1147
        }
×
1148

1149
        return ApiErrors[JSClusterNotAvailErr]
13✔
1150
}
1151

1152
// NewJSClusterNotLeaderError creates a new JSClusterNotLeaderErr error: "JetStream cluster can not handle request"
1153
func NewJSClusterNotLeaderError(opts ...ErrorOption) *ApiError {
1,324✔
1154
        eopts := parseOpts(opts)
1,324✔
1155
        if ae, ok := eopts.err.(*ApiError); ok {
1,324✔
1156
                return ae
×
1157
        }
×
1158

1159
        return ApiErrors[JSClusterNotLeaderErr]
1,324✔
1160
}
1161

1162
// NewJSClusterPeerNotMemberError creates a new JSClusterPeerNotMemberErr error: "peer not a member"
1163
func NewJSClusterPeerNotMemberError(opts ...ErrorOption) *ApiError {
1✔
1164
        eopts := parseOpts(opts)
1✔
1165
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1166
                return ae
×
1167
        }
×
1168

1169
        return ApiErrors[JSClusterPeerNotMemberErr]
1✔
1170
}
1171

1172
// NewJSClusterRequiredError creates a new JSClusterRequiredErr error: "JetStream clustering support required"
1173
func NewJSClusterRequiredError(opts ...ErrorOption) *ApiError {
6✔
1174
        eopts := parseOpts(opts)
6✔
1175
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1176
                return ae
×
1177
        }
×
1178

1179
        return ApiErrors[JSClusterRequiredErr]
6✔
1180
}
1181

1182
// NewJSClusterServerMemberChangeInflightError creates a new JSClusterServerMemberChangeInflightErr error: "cluster member change is in progress"
1183
func NewJSClusterServerMemberChangeInflightError(opts ...ErrorOption) *ApiError {
6✔
1184
        eopts := parseOpts(opts)
6✔
1185
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1186
                return ae
×
1187
        }
×
1188

1189
        return ApiErrors[JSClusterServerMemberChangeInflightErr]
6✔
1190
}
1191

1192
// NewJSClusterServerNotMemberError creates a new JSClusterServerNotMemberErr error: "server is not a member of the cluster"
1193
func NewJSClusterServerNotMemberError(opts ...ErrorOption) *ApiError {
6✔
1194
        eopts := parseOpts(opts)
6✔
1195
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1196
                return ae
×
1197
        }
×
1198

1199
        return ApiErrors[JSClusterServerNotMemberErr]
6✔
1200
}
1201

1202
// NewJSClusterTagsError creates a new JSClusterTagsErr error: "tags placement not supported for operation"
1203
func NewJSClusterTagsError(opts ...ErrorOption) *ApiError {
×
1204
        eopts := parseOpts(opts)
×
1205
        if ae, ok := eopts.err.(*ApiError); ok {
×
1206
                return ae
×
1207
        }
×
1208

1209
        return ApiErrors[JSClusterTagsErr]
×
1210
}
1211

1212
// NewJSClusterUnSupportFeatureError creates a new JSClusterUnSupportFeatureErr error: "not currently supported in clustered mode"
1213
func NewJSClusterUnSupportFeatureError(opts ...ErrorOption) *ApiError {
×
1214
        eopts := parseOpts(opts)
×
1215
        if ae, ok := eopts.err.(*ApiError); ok {
×
1216
                return ae
×
1217
        }
×
1218

1219
        return ApiErrors[JSClusterUnSupportFeatureErr]
×
1220
}
1221

1222
// NewJSConsumerAckFCRequiresFCError creates a new JSConsumerAckFCRequiresFCErr error: "flow control ack policy requires flow control"
1223
func NewJSConsumerAckFCRequiresFCError(opts ...ErrorOption) *ApiError {
4✔
1224
        eopts := parseOpts(opts)
4✔
1225
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1226
                return ae
×
1227
        }
×
1228

1229
        return ApiErrors[JSConsumerAckFCRequiresFCErr]
4✔
1230
}
1231

1232
// NewJSConsumerAckFCRequiresMaxAckPendingError creates a new JSConsumerAckFCRequiresMaxAckPendingErr error: "flow control ack policy requires max ack pending"
1233
func NewJSConsumerAckFCRequiresMaxAckPendingError(opts ...ErrorOption) *ApiError {
4✔
1234
        eopts := parseOpts(opts)
4✔
1235
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1236
                return ae
×
1237
        }
×
1238

1239
        return ApiErrors[JSConsumerAckFCRequiresMaxAckPendingErr]
4✔
1240
}
1241

1242
// NewJSConsumerAckFCRequiresNoAckWaitError creates a new JSConsumerAckFCRequiresNoAckWaitErr error: "flow control ack policy requires unset ack wait"
1243
func NewJSConsumerAckFCRequiresNoAckWaitError(opts ...ErrorOption) *ApiError {
8✔
1244
        eopts := parseOpts(opts)
8✔
1245
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1246
                return ae
×
1247
        }
×
1248

1249
        return ApiErrors[JSConsumerAckFCRequiresNoAckWaitErr]
8✔
1250
}
1251

1252
// NewJSConsumerAckFCRequiresNoMaxDeliverError creates a new JSConsumerAckFCRequiresNoMaxDeliverErr error: "flow control ack policy requires unset max deliver"
1253
func NewJSConsumerAckFCRequiresNoMaxDeliverError(opts ...ErrorOption) *ApiError {
4✔
1254
        eopts := parseOpts(opts)
4✔
1255
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1256
                return ae
×
1257
        }
×
1258

1259
        return ApiErrors[JSConsumerAckFCRequiresNoMaxDeliverErr]
4✔
1260
}
1261

1262
// NewJSConsumerAckFCRequiresPushError creates a new JSConsumerAckFCRequiresPushErr error: "flow control ack policy requires a push based consumer"
1263
func NewJSConsumerAckFCRequiresPushError(opts ...ErrorOption) *ApiError {
4✔
1264
        eopts := parseOpts(opts)
4✔
1265
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1266
                return ae
×
1267
        }
×
1268

1269
        return ApiErrors[JSConsumerAckFCRequiresPushErr]
4✔
1270
}
1271

1272
// NewJSConsumerAckPolicyInvalidError creates a new JSConsumerAckPolicyInvalidErr error: "consumer ack policy invalid"
1273
func NewJSConsumerAckPolicyInvalidError(opts ...ErrorOption) *ApiError {
2✔
1274
        eopts := parseOpts(opts)
2✔
1275
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1276
                return ae
×
1277
        }
×
1278

1279
        return ApiErrors[JSConsumerAckPolicyInvalidErr]
2✔
1280
}
1281

1282
// NewJSConsumerAckWaitNegativeError creates a new JSConsumerAckWaitNegativeErr error: "consumer ack wait needs to be positive"
1283
func NewJSConsumerAckWaitNegativeError(opts ...ErrorOption) *ApiError {
2✔
1284
        eopts := parseOpts(opts)
2✔
1285
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1286
                return ae
×
1287
        }
×
1288

1289
        return ApiErrors[JSConsumerAckWaitNegativeErr]
2✔
1290
}
1291

1292
// NewJSConsumerAlreadyExistsError creates a new JSConsumerAlreadyExists error: "consumer already exists"
1293
func NewJSConsumerAlreadyExistsError(opts ...ErrorOption) *ApiError {
5✔
1294
        eopts := parseOpts(opts)
5✔
1295
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
1296
                return ae
×
1297
        }
×
1298

1299
        return ApiErrors[JSConsumerAlreadyExists]
5✔
1300
}
1301

1302
// NewJSConsumerBackOffNegativeError creates a new JSConsumerBackOffNegativeErr error: "consumer backoff needs to be positive"
1303
func NewJSConsumerBackOffNegativeError(opts ...ErrorOption) *ApiError {
2✔
1304
        eopts := parseOpts(opts)
2✔
1305
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1306
                return ae
×
1307
        }
×
1308

1309
        return ApiErrors[JSConsumerBackOffNegativeErr]
2✔
1310
}
1311

1312
// NewJSConsumerBadDurableNameError creates a new JSConsumerBadDurableNameErr error: "durable name can not contain '.', '*', '>'"
1313
func NewJSConsumerBadDurableNameError(opts ...ErrorOption) *ApiError {
×
1314
        eopts := parseOpts(opts)
×
1315
        if ae, ok := eopts.err.(*ApiError); ok {
×
1316
                return ae
×
1317
        }
×
1318

1319
        return ApiErrors[JSConsumerBadDurableNameErr]
×
1320
}
1321

1322
// NewJSConsumerConfigRequiredError creates a new JSConsumerConfigRequiredErr error: "consumer config required"
1323
func NewJSConsumerConfigRequiredError(opts ...ErrorOption) *ApiError {
2✔
1324
        eopts := parseOpts(opts)
2✔
1325
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1326
                return ae
×
1327
        }
×
1328

1329
        return ApiErrors[JSConsumerConfigRequiredErr]
2✔
1330
}
1331

1332
// NewJSConsumerCreateDurableAndNameMismatchError creates a new JSConsumerCreateDurableAndNameMismatch error: "Consumer Durable and Name have to be equal if both are provided"
1333
func NewJSConsumerCreateDurableAndNameMismatchError(opts ...ErrorOption) *ApiError {
1✔
1334
        eopts := parseOpts(opts)
1✔
1335
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1336
                return ae
×
1337
        }
×
1338

1339
        return ApiErrors[JSConsumerCreateDurableAndNameMismatch]
1✔
1340
}
1341

1342
// NewJSConsumerCreateError creates a new JSConsumerCreateErrF error: "{err}"
1343
func NewJSConsumerCreateError(err error, opts ...ErrorOption) *ApiError {
75✔
1344
        eopts := parseOpts(opts)
75✔
1345
        if ae, ok := eopts.err.(*ApiError); ok {
132✔
1346
                return ae
57✔
1347
        }
57✔
1348

1349
        e := ApiErrors[JSConsumerCreateErrF]
18✔
1350
        args := e.toReplacerArgs([]interface{}{"{err}", err})
18✔
1351
        return &ApiError{
18✔
1352
                Code:        e.Code,
18✔
1353
                ErrCode:     e.ErrCode,
18✔
1354
                Description: strings.NewReplacer(args...).Replace(e.Description),
18✔
1355
        }
18✔
1356
}
1357

1358
// NewJSConsumerCreateFilterSubjectMismatchError creates a new JSConsumerCreateFilterSubjectMismatchErr error: "Consumer create request did not match filtered subject from create subject"
1359
func NewJSConsumerCreateFilterSubjectMismatchError(opts ...ErrorOption) *ApiError {
2✔
1360
        eopts := parseOpts(opts)
2✔
1361
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1362
                return ae
×
1363
        }
×
1364

1365
        return ApiErrors[JSConsumerCreateFilterSubjectMismatchErr]
2✔
1366
}
1367

1368
// NewJSConsumerDeliverCycleError creates a new JSConsumerDeliverCycleErr error: "consumer deliver subject forms a cycle"
1369
func NewJSConsumerDeliverCycleError(opts ...ErrorOption) *ApiError {
4✔
1370
        eopts := parseOpts(opts)
4✔
1371
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1372
                return ae
×
1373
        }
×
1374

1375
        return ApiErrors[JSConsumerDeliverCycleErr]
4✔
1376
}
1377

1378
// NewJSConsumerDeliverToWildcardsError creates a new JSConsumerDeliverToWildcardsErr error: "consumer deliver subject has wildcards"
1379
func NewJSConsumerDeliverToWildcardsError(opts ...ErrorOption) *ApiError {
4✔
1380
        eopts := parseOpts(opts)
4✔
1381
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1382
                return ae
×
1383
        }
×
1384

1385
        return ApiErrors[JSConsumerDeliverToWildcardsErr]
4✔
1386
}
1387

1388
// NewJSConsumerDescriptionTooLongError creates a new JSConsumerDescriptionTooLongErrF error: "consumer description is too long, maximum allowed is {max}"
1389
func NewJSConsumerDescriptionTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
1✔
1390
        eopts := parseOpts(opts)
1✔
1391
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1392
                return ae
×
1393
        }
×
1394

1395
        e := ApiErrors[JSConsumerDescriptionTooLongErrF]
1✔
1396
        args := e.toReplacerArgs([]interface{}{"{max}", max})
1✔
1397
        return &ApiError{
1✔
1398
                Code:        e.Code,
1✔
1399
                ErrCode:     e.ErrCode,
1✔
1400
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1401
        }
1✔
1402
}
1403

1404
// NewJSConsumerDirectRequiresEphemeralError creates a new JSConsumerDirectRequiresEphemeralErr error: "consumer direct requires an ephemeral consumer"
1405
func NewJSConsumerDirectRequiresEphemeralError(opts ...ErrorOption) *ApiError {
×
1406
        eopts := parseOpts(opts)
×
1407
        if ae, ok := eopts.err.(*ApiError); ok {
×
1408
                return ae
×
1409
        }
×
1410

1411
        return ApiErrors[JSConsumerDirectRequiresEphemeralErr]
×
1412
}
1413

1414
// NewJSConsumerDirectRequiresPushError creates a new JSConsumerDirectRequiresPushErr error: "consumer direct requires a push based consumer"
1415
func NewJSConsumerDirectRequiresPushError(opts ...ErrorOption) *ApiError {
×
1416
        eopts := parseOpts(opts)
×
1417
        if ae, ok := eopts.err.(*ApiError); ok {
×
1418
                return ae
×
1419
        }
×
1420

1421
        return ApiErrors[JSConsumerDirectRequiresPushErr]
×
1422
}
1423

1424
// NewJSConsumerDoesNotExistError creates a new JSConsumerDoesNotExist error: "consumer does not exist"
1425
func NewJSConsumerDoesNotExistError(opts ...ErrorOption) *ApiError {
3✔
1426
        eopts := parseOpts(opts)
3✔
1427
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1428
                return ae
×
1429
        }
×
1430

1431
        return ApiErrors[JSConsumerDoesNotExist]
3✔
1432
}
1433

1434
// NewJSConsumerDuplicateFilterSubjectsError creates a new JSConsumerDuplicateFilterSubjects error: "consumer cannot have both FilterSubject and FilterSubjects specified"
1435
func NewJSConsumerDuplicateFilterSubjectsError(opts ...ErrorOption) *ApiError {
1✔
1436
        eopts := parseOpts(opts)
1✔
1437
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1438
                return ae
×
1439
        }
×
1440

1441
        return ApiErrors[JSConsumerDuplicateFilterSubjects]
1✔
1442
}
1443

1444
// NewJSConsumerDurableNameNotInSubjectError creates a new JSConsumerDurableNameNotInSubjectErr error: "consumer expected to be durable but no durable name set in subject"
1445
func NewJSConsumerDurableNameNotInSubjectError(opts ...ErrorOption) *ApiError {
×
1446
        eopts := parseOpts(opts)
×
1447
        if ae, ok := eopts.err.(*ApiError); ok {
×
1448
                return ae
×
1449
        }
×
1450

1451
        return ApiErrors[JSConsumerDurableNameNotInSubjectErr]
×
1452
}
1453

1454
// NewJSConsumerDurableNameNotMatchSubjectError creates a new JSConsumerDurableNameNotMatchSubjectErr error: "consumer name in subject does not match durable name in request"
1455
func NewJSConsumerDurableNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
×
1456
        eopts := parseOpts(opts)
×
1457
        if ae, ok := eopts.err.(*ApiError); ok {
×
1458
                return ae
×
1459
        }
×
1460

1461
        return ApiErrors[JSConsumerDurableNameNotMatchSubjectErr]
×
1462
}
1463

1464
// NewJSConsumerDurableNameNotSetError creates a new JSConsumerDurableNameNotSetErr error: "consumer expected to be durable but a durable name was not set"
1465
func NewJSConsumerDurableNameNotSetError(opts ...ErrorOption) *ApiError {
1✔
1466
        eopts := parseOpts(opts)
1✔
1467
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1468
                return ae
×
1469
        }
×
1470

1471
        return ApiErrors[JSConsumerDurableNameNotSetErr]
1✔
1472
}
1473

1474
// NewJSConsumerEmptyFilterError creates a new JSConsumerEmptyFilter error: "consumer filter in FilterSubjects cannot be empty"
1475
func NewJSConsumerEmptyFilterError(opts ...ErrorOption) *ApiError {
1✔
1476
        eopts := parseOpts(opts)
1✔
1477
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1478
                return ae
×
1479
        }
×
1480

1481
        return ApiErrors[JSConsumerEmptyFilter]
1✔
1482
}
1483

1484
// NewJSConsumerEmptyGroupNameError creates a new JSConsumerEmptyGroupName error: "Group name cannot be an empty string"
1485
func NewJSConsumerEmptyGroupNameError(opts ...ErrorOption) *ApiError {
4✔
1486
        eopts := parseOpts(opts)
4✔
1487
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1488
                return ae
×
1489
        }
×
1490

1491
        return ApiErrors[JSConsumerEmptyGroupName]
4✔
1492
}
1493

1494
// NewJSConsumerEphemeralWithDurableInSubjectError creates a new JSConsumerEphemeralWithDurableInSubjectErr error: "consumer expected to be ephemeral but detected a durable name set in subject"
1495
func NewJSConsumerEphemeralWithDurableInSubjectError(opts ...ErrorOption) *ApiError {
×
1496
        eopts := parseOpts(opts)
×
1497
        if ae, ok := eopts.err.(*ApiError); ok {
×
1498
                return ae
×
1499
        }
×
1500

1501
        return ApiErrors[JSConsumerEphemeralWithDurableInSubjectErr]
×
1502
}
1503

1504
// NewJSConsumerEphemeralWithDurableNameError creates a new JSConsumerEphemeralWithDurableNameErr error: "consumer expected to be ephemeral but a durable name was set in request"
1505
func NewJSConsumerEphemeralWithDurableNameError(opts ...ErrorOption) *ApiError {
3✔
1506
        eopts := parseOpts(opts)
3✔
1507
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1508
                return ae
×
1509
        }
×
1510

1511
        return ApiErrors[JSConsumerEphemeralWithDurableNameErr]
3✔
1512
}
1513

1514
// NewJSConsumerExistingActiveError creates a new JSConsumerExistingActiveErr error: "consumer already exists and is still active"
1515
func NewJSConsumerExistingActiveError(opts ...ErrorOption) *ApiError {
×
1516
        eopts := parseOpts(opts)
×
1517
        if ae, ok := eopts.err.(*ApiError); ok {
×
1518
                return ae
×
1519
        }
×
1520

1521
        return ApiErrors[JSConsumerExistingActiveErr]
×
1522
}
1523

1524
// NewJSConsumerFCRequiresPushError creates a new JSConsumerFCRequiresPushErr error: "consumer flow control requires a push based consumer"
1525
func NewJSConsumerFCRequiresPushError(opts ...ErrorOption) *ApiError {
×
1526
        eopts := parseOpts(opts)
×
1527
        if ae, ok := eopts.err.(*ApiError); ok {
×
1528
                return ae
×
1529
        }
×
1530

1531
        return ApiErrors[JSConsumerFCRequiresPushErr]
×
1532
}
1533

1534
// NewJSConsumerFilterNotSubsetError creates a new JSConsumerFilterNotSubsetErr error: "consumer filter subject is not a valid subset of the interest subjects"
1535
func NewJSConsumerFilterNotSubsetError(opts ...ErrorOption) *ApiError {
×
1536
        eopts := parseOpts(opts)
×
1537
        if ae, ok := eopts.err.(*ApiError); ok {
×
1538
                return ae
×
1539
        }
×
1540

1541
        return ApiErrors[JSConsumerFilterNotSubsetErr]
×
1542
}
1543

1544
// NewJSConsumerHBRequiresPushError creates a new JSConsumerHBRequiresPushErr error: "consumer idle heartbeat requires a push based consumer"
1545
func NewJSConsumerHBRequiresPushError(opts ...ErrorOption) *ApiError {
×
1546
        eopts := parseOpts(opts)
×
1547
        if ae, ok := eopts.err.(*ApiError); ok {
×
1548
                return ae
×
1549
        }
×
1550

1551
        return ApiErrors[JSConsumerHBRequiresPushErr]
×
1552
}
1553

1554
// NewJSConsumerInactiveThresholdExcessError creates a new JSConsumerInactiveThresholdExcess error: "consumer inactive threshold exceeds system limit of {limit}"
1555
func NewJSConsumerInactiveThresholdExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
2✔
1556
        eopts := parseOpts(opts)
2✔
1557
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1558
                return ae
×
1559
        }
×
1560

1561
        e := ApiErrors[JSConsumerInactiveThresholdExcess]
2✔
1562
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
2✔
1563
        return &ApiError{
2✔
1564
                Code:        e.Code,
2✔
1565
                ErrCode:     e.ErrCode,
2✔
1566
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1567
        }
2✔
1568
}
1569

1570
// NewJSConsumerInvalidDeliverSubjectError creates a new JSConsumerInvalidDeliverSubject error: "invalid push consumer deliver subject"
1571
func NewJSConsumerInvalidDeliverSubjectError(opts ...ErrorOption) *ApiError {
2✔
1572
        eopts := parseOpts(opts)
2✔
1573
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1574
                return ae
×
1575
        }
×
1576

1577
        return ApiErrors[JSConsumerInvalidDeliverSubject]
2✔
1578
}
1579

1580
// NewJSConsumerInvalidGroupNameError creates a new JSConsumerInvalidGroupNameErr error: "Valid priority group name must match A-Z, a-z, 0-9, -_/=)+ and may not exceed 16 characters"
1581
func NewJSConsumerInvalidGroupNameError(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[JSConsumerInvalidGroupNameErr]
2✔
1588
}
1589

1590
// NewJSConsumerInvalidPolicyError creates a new JSConsumerInvalidPolicyErrF error: "{err}"
1591
func NewJSConsumerInvalidPolicyError(err error, opts ...ErrorOption) *ApiError {
10✔
1592
        eopts := parseOpts(opts)
10✔
1593
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1594
                return ae
×
1595
        }
×
1596

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

1606
// NewJSConsumerInvalidPriorityGroupError creates a new JSConsumerInvalidPriorityGroupErr error: "Provided priority group does not exist for this consumer"
1607
func NewJSConsumerInvalidPriorityGroupError(opts ...ErrorOption) *ApiError {
2✔
1608
        eopts := parseOpts(opts)
2✔
1609
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1610
                return ae
×
1611
        }
×
1612

1613
        return ApiErrors[JSConsumerInvalidPriorityGroupErr]
2✔
1614
}
1615

1616
// NewJSConsumerInvalidResetError creates a new JSConsumerInvalidResetErr error: "invalid reset: {err}"
1617
func NewJSConsumerInvalidResetError(err error, opts ...ErrorOption) *ApiError {
4✔
1618
        eopts := parseOpts(opts)
4✔
1619
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1620
                return ae
×
1621
        }
×
1622

1623
        e := ApiErrors[JSConsumerInvalidResetErr]
4✔
1624
        args := e.toReplacerArgs([]interface{}{"{err}", err})
4✔
1625
        return &ApiError{
4✔
1626
                Code:        e.Code,
4✔
1627
                ErrCode:     e.ErrCode,
4✔
1628
                Description: strings.NewReplacer(args...).Replace(e.Description),
4✔
1629
        }
4✔
1630
}
1631

1632
// NewJSConsumerInvalidSamplingError creates a new JSConsumerInvalidSamplingErrF error: "failed to parse consumer sampling configuration: {err}"
1633
func NewJSConsumerInvalidSamplingError(err error, opts ...ErrorOption) *ApiError {
×
1634
        eopts := parseOpts(opts)
×
1635
        if ae, ok := eopts.err.(*ApiError); ok {
×
1636
                return ae
×
1637
        }
×
1638

1639
        e := ApiErrors[JSConsumerInvalidSamplingErrF]
×
1640
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1641
        return &ApiError{
×
1642
                Code:        e.Code,
×
1643
                ErrCode:     e.ErrCode,
×
1644
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1645
        }
×
1646
}
1647

1648
// NewJSConsumerMaxDeliverBackoffError creates a new JSConsumerMaxDeliverBackoffErr error: "max deliver is required to be > length of backoff values"
1649
func NewJSConsumerMaxDeliverBackoffError(opts ...ErrorOption) *ApiError {
3✔
1650
        eopts := parseOpts(opts)
3✔
1651
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1652
                return ae
×
1653
        }
×
1654

1655
        return ApiErrors[JSConsumerMaxDeliverBackoffErr]
3✔
1656
}
1657

1658
// NewJSConsumerMaxPendingAckExcessError creates a new JSConsumerMaxPendingAckExcessErrF error: "consumer max ack pending exceeds system limit of {limit}"
1659
func NewJSConsumerMaxPendingAckExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
12✔
1660
        eopts := parseOpts(opts)
12✔
1661
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
1662
                return ae
×
1663
        }
×
1664

1665
        e := ApiErrors[JSConsumerMaxPendingAckExcessErrF]
12✔
1666
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
12✔
1667
        return &ApiError{
12✔
1668
                Code:        e.Code,
12✔
1669
                ErrCode:     e.ErrCode,
12✔
1670
                Description: strings.NewReplacer(args...).Replace(e.Description),
12✔
1671
        }
12✔
1672
}
1673

1674
// NewJSConsumerMaxPendingAckPolicyRequiredError creates a new JSConsumerMaxPendingAckPolicyRequiredErr error: "consumer requires ack policy for max ack pending"
1675
func NewJSConsumerMaxPendingAckPolicyRequiredError(opts ...ErrorOption) *ApiError {
2✔
1676
        eopts := parseOpts(opts)
2✔
1677
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1678
                return ae
×
1679
        }
×
1680

1681
        return ApiErrors[JSConsumerMaxPendingAckPolicyRequiredErr]
2✔
1682
}
1683

1684
// NewJSConsumerMaxRequestBatchExceededError creates a new JSConsumerMaxRequestBatchExceededF error: "consumer max request batch exceeds server limit of {limit}"
1685
func NewJSConsumerMaxRequestBatchExceededError(limit interface{}, opts ...ErrorOption) *ApiError {
4✔
1686
        eopts := parseOpts(opts)
4✔
1687
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1688
                return ae
×
1689
        }
×
1690

1691
        e := ApiErrors[JSConsumerMaxRequestBatchExceededF]
4✔
1692
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
4✔
1693
        return &ApiError{
4✔
1694
                Code:        e.Code,
4✔
1695
                ErrCode:     e.ErrCode,
4✔
1696
                Description: strings.NewReplacer(args...).Replace(e.Description),
4✔
1697
        }
4✔
1698
}
1699

1700
// NewJSConsumerMaxRequestBatchNegativeError creates a new JSConsumerMaxRequestBatchNegativeErr error: "consumer max request batch needs to be > 0"
1701
func NewJSConsumerMaxRequestBatchNegativeError(opts ...ErrorOption) *ApiError {
×
1702
        eopts := parseOpts(opts)
×
1703
        if ae, ok := eopts.err.(*ApiError); ok {
×
1704
                return ae
×
1705
        }
×
1706

1707
        return ApiErrors[JSConsumerMaxRequestBatchNegativeErr]
×
1708
}
1709

1710
// NewJSConsumerMaxRequestExpiresTooSmallError creates a new JSConsumerMaxRequestExpiresTooSmall error: "consumer max request expires needs to be >= 1ms"
1711
func NewJSConsumerMaxRequestExpiresTooSmallError(opts ...ErrorOption) *ApiError {
×
1712
        eopts := parseOpts(opts)
×
1713
        if ae, ok := eopts.err.(*ApiError); ok {
×
1714
                return ae
×
1715
        }
×
1716

1717
        return ApiErrors[JSConsumerMaxRequestExpiresTooSmall]
×
1718
}
1719

1720
// NewJSConsumerMaxWaitingNegativeError creates a new JSConsumerMaxWaitingNegativeErr error: "consumer max waiting needs to be positive"
1721
func NewJSConsumerMaxWaitingNegativeError(opts ...ErrorOption) *ApiError {
×
1722
        eopts := parseOpts(opts)
×
1723
        if ae, ok := eopts.err.(*ApiError); ok {
×
1724
                return ae
×
1725
        }
×
1726

1727
        return ApiErrors[JSConsumerMaxWaitingNegativeErr]
×
1728
}
1729

1730
// NewJSConsumerMetadataLengthError creates a new JSConsumerMetadataLengthErrF error: "consumer metadata exceeds maximum size of {limit}"
1731
func NewJSConsumerMetadataLengthError(limit interface{}, opts ...ErrorOption) *ApiError {
1✔
1732
        eopts := parseOpts(opts)
1✔
1733
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1734
                return ae
×
1735
        }
×
1736

1737
        e := ApiErrors[JSConsumerMetadataLengthErrF]
1✔
1738
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
1✔
1739
        return &ApiError{
1✔
1740
                Code:        e.Code,
1✔
1741
                ErrCode:     e.ErrCode,
1✔
1742
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1743
        }
1✔
1744
}
1745

1746
// NewJSConsumerMultipleFiltersNotAllowedError creates a new JSConsumerMultipleFiltersNotAllowed error: "consumer with multiple subject filters cannot use subject based API"
1747
func NewJSConsumerMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
1748
        eopts := parseOpts(opts)
1✔
1749
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1750
                return ae
×
1751
        }
×
1752

1753
        return ApiErrors[JSConsumerMultipleFiltersNotAllowed]
1✔
1754
}
1755

1756
// NewJSConsumerNameContainsPathSeparatorsError creates a new JSConsumerNameContainsPathSeparatorsErr error: "Consumer name can not contain path separators"
1757
func NewJSConsumerNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
8✔
1758
        eopts := parseOpts(opts)
8✔
1759
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1760
                return ae
×
1761
        }
×
1762

1763
        return ApiErrors[JSConsumerNameContainsPathSeparatorsErr]
8✔
1764
}
1765

1766
// NewJSConsumerNameExistError creates a new JSConsumerNameExistErr error: "consumer name already in use"
1767
func NewJSConsumerNameExistError(opts ...ErrorOption) *ApiError {
2✔
1768
        eopts := parseOpts(opts)
2✔
1769
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1770
                return ae
×
1771
        }
×
1772

1773
        return ApiErrors[JSConsumerNameExistErr]
2✔
1774
}
1775

1776
// NewJSConsumerNameTooLongError creates a new JSConsumerNameTooLongErrF error: "consumer name is too long, maximum allowed is {max}"
1777
func NewJSConsumerNameTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
×
1778
        eopts := parseOpts(opts)
×
1779
        if ae, ok := eopts.err.(*ApiError); ok {
×
1780
                return ae
×
1781
        }
×
1782

1783
        e := ApiErrors[JSConsumerNameTooLongErrF]
×
1784
        args := e.toReplacerArgs([]interface{}{"{max}", max})
×
1785
        return &ApiError{
×
1786
                Code:        e.Code,
×
1787
                ErrCode:     e.ErrCode,
×
1788
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1789
        }
×
1790
}
1791

1792
// NewJSConsumerNotFoundError creates a new JSConsumerNotFoundErr error: "consumer not found"
1793
func NewJSConsumerNotFoundError(opts ...ErrorOption) *ApiError {
2,810✔
1794
        eopts := parseOpts(opts)
2,810✔
1795
        if ae, ok := eopts.err.(*ApiError); ok {
2,810✔
1796
                return ae
×
1797
        }
×
1798

1799
        return ApiErrors[JSConsumerNotFoundErr]
2,810✔
1800
}
1801

1802
// NewJSConsumerOfflineError creates a new JSConsumerOfflineErr error: "consumer is offline"
1803
func NewJSConsumerOfflineError(opts ...ErrorOption) *ApiError {
8✔
1804
        eopts := parseOpts(opts)
8✔
1805
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1806
                return ae
×
1807
        }
×
1808

1809
        return ApiErrors[JSConsumerOfflineErr]
8✔
1810
}
1811

1812
// NewJSConsumerOfflineReasonError creates a new JSConsumerOfflineReasonErrF error: "consumer is offline: {err}"
1813
func NewJSConsumerOfflineReasonError(err error, opts ...ErrorOption) *ApiError {
24✔
1814
        eopts := parseOpts(opts)
24✔
1815
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
1816
                return ae
×
1817
        }
×
1818

1819
        e := ApiErrors[JSConsumerOfflineReasonErrF]
24✔
1820
        args := e.toReplacerArgs([]interface{}{"{err}", err})
24✔
1821
        return &ApiError{
24✔
1822
                Code:        e.Code,
24✔
1823
                ErrCode:     e.ErrCode,
24✔
1824
                Description: strings.NewReplacer(args...).Replace(e.Description),
24✔
1825
        }
24✔
1826
}
1827

1828
// NewJSConsumerOnMappedError creates a new JSConsumerOnMappedErr error: "consumer direct on a mapped consumer"
1829
func NewJSConsumerOnMappedError(opts ...ErrorOption) *ApiError {
×
1830
        eopts := parseOpts(opts)
×
1831
        if ae, ok := eopts.err.(*ApiError); ok {
×
1832
                return ae
×
1833
        }
×
1834

1835
        return ApiErrors[JSConsumerOnMappedErr]
×
1836
}
1837

1838
// NewJSConsumerOverlappingSubjectFiltersError creates a new JSConsumerOverlappingSubjectFilters error: "consumer subject filters cannot overlap"
1839
func NewJSConsumerOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
3✔
1840
        eopts := parseOpts(opts)
3✔
1841
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1842
                return ae
×
1843
        }
×
1844

1845
        return ApiErrors[JSConsumerOverlappingSubjectFilters]
3✔
1846
}
1847

1848
// NewJSConsumerPinnedTTLWithoutPriorityPolicyNoneError creates a new JSConsumerPinnedTTLWithoutPriorityPolicyNone error: "PinnedTTL cannot be set when PriorityPolicy is none"
1849
func NewJSConsumerPinnedTTLWithoutPriorityPolicyNoneError(opts ...ErrorOption) *ApiError {
1✔
1850
        eopts := parseOpts(opts)
1✔
1851
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1852
                return ae
×
1853
        }
×
1854

1855
        return ApiErrors[JSConsumerPinnedTTLWithoutPriorityPolicyNone]
1✔
1856
}
1857

1858
// NewJSConsumerPriorityGroupWithPolicyNoneError creates a new JSConsumerPriorityGroupWithPolicyNone error: "consumer can not have priority groups when policy is none"
1859
func NewJSConsumerPriorityGroupWithPolicyNoneError(opts ...ErrorOption) *ApiError {
1✔
1860
        eopts := parseOpts(opts)
1✔
1861
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1862
                return ae
×
1863
        }
×
1864

1865
        return ApiErrors[JSConsumerPriorityGroupWithPolicyNone]
1✔
1866
}
1867

1868
// NewJSConsumerPriorityPolicyWithoutGroupError creates a new JSConsumerPriorityPolicyWithoutGroup error: "Setting PriorityPolicy requires at least one PriorityGroup to be set"
1869
func NewJSConsumerPriorityPolicyWithoutGroupError(opts ...ErrorOption) *ApiError {
4✔
1870
        eopts := parseOpts(opts)
4✔
1871
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1872
                return ae
×
1873
        }
×
1874

1875
        return ApiErrors[JSConsumerPriorityPolicyWithoutGroup]
4✔
1876
}
1877

1878
// NewJSConsumerPullNotDurableError creates a new JSConsumerPullNotDurableErr error: "consumer in pull mode requires a durable name"
1879
func NewJSConsumerPullNotDurableError(opts ...ErrorOption) *ApiError {
×
1880
        eopts := parseOpts(opts)
×
1881
        if ae, ok := eopts.err.(*ApiError); ok {
×
1882
                return ae
×
1883
        }
×
1884

1885
        return ApiErrors[JSConsumerPullNotDurableErr]
×
1886
}
1887

1888
// NewJSConsumerPullRequiresAckError creates a new JSConsumerPullRequiresAckErr error: "consumer in pull mode requires explicit ack policy on workqueue stream"
1889
func NewJSConsumerPullRequiresAckError(opts ...ErrorOption) *ApiError {
6✔
1890
        eopts := parseOpts(opts)
6✔
1891
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1892
                return ae
×
1893
        }
×
1894

1895
        return ApiErrors[JSConsumerPullRequiresAckErr]
6✔
1896
}
1897

1898
// NewJSConsumerPullWithRateLimitError creates a new JSConsumerPullWithRateLimitErr error: "consumer in pull mode can not have rate limit set"
1899
func NewJSConsumerPullWithRateLimitError(opts ...ErrorOption) *ApiError {
1✔
1900
        eopts := parseOpts(opts)
1✔
1901
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1902
                return ae
×
1903
        }
×
1904

1905
        return ApiErrors[JSConsumerPullWithRateLimitErr]
1✔
1906
}
1907

1908
// NewJSConsumerPushMaxWaitingError creates a new JSConsumerPushMaxWaitingErr error: "consumer in push mode can not set max waiting"
1909
func NewJSConsumerPushMaxWaitingError(opts ...ErrorOption) *ApiError {
3✔
1910
        eopts := parseOpts(opts)
3✔
1911
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1912
                return ae
×
1913
        }
×
1914

1915
        return ApiErrors[JSConsumerPushMaxWaitingErr]
3✔
1916
}
1917

1918
// NewJSConsumerPushWithPriorityGroupError creates a new JSConsumerPushWithPriorityGroupErr error: "priority groups can not be used with push consumers"
1919
func NewJSConsumerPushWithPriorityGroupError(opts ...ErrorOption) *ApiError {
1✔
1920
        eopts := parseOpts(opts)
1✔
1921
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1922
                return ae
×
1923
        }
×
1924

1925
        return ApiErrors[JSConsumerPushWithPriorityGroupErr]
1✔
1926
}
1927

1928
// NewJSConsumerReplacementWithDifferentNameError creates a new JSConsumerReplacementWithDifferentNameErr error: "consumer replacement durable config not the same"
1929
func NewJSConsumerReplacementWithDifferentNameError(opts ...ErrorOption) *ApiError {
×
1930
        eopts := parseOpts(opts)
×
1931
        if ae, ok := eopts.err.(*ApiError); ok {
×
1932
                return ae
×
1933
        }
×
1934

1935
        return ApiErrors[JSConsumerReplacementWithDifferentNameErr]
×
1936
}
1937

1938
// NewJSConsumerReplayPolicyInvalidError creates a new JSConsumerReplayPolicyInvalidErr error: "consumer replay policy invalid"
1939
func NewJSConsumerReplayPolicyInvalidError(opts ...ErrorOption) *ApiError {
2✔
1940
        eopts := parseOpts(opts)
2✔
1941
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1942
                return ae
×
1943
        }
×
1944

1945
        return ApiErrors[JSConsumerReplayPolicyInvalidErr]
2✔
1946
}
1947

1948
// NewJSConsumerReplicasExceedsStreamError creates a new JSConsumerReplicasExceedsStream error: "consumer config replica count exceeds parent stream"
1949
func NewJSConsumerReplicasExceedsStreamError(opts ...ErrorOption) *ApiError {
1✔
1950
        eopts := parseOpts(opts)
1✔
1951
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1952
                return ae
×
1953
        }
×
1954

1955
        return ApiErrors[JSConsumerReplicasExceedsStream]
1✔
1956
}
1957

1958
// NewJSConsumerReplicasShouldMatchStreamError creates a new JSConsumerReplicasShouldMatchStream error: "consumer config replicas must match interest retention stream's replicas"
1959
func NewJSConsumerReplicasShouldMatchStreamError(opts ...ErrorOption) *ApiError {
2✔
1960
        eopts := parseOpts(opts)
2✔
1961
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1962
                return ae
×
1963
        }
×
1964

1965
        return ApiErrors[JSConsumerReplicasShouldMatchStream]
2✔
1966
}
1967

1968
// NewJSConsumerSmallHeartbeatError creates a new JSConsumerSmallHeartbeatErr error: "consumer idle heartbeat needs to be >= 100ms"
1969
func NewJSConsumerSmallHeartbeatError(opts ...ErrorOption) *ApiError {
1✔
1970
        eopts := parseOpts(opts)
1✔
1971
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1972
                return ae
×
1973
        }
×
1974

1975
        return ApiErrors[JSConsumerSmallHeartbeatErr]
1✔
1976
}
1977

1978
// NewJSConsumerStoreFailedError creates a new JSConsumerStoreFailedErrF error: "error creating store for consumer: {err}"
1979
func NewJSConsumerStoreFailedError(err error, opts ...ErrorOption) *ApiError {
9✔
1980
        eopts := parseOpts(opts)
9✔
1981
        if ae, ok := eopts.err.(*ApiError); ok {
9✔
1982
                return ae
×
1983
        }
×
1984

1985
        e := ApiErrors[JSConsumerStoreFailedErrF]
9✔
1986
        args := e.toReplacerArgs([]interface{}{"{err}", err})
9✔
1987
        return &ApiError{
9✔
1988
                Code:        e.Code,
9✔
1989
                ErrCode:     e.ErrCode,
9✔
1990
                Description: strings.NewReplacer(args...).Replace(e.Description),
9✔
1991
        }
9✔
1992
}
1993

1994
// NewJSConsumerWQConsumerNotDeliverAllError creates a new JSConsumerWQConsumerNotDeliverAllErr error: "consumer must be deliver all on workqueue stream"
1995
func NewJSConsumerWQConsumerNotDeliverAllError(opts ...ErrorOption) *ApiError {
2✔
1996
        eopts := parseOpts(opts)
2✔
1997
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1998
                return ae
×
1999
        }
×
2000

2001
        return ApiErrors[JSConsumerWQConsumerNotDeliverAllErr]
2✔
2002
}
2003

2004
// NewJSConsumerWQConsumerNotUniqueError creates a new JSConsumerWQConsumerNotUniqueErr error: "filtered consumer not unique on workqueue stream"
2005
func NewJSConsumerWQConsumerNotUniqueError(opts ...ErrorOption) *ApiError {
11✔
2006
        eopts := parseOpts(opts)
11✔
2007
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
2008
                return ae
×
2009
        }
×
2010

2011
        return ApiErrors[JSConsumerWQConsumerNotUniqueErr]
11✔
2012
}
2013

2014
// NewJSConsumerWQMultipleUnfilteredError creates a new JSConsumerWQMultipleUnfilteredErr error: "multiple non-filtered consumers not allowed on workqueue stream"
2015
func NewJSConsumerWQMultipleUnfilteredError(opts ...ErrorOption) *ApiError {
2✔
2016
        eopts := parseOpts(opts)
2✔
2017
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2018
                return ae
×
2019
        }
×
2020

2021
        return ApiErrors[JSConsumerWQMultipleUnfilteredErr]
2✔
2022
}
2023

2024
// NewJSConsumerWQRequiresExplicitAckError creates a new JSConsumerWQRequiresExplicitAckErr error: "workqueue stream requires explicit ack"
2025
func NewJSConsumerWQRequiresExplicitAckError(opts ...ErrorOption) *ApiError {
×
2026
        eopts := parseOpts(opts)
×
2027
        if ae, ok := eopts.err.(*ApiError); ok {
×
2028
                return ae
×
2029
        }
×
2030

2031
        return ApiErrors[JSConsumerWQRequiresExplicitAckErr]
×
2032
}
2033

2034
// NewJSConsumerWithFlowControlNeedsHeartbeatsError creates a new JSConsumerWithFlowControlNeedsHeartbeats error: "consumer with flow control also needs heartbeats"
2035
func NewJSConsumerWithFlowControlNeedsHeartbeatsError(opts ...ErrorOption) *ApiError {
4✔
2036
        eopts := parseOpts(opts)
4✔
2037
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2038
                return ae
×
2039
        }
×
2040

2041
        return ApiErrors[JSConsumerWithFlowControlNeedsHeartbeats]
4✔
2042
}
2043

2044
// NewJSInsufficientResourcesError creates a new JSInsufficientResourcesErr error: "insufficient resources"
2045
func NewJSInsufficientResourcesError(opts ...ErrorOption) *ApiError {
10✔
2046
        eopts := parseOpts(opts)
10✔
2047
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2048
                return ae
×
2049
        }
×
2050

2051
        return ApiErrors[JSInsufficientResourcesErr]
10✔
2052
}
2053

2054
// NewJSInvalidJSONError creates a new JSInvalidJSONErr error: "invalid JSON: {err}"
2055
func NewJSInvalidJSONError(err error, opts ...ErrorOption) *ApiError {
8✔
2056
        eopts := parseOpts(opts)
8✔
2057
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
2058
                return ae
×
2059
        }
×
2060

2061
        e := ApiErrors[JSInvalidJSONErr]
8✔
2062
        args := e.toReplacerArgs([]interface{}{"{err}", err})
8✔
2063
        return &ApiError{
8✔
2064
                Code:        e.Code,
8✔
2065
                ErrCode:     e.ErrCode,
8✔
2066
                Description: strings.NewReplacer(args...).Replace(e.Description),
8✔
2067
        }
8✔
2068
}
2069

2070
// NewJSMaximumConsumersLimitError creates a new JSMaximumConsumersLimitErr error: "maximum consumers limit reached"
2071
func NewJSMaximumConsumersLimitError(opts ...ErrorOption) *ApiError {
43✔
2072
        eopts := parseOpts(opts)
43✔
2073
        if ae, ok := eopts.err.(*ApiError); ok {
43✔
2074
                return ae
×
2075
        }
×
2076

2077
        return ApiErrors[JSMaximumConsumersLimitErr]
43✔
2078
}
2079

2080
// NewJSMaximumStreamsLimitError creates a new JSMaximumStreamsLimitErr error: "maximum number of streams reached"
2081
func NewJSMaximumStreamsLimitError(opts ...ErrorOption) *ApiError {
16✔
2082
        eopts := parseOpts(opts)
16✔
2083
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2084
                return ae
×
2085
        }
×
2086

2087
        return ApiErrors[JSMaximumStreamsLimitErr]
16✔
2088
}
2089

2090
// NewJSMemoryResourcesExceededError creates a new JSMemoryResourcesExceededErr error: "insufficient memory resources available"
2091
func NewJSMemoryResourcesExceededError(opts ...ErrorOption) *ApiError {
11✔
2092
        eopts := parseOpts(opts)
11✔
2093
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
2094
                return ae
×
2095
        }
×
2096

2097
        return ApiErrors[JSMemoryResourcesExceededErr]
11✔
2098
}
2099

2100
// NewJSMessageCounterBrokenError creates a new JSMessageCounterBrokenErr error: "message counter is broken"
2101
func NewJSMessageCounterBrokenError(opts ...ErrorOption) *ApiError {
4✔
2102
        eopts := parseOpts(opts)
4✔
2103
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2104
                return ae
×
2105
        }
×
2106

2107
        return ApiErrors[JSMessageCounterBrokenErr]
4✔
2108
}
2109

2110
// NewJSMessageIncrDisabledError creates a new JSMessageIncrDisabledErr error: "message counters is disabled"
2111
func NewJSMessageIncrDisabledError(opts ...ErrorOption) *ApiError {
4✔
2112
        eopts := parseOpts(opts)
4✔
2113
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2114
                return ae
×
2115
        }
×
2116

2117
        return ApiErrors[JSMessageIncrDisabledErr]
4✔
2118
}
2119

2120
// NewJSMessageIncrInvalidError creates a new JSMessageIncrInvalidErr error: "message counter increment is invalid"
2121
func NewJSMessageIncrInvalidError(opts ...ErrorOption) *ApiError {
24✔
2122
        eopts := parseOpts(opts)
24✔
2123
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
2124
                return ae
×
2125
        }
×
2126

2127
        return ApiErrors[JSMessageIncrInvalidErr]
24✔
2128
}
2129

2130
// NewJSMessageIncrMissingError creates a new JSMessageIncrMissingErr error: "message counter increment is missing"
2131
func NewJSMessageIncrMissingError(opts ...ErrorOption) *ApiError {
8✔
2132
        eopts := parseOpts(opts)
8✔
2133
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
2134
                return ae
×
2135
        }
×
2136

2137
        return ApiErrors[JSMessageIncrMissingErr]
8✔
2138
}
2139

2140
// NewJSMessageIncrPayloadError creates a new JSMessageIncrPayloadErr error: "message counter has payload"
2141
func NewJSMessageIncrPayloadError(opts ...ErrorOption) *ApiError {
4✔
2142
        eopts := parseOpts(opts)
4✔
2143
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2144
                return ae
×
2145
        }
×
2146

2147
        return ApiErrors[JSMessageIncrPayloadErr]
4✔
2148
}
2149

2150
// NewJSMessageSchedulesDisabledError creates a new JSMessageSchedulesDisabledErr error: "message schedules is disabled"
2151
func NewJSMessageSchedulesDisabledError(opts ...ErrorOption) *ApiError {
26✔
2152
        eopts := parseOpts(opts)
26✔
2153
        if ae, ok := eopts.err.(*ApiError); ok {
26✔
2154
                return ae
×
2155
        }
×
2156

2157
        return ApiErrors[JSMessageSchedulesDisabledErr]
26✔
2158
}
2159

2160
// NewJSMessageSchedulesPatternInvalidError creates a new JSMessageSchedulesPatternInvalidErr error: "message schedules pattern is invalid"
2161
func NewJSMessageSchedulesPatternInvalidError(opts ...ErrorOption) *ApiError {
23✔
2162
        eopts := parseOpts(opts)
23✔
2163
        if ae, ok := eopts.err.(*ApiError); ok {
23✔
2164
                return ae
×
2165
        }
×
2166

2167
        return ApiErrors[JSMessageSchedulesPatternInvalidErr]
23✔
2168
}
2169

2170
// NewJSMessageSchedulesRollupInvalidError creates a new JSMessageSchedulesRollupInvalidErr error: "message schedules invalid rollup"
2171
func NewJSMessageSchedulesRollupInvalidError(opts ...ErrorOption) *ApiError {
18✔
2172
        eopts := parseOpts(opts)
18✔
2173
        if ae, ok := eopts.err.(*ApiError); ok {
18✔
2174
                return ae
×
2175
        }
×
2176

2177
        return ApiErrors[JSMessageSchedulesRollupInvalidErr]
18✔
2178
}
2179

2180
// NewJSMessageSchedulesSchedulerInvalidError creates a new JSMessageSchedulesSchedulerInvalidErr error: "message schedules invalid scheduler"
2181
func NewJSMessageSchedulesSchedulerInvalidError(opts ...ErrorOption) *ApiError {
38✔
2182
        eopts := parseOpts(opts)
38✔
2183
        if ae, ok := eopts.err.(*ApiError); ok {
38✔
2184
                return ae
×
2185
        }
×
2186

2187
        return ApiErrors[JSMessageSchedulesSchedulerInvalidErr]
38✔
2188
}
2189

2190
// NewJSMessageSchedulesSourceInvalidError creates a new JSMessageSchedulesSourceInvalidErr error: "message schedules source is invalid"
2191
func NewJSMessageSchedulesSourceInvalidError(opts ...ErrorOption) *ApiError {
40✔
2192
        eopts := parseOpts(opts)
40✔
2193
        if ae, ok := eopts.err.(*ApiError); ok {
40✔
2194
                return ae
×
2195
        }
×
2196

2197
        return ApiErrors[JSMessageSchedulesSourceInvalidErr]
40✔
2198
}
2199

2200
// NewJSMessageSchedulesTTLInvalidError creates a new JSMessageSchedulesTTLInvalidErr error: "message schedules invalid per-message TTL"
2201
func NewJSMessageSchedulesTTLInvalidError(opts ...ErrorOption) *ApiError {
10✔
2202
        eopts := parseOpts(opts)
10✔
2203
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2204
                return ae
×
2205
        }
×
2206

2207
        return ApiErrors[JSMessageSchedulesTTLInvalidErr]
10✔
2208
}
2209

2210
// NewJSMessageSchedulesTargetInvalidError creates a new JSMessageSchedulesTargetInvalidErr error: "message schedules target is invalid"
2211
func NewJSMessageSchedulesTargetInvalidError(opts ...ErrorOption) *ApiError {
30✔
2212
        eopts := parseOpts(opts)
30✔
2213
        if ae, ok := eopts.err.(*ApiError); ok {
30✔
2214
                return ae
×
2215
        }
×
2216

2217
        return ApiErrors[JSMessageSchedulesTargetInvalidErr]
30✔
2218
}
2219

2220
// NewJSMessageSchedulesTimeZoneInvalidError creates a new JSMessageSchedulesTimeZoneInvalidErr error: "message schedules time zone is invalid"
2221
func NewJSMessageSchedulesTimeZoneInvalidError(opts ...ErrorOption) *ApiError {
20✔
2222
        eopts := parseOpts(opts)
20✔
2223
        if ae, ok := eopts.err.(*ApiError); ok {
20✔
2224
                return ae
×
2225
        }
×
2226

2227
        return ApiErrors[JSMessageSchedulesTimeZoneInvalidErr]
20✔
2228
}
2229

2230
// NewJSMessageTTLDisabledError creates a new JSMessageTTLDisabledErr error: "per-message TTL is disabled"
2231
func NewJSMessageTTLDisabledError(opts ...ErrorOption) *ApiError {
16✔
2232
        eopts := parseOpts(opts)
16✔
2233
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2234
                return ae
×
2235
        }
×
2236

2237
        return ApiErrors[JSMessageTTLDisabledErr]
16✔
2238
}
2239

2240
// NewJSMessageTTLInvalidError creates a new JSMessageTTLInvalidErr error: "invalid per-message TTL"
2241
func NewJSMessageTTLInvalidError(opts ...ErrorOption) *ApiError {
23✔
2242
        eopts := parseOpts(opts)
23✔
2243
        if ae, ok := eopts.err.(*ApiError); ok {
23✔
2244
                return ae
×
2245
        }
×
2246

2247
        return ApiErrors[JSMessageTTLInvalidErr]
23✔
2248
}
2249

2250
// NewJSMirrorConsumerRequiresAckFCError creates a new JSMirrorConsumerRequiresAckFCErr error: "stream mirror consumer requires flow control ack policy"
2251
func NewJSMirrorConsumerRequiresAckFCError(opts ...ErrorOption) *ApiError {
2✔
2252
        eopts := parseOpts(opts)
2✔
2253
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2254
                return ae
×
2255
        }
×
2256

2257
        return ApiErrors[JSMirrorConsumerRequiresAckFCErr]
2✔
2258
}
2259

2260
// NewJSMirrorConsumerSetupFailedError creates a new JSMirrorConsumerSetupFailedErrF error: "{err}"
2261
func NewJSMirrorConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
2262
        eopts := parseOpts(opts)
×
2263
        if ae, ok := eopts.err.(*ApiError); ok {
×
2264
                return ae
×
2265
        }
×
2266

2267
        e := ApiErrors[JSMirrorConsumerSetupFailedErrF]
×
2268
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2269
        return &ApiError{
×
2270
                Code:        e.Code,
×
2271
                ErrCode:     e.ErrCode,
×
2272
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2273
        }
×
2274
}
2275

2276
// NewJSMirrorDurableConsumerCfgInvalidError creates a new JSMirrorDurableConsumerCfgInvalid error: "stream mirror consumer config is invalid"
2277
func NewJSMirrorDurableConsumerCfgInvalidError(opts ...ErrorOption) *ApiError {
14✔
2278
        eopts := parseOpts(opts)
14✔
2279
        if ae, ok := eopts.err.(*ApiError); ok {
14✔
2280
                return ae
×
2281
        }
×
2282

2283
        return ApiErrors[JSMirrorDurableConsumerCfgInvalid]
14✔
2284
}
2285

2286
// NewJSMirrorInvalidStreamNameError creates a new JSMirrorInvalidStreamName error: "mirrored stream name is invalid"
2287
func NewJSMirrorInvalidStreamNameError(opts ...ErrorOption) *ApiError {
×
2288
        eopts := parseOpts(opts)
×
2289
        if ae, ok := eopts.err.(*ApiError); ok {
×
2290
                return ae
×
2291
        }
×
2292

2293
        return ApiErrors[JSMirrorInvalidStreamName]
×
2294
}
2295

2296
// NewJSMirrorInvalidSubjectFilterError creates a new JSMirrorInvalidSubjectFilter error: "mirror transform source: {err}"
2297
func NewJSMirrorInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
2✔
2298
        eopts := parseOpts(opts)
2✔
2299
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2300
                return ae
×
2301
        }
×
2302

2303
        e := ApiErrors[JSMirrorInvalidSubjectFilter]
2✔
2304
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2✔
2305
        return &ApiError{
2✔
2306
                Code:        e.Code,
2✔
2307
                ErrCode:     e.ErrCode,
2✔
2308
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2309
        }
2✔
2310
}
2311

2312
// NewJSMirrorInvalidTransformDestinationError creates a new JSMirrorInvalidTransformDestination error: "mirror transform: {err}"
2313
func NewJSMirrorInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
2✔
2314
        eopts := parseOpts(opts)
2✔
2315
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2316
                return ae
×
2317
        }
×
2318

2319
        e := ApiErrors[JSMirrorInvalidTransformDestination]
2✔
2320
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2✔
2321
        return &ApiError{
2✔
2322
                Code:        e.Code,
2✔
2323
                ErrCode:     e.ErrCode,
2✔
2324
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2325
        }
2✔
2326
}
2327

2328
// NewJSMirrorMaxMessageSizeTooBigError creates a new JSMirrorMaxMessageSizeTooBigErr error: "stream mirror must have max message size >= source"
2329
func NewJSMirrorMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
2330
        eopts := parseOpts(opts)
×
2331
        if ae, ok := eopts.err.(*ApiError); ok {
×
2332
                return ae
×
2333
        }
×
2334

2335
        return ApiErrors[JSMirrorMaxMessageSizeTooBigErr]
×
2336
}
2337

2338
// NewJSMirrorMultipleFiltersNotAllowedError creates a new JSMirrorMultipleFiltersNotAllowed error: "mirror with multiple subject transforms cannot also have a single subject filter"
2339
func NewJSMirrorMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
2340
        eopts := parseOpts(opts)
1✔
2341
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2342
                return ae
×
2343
        }
×
2344

2345
        return ApiErrors[JSMirrorMultipleFiltersNotAllowed]
1✔
2346
}
2347

2348
// NewJSMirrorOverlappingSubjectFiltersError creates a new JSMirrorOverlappingSubjectFilters error: "mirror subject filters can not overlap"
2349
func NewJSMirrorOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
2✔
2350
        eopts := parseOpts(opts)
2✔
2351
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2352
                return ae
×
2353
        }
×
2354

2355
        return ApiErrors[JSMirrorOverlappingSubjectFilters]
2✔
2356
}
2357

2358
// NewJSMirrorWithAtomicPublishError creates a new JSMirrorWithAtomicPublishErr error: "stream mirrors can not also use atomic publishing"
2359
func NewJSMirrorWithAtomicPublishError(opts ...ErrorOption) *ApiError {
4✔
2360
        eopts := parseOpts(opts)
4✔
2361
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2362
                return ae
×
2363
        }
×
2364

2365
        return ApiErrors[JSMirrorWithAtomicPublishErr]
4✔
2366
}
2367

2368
// NewJSMirrorWithBatchPublishError creates a new JSMirrorWithBatchPublishErr error: "stream mirrors can not also use batch publishing"
2369
func NewJSMirrorWithBatchPublishError(opts ...ErrorOption) *ApiError {
4✔
2370
        eopts := parseOpts(opts)
4✔
2371
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2372
                return ae
×
2373
        }
×
2374

2375
        return ApiErrors[JSMirrorWithBatchPublishErr]
4✔
2376
}
2377

2378
// NewJSMirrorWithCountersError creates a new JSMirrorWithCountersErr error: "stream mirrors can not also calculate counters"
2379
func NewJSMirrorWithCountersError(opts ...ErrorOption) *ApiError {
4✔
2380
        eopts := parseOpts(opts)
4✔
2381
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2382
                return ae
×
2383
        }
×
2384

2385
        return ApiErrors[JSMirrorWithCountersErr]
4✔
2386
}
2387

2388
// NewJSMirrorWithFirstSeqError creates a new JSMirrorWithFirstSeqErr error: "stream mirrors can not have first sequence configured"
2389
func NewJSMirrorWithFirstSeqError(opts ...ErrorOption) *ApiError {
2✔
2390
        eopts := parseOpts(opts)
2✔
2391
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2392
                return ae
×
2393
        }
×
2394

2395
        return ApiErrors[JSMirrorWithFirstSeqErr]
2✔
2396
}
2397

2398
// NewJSMirrorWithMsgSchedulesError creates a new JSMirrorWithMsgSchedulesErr error: "stream mirrors can not also schedule messages"
2399
func NewJSMirrorWithMsgSchedulesError(opts ...ErrorOption) *ApiError {
4✔
2400
        eopts := parseOpts(opts)
4✔
2401
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2402
                return ae
×
2403
        }
×
2404

2405
        return ApiErrors[JSMirrorWithMsgSchedulesErr]
4✔
2406
}
2407

2408
// NewJSMirrorWithSourcesError creates a new JSMirrorWithSourcesErr error: "stream mirrors can not also contain other sources"
2409
func NewJSMirrorWithSourcesError(opts ...ErrorOption) *ApiError {
×
2410
        eopts := parseOpts(opts)
×
2411
        if ae, ok := eopts.err.(*ApiError); ok {
×
2412
                return ae
×
2413
        }
×
2414

2415
        return ApiErrors[JSMirrorWithSourcesErr]
×
2416
}
2417

2418
// NewJSMirrorWithStartSeqAndTimeError creates a new JSMirrorWithStartSeqAndTimeErr error: "stream mirrors can not have both start seq and start time configured"
2419
func NewJSMirrorWithStartSeqAndTimeError(opts ...ErrorOption) *ApiError {
×
2420
        eopts := parseOpts(opts)
×
2421
        if ae, ok := eopts.err.(*ApiError); ok {
×
2422
                return ae
×
2423
        }
×
2424

2425
        return ApiErrors[JSMirrorWithStartSeqAndTimeErr]
×
2426
}
2427

2428
// NewJSMirrorWithSubjectFiltersError creates a new JSMirrorWithSubjectFiltersErr error: "stream mirrors can not contain filtered subjects"
2429
func NewJSMirrorWithSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
2430
        eopts := parseOpts(opts)
×
2431
        if ae, ok := eopts.err.(*ApiError); ok {
×
2432
                return ae
×
2433
        }
×
2434

2435
        return ApiErrors[JSMirrorWithSubjectFiltersErr]
×
2436
}
2437

2438
// NewJSMirrorWithSubjectsError creates a new JSMirrorWithSubjectsErr error: "stream mirrors can not contain subjects"
2439
func NewJSMirrorWithSubjectsError(opts ...ErrorOption) *ApiError {
2✔
2440
        eopts := parseOpts(opts)
2✔
2441
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2442
                return ae
×
2443
        }
×
2444

2445
        return ApiErrors[JSMirrorWithSubjectsErr]
2✔
2446
}
2447

2448
// NewJSNoAccountError creates a new JSNoAccountErr error: "account not found"
2449
func NewJSNoAccountError(opts ...ErrorOption) *ApiError {
1✔
2450
        eopts := parseOpts(opts)
1✔
2451
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2452
                return ae
×
2453
        }
×
2454

2455
        return ApiErrors[JSNoAccountErr]
1✔
2456
}
2457

2458
// NewJSNoLimitsError creates a new JSNoLimitsErr error: "no JetStream default or applicable tiered limit present"
2459
func NewJSNoLimitsError(opts ...ErrorOption) *ApiError {
4✔
2460
        eopts := parseOpts(opts)
4✔
2461
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2462
                return ae
×
2463
        }
×
2464

2465
        return ApiErrors[JSNoLimitsErr]
4✔
2466
}
2467

2468
// NewJSNoMessageFoundError creates a new JSNoMessageFoundErr error: "no message found"
2469
func NewJSNoMessageFoundError(opts ...ErrorOption) *ApiError {
675✔
2470
        eopts := parseOpts(opts)
675✔
2471
        if ae, ok := eopts.err.(*ApiError); ok {
675✔
2472
                return ae
×
2473
        }
×
2474

2475
        return ApiErrors[JSNoMessageFoundErr]
675✔
2476
}
2477

2478
// NewJSNotEmptyRequestError creates a new JSNotEmptyRequestErr error: "expected an empty request payload"
2479
func NewJSNotEmptyRequestError(opts ...ErrorOption) *ApiError {
3✔
2480
        eopts := parseOpts(opts)
3✔
2481
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2482
                return ae
×
2483
        }
×
2484

2485
        return ApiErrors[JSNotEmptyRequestErr]
3✔
2486
}
2487

2488
// NewJSNotEnabledError creates a new JSNotEnabledErr error: "JetStream not enabled"
2489
func NewJSNotEnabledError(opts ...ErrorOption) *ApiError {
11✔
2490
        eopts := parseOpts(opts)
11✔
2491
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
2492
                return ae
×
2493
        }
×
2494

2495
        return ApiErrors[JSNotEnabledErr]
11✔
2496
}
2497

2498
// NewJSNotEnabledForAccountError creates a new JSNotEnabledForAccountErr error: "JetStream not enabled for account"
2499
func NewJSNotEnabledForAccountError(opts ...ErrorOption) *ApiError {
203✔
2500
        eopts := parseOpts(opts)
203✔
2501
        if ae, ok := eopts.err.(*ApiError); ok {
203✔
2502
                return ae
×
2503
        }
×
2504

2505
        return ApiErrors[JSNotEnabledForAccountErr]
203✔
2506
}
2507

2508
// NewJSPedanticError creates a new JSPedanticErrF error: "pedantic mode: {err}"
2509
func NewJSPedanticError(err error, opts ...ErrorOption) *ApiError {
36✔
2510
        eopts := parseOpts(opts)
36✔
2511
        if ae, ok := eopts.err.(*ApiError); ok {
36✔
2512
                return ae
×
2513
        }
×
2514

2515
        e := ApiErrors[JSPedanticErrF]
36✔
2516
        args := e.toReplacerArgs([]interface{}{"{err}", err})
36✔
2517
        return &ApiError{
36✔
2518
                Code:        e.Code,
36✔
2519
                ErrCode:     e.ErrCode,
36✔
2520
                Description: strings.NewReplacer(args...).Replace(e.Description),
36✔
2521
        }
36✔
2522
}
2523

2524
// NewJSPeerRemapError creates a new JSPeerRemapErr error: "peer remap failed"
2525
func NewJSPeerRemapError(opts ...ErrorOption) *ApiError {
5✔
2526
        eopts := parseOpts(opts)
5✔
2527
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2528
                return ae
1✔
2529
        }
1✔
2530

2531
        return ApiErrors[JSPeerRemapErr]
4✔
2532
}
2533

2534
// NewJSRaftGeneralError creates a new JSRaftGeneralErrF error: "{err}"
2535
func NewJSRaftGeneralError(err error, opts ...ErrorOption) *ApiError {
×
2536
        eopts := parseOpts(opts)
×
2537
        if ae, ok := eopts.err.(*ApiError); ok {
×
2538
                return ae
×
2539
        }
×
2540

2541
        e := ApiErrors[JSRaftGeneralErrF]
×
2542
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2543
        return &ApiError{
×
2544
                Code:        e.Code,
×
2545
                ErrCode:     e.ErrCode,
×
2546
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2547
        }
×
2548
}
2549

2550
// NewJSReplicasCountCannotBeNegativeError creates a new JSReplicasCountCannotBeNegative error: "replicas count cannot be negative"
2551
func NewJSReplicasCountCannotBeNegativeError(opts ...ErrorOption) *ApiError {
16✔
2552
        eopts := parseOpts(opts)
16✔
2553
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2554
                return ae
×
2555
        }
×
2556

2557
        return ApiErrors[JSReplicasCountCannotBeNegative]
16✔
2558
}
2559

2560
// NewJSRequiredApiLevelError creates a new JSRequiredApiLevelErr error: "JetStream minimum api level required"
2561
func NewJSRequiredApiLevelError(opts ...ErrorOption) *ApiError {
46✔
2562
        eopts := parseOpts(opts)
46✔
2563
        if ae, ok := eopts.err.(*ApiError); ok {
46✔
2564
                return ae
×
2565
        }
×
2566

2567
        return ApiErrors[JSRequiredApiLevelErr]
46✔
2568
}
2569

2570
// NewJSRestoreSubscribeFailedError creates a new JSRestoreSubscribeFailedErrF error: "JetStream unable to subscribe to restore snapshot {subject}: {err}"
2571
func NewJSRestoreSubscribeFailedError(err error, subject interface{}, opts ...ErrorOption) *ApiError {
1✔
2572
        eopts := parseOpts(opts)
1✔
2573
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2574
                return ae
×
2575
        }
×
2576

2577
        e := ApiErrors[JSRestoreSubscribeFailedErrF]
1✔
2578
        args := e.toReplacerArgs([]interface{}{"{err}", err, "{subject}", subject})
1✔
2579
        return &ApiError{
1✔
2580
                Code:        e.Code,
1✔
2581
                ErrCode:     e.ErrCode,
1✔
2582
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2583
        }
1✔
2584
}
2585

2586
// NewJSSequenceNotFoundError creates a new JSSequenceNotFoundErrF error: "sequence {seq} not found"
2587
func NewJSSequenceNotFoundError(seq uint64, opts ...ErrorOption) *ApiError {
1,545✔
2588
        eopts := parseOpts(opts)
1,545✔
2589
        if ae, ok := eopts.err.(*ApiError); ok {
1,545✔
2590
                return ae
×
2591
        }
×
2592

2593
        e := ApiErrors[JSSequenceNotFoundErrF]
1,545✔
2594
        args := e.toReplacerArgs([]interface{}{"{seq}", seq})
1,545✔
2595
        return &ApiError{
1,545✔
2596
                Code:        e.Code,
1,545✔
2597
                ErrCode:     e.ErrCode,
1,545✔
2598
                Description: strings.NewReplacer(args...).Replace(e.Description),
1,545✔
2599
        }
1,545✔
2600
}
2601

2602
// NewJSSnapshotDeliverSubjectInvalidError creates a new JSSnapshotDeliverSubjectInvalidErr error: "deliver subject not valid"
2603
func NewJSSnapshotDeliverSubjectInvalidError(opts ...ErrorOption) *ApiError {
1✔
2604
        eopts := parseOpts(opts)
1✔
2605
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2606
                return ae
×
2607
        }
×
2608

2609
        return ApiErrors[JSSnapshotDeliverSubjectInvalidErr]
1✔
2610
}
2611

2612
// NewJSSourceConsumerRequiresAckFCError creates a new JSSourceConsumerRequiresAckFCErr error: "stream source consumer requires flow control ack policy"
2613
func NewJSSourceConsumerRequiresAckFCError(opts ...ErrorOption) *ApiError {
2✔
2614
        eopts := parseOpts(opts)
2✔
2615
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2616
                return ae
×
2617
        }
×
2618

2619
        return ApiErrors[JSSourceConsumerRequiresAckFCErr]
2✔
2620
}
2621

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

2629
        e := ApiErrors[JSSourceConsumerSetupFailedErrF]
×
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
// NewJSSourceDuplicateDetectedError creates a new JSSourceDuplicateDetected error: "duplicate source configuration detected"
2639
func NewJSSourceDuplicateDetectedError(opts ...ErrorOption) *ApiError {
×
2640
        eopts := parseOpts(opts)
×
2641
        if ae, ok := eopts.err.(*ApiError); ok {
×
2642
                return ae
×
2643
        }
×
2644

2645
        return ApiErrors[JSSourceDuplicateDetected]
×
2646
}
2647

2648
// NewJSSourceDurableConsumerCfgInvalidError creates a new JSSourceDurableConsumerCfgInvalid error: "stream source consumer config is invalid"
2649
func NewJSSourceDurableConsumerCfgInvalidError(opts ...ErrorOption) *ApiError {
14✔
2650
        eopts := parseOpts(opts)
14✔
2651
        if ae, ok := eopts.err.(*ApiError); ok {
14✔
2652
                return ae
×
2653
        }
×
2654

2655
        return ApiErrors[JSSourceDurableConsumerCfgInvalid]
14✔
2656
}
2657

2658
// NewJSSourceDurableConsumerDuplicateDetectedError creates a new JSSourceDurableConsumerDuplicateDetected error: "duplicate stream source consumer detected"
2659
func NewJSSourceDurableConsumerDuplicateDetectedError(opts ...ErrorOption) *ApiError {
2✔
2660
        eopts := parseOpts(opts)
2✔
2661
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2662
                return ae
×
2663
        }
×
2664

2665
        return ApiErrors[JSSourceDurableConsumerDuplicateDetected]
2✔
2666
}
2667

2668
// NewJSSourceInvalidStreamNameError creates a new JSSourceInvalidStreamName error: "sourced stream name is invalid"
2669
func NewJSSourceInvalidStreamNameError(opts ...ErrorOption) *ApiError {
2✔
2670
        eopts := parseOpts(opts)
2✔
2671
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2672
                return ae
×
2673
        }
×
2674

2675
        return ApiErrors[JSSourceInvalidStreamName]
2✔
2676
}
2677

2678
// NewJSSourceInvalidSubjectFilterError creates a new JSSourceInvalidSubjectFilter error: "source transform source: {err}"
2679
func NewJSSourceInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
5✔
2680
        eopts := parseOpts(opts)
5✔
2681
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2682
                return ae
×
2683
        }
×
2684

2685
        e := ApiErrors[JSSourceInvalidSubjectFilter]
5✔
2686
        args := e.toReplacerArgs([]interface{}{"{err}", err})
5✔
2687
        return &ApiError{
5✔
2688
                Code:        e.Code,
5✔
2689
                ErrCode:     e.ErrCode,
5✔
2690
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
2691
        }
5✔
2692
}
2693

2694
// NewJSSourceInvalidTransformDestinationError creates a new JSSourceInvalidTransformDestination error: "source transform: {err}"
2695
func NewJSSourceInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
5✔
2696
        eopts := parseOpts(opts)
5✔
2697
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2698
                return ae
×
2699
        }
×
2700

2701
        e := ApiErrors[JSSourceInvalidTransformDestination]
5✔
2702
        args := e.toReplacerArgs([]interface{}{"{err}", err})
5✔
2703
        return &ApiError{
5✔
2704
                Code:        e.Code,
5✔
2705
                ErrCode:     e.ErrCode,
5✔
2706
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
2707
        }
5✔
2708
}
2709

2710
// NewJSSourceMaxMessageSizeTooBigError creates a new JSSourceMaxMessageSizeTooBigErr error: "stream source must have max message size >= target"
2711
func NewJSSourceMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
2712
        eopts := parseOpts(opts)
×
2713
        if ae, ok := eopts.err.(*ApiError); ok {
×
2714
                return ae
×
2715
        }
×
2716

2717
        return ApiErrors[JSSourceMaxMessageSizeTooBigErr]
×
2718
}
2719

2720
// NewJSSourceMultipleFiltersNotAllowedError creates a new JSSourceMultipleFiltersNotAllowed error: "source with multiple subject transforms cannot also have a single subject filter"
2721
func NewJSSourceMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
4✔
2722
        eopts := parseOpts(opts)
4✔
2723
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2724
                return ae
×
2725
        }
×
2726

2727
        return ApiErrors[JSSourceMultipleFiltersNotAllowed]
4✔
2728
}
2729

2730
// NewJSSourceOverlappingSubjectFiltersError creates a new JSSourceOverlappingSubjectFilters error: "source filters can not overlap"
2731
func NewJSSourceOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
4✔
2732
        eopts := parseOpts(opts)
4✔
2733
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2734
                return ae
×
2735
        }
×
2736

2737
        return ApiErrors[JSSourceOverlappingSubjectFilters]
4✔
2738
}
2739

2740
// NewJSSourceWithMsgSchedulesError creates a new JSSourceWithMsgSchedulesErr error: "stream source can not also schedule messages"
2741
func NewJSSourceWithMsgSchedulesError(opts ...ErrorOption) *ApiError {
4✔
2742
        eopts := parseOpts(opts)
4✔
2743
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2744
                return ae
×
2745
        }
×
2746

2747
        return ApiErrors[JSSourceWithMsgSchedulesErr]
4✔
2748
}
2749

2750
// NewJSStorageResourcesExceededError creates a new JSStorageResourcesExceededErr error: "insufficient storage resources available"
2751
func NewJSStorageResourcesExceededError(opts ...ErrorOption) *ApiError {
40✔
2752
        eopts := parseOpts(opts)
40✔
2753
        if ae, ok := eopts.err.(*ApiError); ok {
40✔
2754
                return ae
×
2755
        }
×
2756

2757
        return ApiErrors[JSStorageResourcesExceededErr]
40✔
2758
}
2759

2760
// NewJSStreamAssignmentError creates a new JSStreamAssignmentErrF error: "{err}"
2761
func NewJSStreamAssignmentError(err error, opts ...ErrorOption) *ApiError {
×
2762
        eopts := parseOpts(opts)
×
2763
        if ae, ok := eopts.err.(*ApiError); ok {
×
2764
                return ae
×
2765
        }
×
2766

2767
        e := ApiErrors[JSStreamAssignmentErrF]
×
2768
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2769
        return &ApiError{
×
2770
                Code:        e.Code,
×
2771
                ErrCode:     e.ErrCode,
×
2772
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2773
        }
×
2774
}
2775

2776
// NewJSStreamCreateError creates a new JSStreamCreateErrF error: "{err}"
2777
func NewJSStreamCreateError(err error, opts ...ErrorOption) *ApiError {
79✔
2778
        eopts := parseOpts(opts)
79✔
2779
        if ae, ok := eopts.err.(*ApiError); ok {
155✔
2780
                return ae
76✔
2781
        }
76✔
2782

2783
        e := ApiErrors[JSStreamCreateErrF]
3✔
2784
        args := e.toReplacerArgs([]interface{}{"{err}", err})
3✔
2785
        return &ApiError{
3✔
2786
                Code:        e.Code,
3✔
2787
                ErrCode:     e.ErrCode,
3✔
2788
                Description: strings.NewReplacer(args...).Replace(e.Description),
3✔
2789
        }
3✔
2790
}
2791

2792
// NewJSStreamDeleteError creates a new JSStreamDeleteErrF error: "{err}"
2793
func NewJSStreamDeleteError(err error, opts ...ErrorOption) *ApiError {
×
2794
        eopts := parseOpts(opts)
×
2795
        if ae, ok := eopts.err.(*ApiError); ok {
×
2796
                return ae
×
2797
        }
×
2798

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

2808
// NewJSStreamDuplicateMessageConflictError creates a new JSStreamDuplicateMessageConflict error: "duplicate message id is in process"
2809
func NewJSStreamDuplicateMessageConflictError(opts ...ErrorOption) *ApiError {
123✔
2810
        eopts := parseOpts(opts)
123✔
2811
        if ae, ok := eopts.err.(*ApiError); ok {
123✔
2812
                return ae
×
2813
        }
×
2814

2815
        return ApiErrors[JSStreamDuplicateMessageConflict]
123✔
2816
}
2817

2818
// NewJSStreamExpectedLastSeqPerSubjectInvalidError creates a new JSStreamExpectedLastSeqPerSubjectInvalid error: "missing sequence for expected last sequence per subject"
2819
func NewJSStreamExpectedLastSeqPerSubjectInvalidError(opts ...ErrorOption) *ApiError {
8✔
2820
        eopts := parseOpts(opts)
8✔
2821
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
2822
                return ae
×
2823
        }
×
2824

2825
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectInvalid]
8✔
2826
}
2827

2828
// NewJSStreamExpectedLastSeqPerSubjectNotReadyError creates a new JSStreamExpectedLastSeqPerSubjectNotReady error: "expected last sequence per subject temporarily unavailable"
2829
func NewJSStreamExpectedLastSeqPerSubjectNotReadyError(opts ...ErrorOption) *ApiError {
×
2830
        eopts := parseOpts(opts)
×
2831
        if ae, ok := eopts.err.(*ApiError); ok {
×
2832
                return ae
×
2833
        }
×
2834

2835
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectNotReady]
×
2836
}
2837

2838
// NewJSStreamExternalApiOverlapError creates a new JSStreamExternalApiOverlapErrF error: "stream external api prefix {prefix} must not overlap with {subject}"
2839
func NewJSStreamExternalApiOverlapError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
2✔
2840
        eopts := parseOpts(opts)
2✔
2841
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2842
                return ae
×
2843
        }
×
2844

2845
        e := ApiErrors[JSStreamExternalApiOverlapErrF]
2✔
2846
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
2✔
2847
        return &ApiError{
2✔
2848
                Code:        e.Code,
2✔
2849
                ErrCode:     e.ErrCode,
2✔
2850
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2851
        }
2✔
2852
}
2853

2854
// NewJSStreamExternalDelPrefixOverlapsError creates a new JSStreamExternalDelPrefixOverlapsErrF error: "stream external delivery prefix {prefix} overlaps with stream subject {subject}"
2855
func NewJSStreamExternalDelPrefixOverlapsError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
×
2856
        eopts := parseOpts(opts)
×
2857
        if ae, ok := eopts.err.(*ApiError); ok {
×
2858
                return ae
×
2859
        }
×
2860

2861
        e := ApiErrors[JSStreamExternalDelPrefixOverlapsErrF]
×
2862
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
×
2863
        return &ApiError{
×
2864
                Code:        e.Code,
×
2865
                ErrCode:     e.ErrCode,
×
2866
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2867
        }
×
2868
}
2869

2870
// NewJSStreamGeneralError creates a new JSStreamGeneralErrorF error: "{err}"
2871
func NewJSStreamGeneralError(err error, opts ...ErrorOption) *ApiError {
5✔
2872
        eopts := parseOpts(opts)
5✔
2873
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2874
                return ae
×
2875
        }
×
2876

2877
        e := ApiErrors[JSStreamGeneralErrorF]
5✔
2878
        args := e.toReplacerArgs([]interface{}{"{err}", err})
5✔
2879
        return &ApiError{
5✔
2880
                Code:        e.Code,
5✔
2881
                ErrCode:     e.ErrCode,
5✔
2882
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
2883
        }
5✔
2884
}
2885

2886
// NewJSStreamHeaderExceedsMaximumError creates a new JSStreamHeaderExceedsMaximumErr error: "header size exceeds maximum allowed of 64k"
2887
func NewJSStreamHeaderExceedsMaximumError(opts ...ErrorOption) *ApiError {
1✔
2888
        eopts := parseOpts(opts)
1✔
2889
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2890
                return ae
×
2891
        }
×
2892

2893
        return ApiErrors[JSStreamHeaderExceedsMaximumErr]
1✔
2894
}
2895

2896
// NewJSStreamInfoMaxSubjectsError creates a new JSStreamInfoMaxSubjectsErr error: "subject details would exceed maximum allowed"
2897
func NewJSStreamInfoMaxSubjectsError(opts ...ErrorOption) *ApiError {
×
2898
        eopts := parseOpts(opts)
×
2899
        if ae, ok := eopts.err.(*ApiError); ok {
×
2900
                return ae
×
2901
        }
×
2902

2903
        return ApiErrors[JSStreamInfoMaxSubjectsErr]
×
2904
}
2905

2906
// NewJSStreamInvalidConfigError creates a new JSStreamInvalidConfigF error: "{err}"
2907
func NewJSStreamInvalidConfigError(err error, opts ...ErrorOption) *ApiError {
198✔
2908
        eopts := parseOpts(opts)
198✔
2909
        if ae, ok := eopts.err.(*ApiError); ok {
218✔
2910
                return ae
20✔
2911
        }
20✔
2912

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

2922
// NewJSStreamInvalidError creates a new JSStreamInvalidErr error: "stream not valid"
2923
func NewJSStreamInvalidError(opts ...ErrorOption) *ApiError {
×
2924
        eopts := parseOpts(opts)
×
2925
        if ae, ok := eopts.err.(*ApiError); ok {
×
2926
                return ae
×
2927
        }
×
2928

2929
        return ApiErrors[JSStreamInvalidErr]
×
2930
}
2931

2932
// NewJSStreamInvalidExternalDeliverySubjError creates a new JSStreamInvalidExternalDeliverySubjErrF error: "stream external delivery prefix {prefix} must not contain wildcards"
2933
func NewJSStreamInvalidExternalDeliverySubjError(prefix interface{}, opts ...ErrorOption) *ApiError {
×
2934
        eopts := parseOpts(opts)
×
2935
        if ae, ok := eopts.err.(*ApiError); ok {
×
2936
                return ae
×
2937
        }
×
2938

2939
        e := ApiErrors[JSStreamInvalidExternalDeliverySubjErrF]
×
2940
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix})
×
2941
        return &ApiError{
×
2942
                Code:        e.Code,
×
2943
                ErrCode:     e.ErrCode,
×
2944
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2945
        }
×
2946
}
2947

2948
// NewJSStreamLimitsError creates a new JSStreamLimitsErrF error: "{err}"
2949
func NewJSStreamLimitsError(err error, opts ...ErrorOption) *ApiError {
19✔
2950
        eopts := parseOpts(opts)
19✔
2951
        if ae, ok := eopts.err.(*ApiError); ok {
38✔
2952
                return ae
19✔
2953
        }
19✔
2954

2955
        e := ApiErrors[JSStreamLimitsErrF]
×
2956
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2957
        return &ApiError{
×
2958
                Code:        e.Code,
×
2959
                ErrCode:     e.ErrCode,
×
2960
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2961
        }
×
2962
}
2963

2964
// NewJSStreamMaxBytesRequiredError creates a new JSStreamMaxBytesRequired error: "account requires a stream config to have max bytes set"
2965
func NewJSStreamMaxBytesRequiredError(opts ...ErrorOption) *ApiError {
11✔
2966
        eopts := parseOpts(opts)
11✔
2967
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
2968
                return ae
×
2969
        }
×
2970

2971
        return ApiErrors[JSStreamMaxBytesRequired]
11✔
2972
}
2973

2974
// NewJSStreamMaxStreamBytesExceededError creates a new JSStreamMaxStreamBytesExceeded error: "stream max bytes exceeds account limit max stream bytes"
2975
func NewJSStreamMaxStreamBytesExceededError(opts ...ErrorOption) *ApiError {
12✔
2976
        eopts := parseOpts(opts)
12✔
2977
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
2978
                return ae
×
2979
        }
×
2980

2981
        return ApiErrors[JSStreamMaxStreamBytesExceeded]
12✔
2982
}
2983

2984
// NewJSStreamMessageExceedsMaximumError creates a new JSStreamMessageExceedsMaximumErr error: "message size exceeds maximum allowed"
2985
func NewJSStreamMessageExceedsMaximumError(opts ...ErrorOption) *ApiError {
15✔
2986
        eopts := parseOpts(opts)
15✔
2987
        if ae, ok := eopts.err.(*ApiError); ok {
15✔
2988
                return ae
×
2989
        }
×
2990

2991
        return ApiErrors[JSStreamMessageExceedsMaximumErr]
15✔
2992
}
2993

2994
// NewJSStreamMinLastSeqError creates a new JSStreamMinLastSeqErr error: "min last sequence"
2995
func NewJSStreamMinLastSeqError(opts ...ErrorOption) *ApiError {
×
2996
        eopts := parseOpts(opts)
×
2997
        if ae, ok := eopts.err.(*ApiError); ok {
×
2998
                return ae
×
2999
        }
×
3000

3001
        return ApiErrors[JSStreamMinLastSeqErr]
×
3002
}
3003

3004
// NewJSStreamMirrorNotUpdatableError creates a new JSStreamMirrorNotUpdatableErr error: "stream mirror configuration can not be updated"
3005
func NewJSStreamMirrorNotUpdatableError(opts ...ErrorOption) *ApiError {
4✔
3006
        eopts := parseOpts(opts)
4✔
3007
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
3008
                return ae
×
3009
        }
×
3010

3011
        return ApiErrors[JSStreamMirrorNotUpdatableErr]
4✔
3012
}
3013

3014
// NewJSStreamMismatchError creates a new JSStreamMismatchErr error: "stream name in subject does not match request"
3015
func NewJSStreamMismatchError(opts ...ErrorOption) *ApiError {
7✔
3016
        eopts := parseOpts(opts)
7✔
3017
        if ae, ok := eopts.err.(*ApiError); ok {
7✔
3018
                return ae
×
3019
        }
×
3020

3021
        return ApiErrors[JSStreamMismatchErr]
7✔
3022
}
3023

3024
// NewJSStreamMoveAndScaleError creates a new JSStreamMoveAndScaleErr error: "can not move and scale a stream in a single update"
3025
func NewJSStreamMoveAndScaleError(opts ...ErrorOption) *ApiError {
4✔
3026
        eopts := parseOpts(opts)
4✔
3027
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
3028
                return ae
×
3029
        }
×
3030

3031
        return ApiErrors[JSStreamMoveAndScaleErr]
4✔
3032
}
3033

3034
// NewJSStreamMoveInProgressError creates a new JSStreamMoveInProgressF error: "stream move already in progress: {msg}"
3035
func NewJSStreamMoveInProgressError(msg interface{}, opts ...ErrorOption) *ApiError {
2✔
3036
        eopts := parseOpts(opts)
2✔
3037
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
3038
                return ae
×
3039
        }
×
3040

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

3050
// NewJSStreamMoveNotInProgressError creates a new JSStreamMoveNotInProgress error: "stream move not in progress"
3051
func NewJSStreamMoveNotInProgressError(opts ...ErrorOption) *ApiError {
×
3052
        eopts := parseOpts(opts)
×
3053
        if ae, ok := eopts.err.(*ApiError); ok {
×
3054
                return ae
×
3055
        }
×
3056

3057
        return ApiErrors[JSStreamMoveNotInProgress]
×
3058
}
3059

3060
// NewJSStreamMsgDeleteFailedError creates a new JSStreamMsgDeleteFailedF error: "{err}"
3061
func NewJSStreamMsgDeleteFailedError(err error, opts ...ErrorOption) *ApiError {
2,313✔
3062
        eopts := parseOpts(opts)
2,313✔
3063
        if ae, ok := eopts.err.(*ApiError); ok {
2,313✔
3064
                return ae
×
3065
        }
×
3066

3067
        e := ApiErrors[JSStreamMsgDeleteFailedF]
2,313✔
3068
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2,313✔
3069
        return &ApiError{
2,313✔
3070
                Code:        e.Code,
2,313✔
3071
                ErrCode:     e.ErrCode,
2,313✔
3072
                Description: strings.NewReplacer(args...).Replace(e.Description),
2,313✔
3073
        }
2,313✔
3074
}
3075

3076
// NewJSStreamNameContainsPathSeparatorsError creates a new JSStreamNameContainsPathSeparatorsErr error: "Stream name can not contain path separators"
3077
func NewJSStreamNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
6✔
3078
        eopts := parseOpts(opts)
6✔
3079
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
3080
                return ae
×
3081
        }
×
3082

3083
        return ApiErrors[JSStreamNameContainsPathSeparatorsErr]
6✔
3084
}
3085

3086
// NewJSStreamNameExistError creates a new JSStreamNameExistErr error: "stream name already in use with a different configuration"
3087
func NewJSStreamNameExistError(opts ...ErrorOption) *ApiError {
10✔
3088
        eopts := parseOpts(opts)
10✔
3089
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
3090
                return ae
×
3091
        }
×
3092

3093
        return ApiErrors[JSStreamNameExistErr]
10✔
3094
}
3095

3096
// NewJSStreamNameExistRestoreFailedError creates a new JSStreamNameExistRestoreFailedErr error: "stream name already in use, cannot restore"
3097
func NewJSStreamNameExistRestoreFailedError(opts ...ErrorOption) *ApiError {
7✔
3098
        eopts := parseOpts(opts)
7✔
3099
        if ae, ok := eopts.err.(*ApiError); ok {
7✔
3100
                return ae
×
3101
        }
×
3102

3103
        return ApiErrors[JSStreamNameExistRestoreFailedErr]
7✔
3104
}
3105

3106
// NewJSStreamNotFoundError creates a new JSStreamNotFoundErr error: "stream not found"
3107
func NewJSStreamNotFoundError(opts ...ErrorOption) *ApiError {
30,091✔
3108
        eopts := parseOpts(opts)
30,091✔
3109
        if ae, ok := eopts.err.(*ApiError); ok {
30,418✔
3110
                return ae
327✔
3111
        }
327✔
3112

3113
        return ApiErrors[JSStreamNotFoundErr]
29,764✔
3114
}
3115

3116
// NewJSStreamNotMatchError creates a new JSStreamNotMatchErr error: "expected stream does not match"
3117
func NewJSStreamNotMatchError(opts ...ErrorOption) *ApiError {
1✔
3118
        eopts := parseOpts(opts)
1✔
3119
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3120
                return ae
×
3121
        }
×
3122

3123
        return ApiErrors[JSStreamNotMatchErr]
1✔
3124
}
3125

3126
// NewJSStreamOfflineError creates a new JSStreamOfflineErr error: "stream is offline"
3127
func NewJSStreamOfflineError(opts ...ErrorOption) *ApiError {
8✔
3128
        eopts := parseOpts(opts)
8✔
3129
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
3130
                return ae
×
3131
        }
×
3132

3133
        return ApiErrors[JSStreamOfflineErr]
8✔
3134
}
3135

3136
// NewJSStreamOfflineReasonError creates a new JSStreamOfflineReasonErrF error: "stream is offline: {err}"
3137
func NewJSStreamOfflineReasonError(err error, opts ...ErrorOption) *ApiError {
40✔
3138
        eopts := parseOpts(opts)
40✔
3139
        if ae, ok := eopts.err.(*ApiError); ok {
40✔
3140
                return ae
×
3141
        }
×
3142

3143
        e := ApiErrors[JSStreamOfflineReasonErrF]
40✔
3144
        args := e.toReplacerArgs([]interface{}{"{err}", err})
40✔
3145
        return &ApiError{
40✔
3146
                Code:        e.Code,
40✔
3147
                ErrCode:     e.ErrCode,
40✔
3148
                Description: strings.NewReplacer(args...).Replace(e.Description),
40✔
3149
        }
40✔
3150
}
3151

3152
// NewJSStreamPurgeFailedError creates a new JSStreamPurgeFailedF error: "{err}"
3153
func NewJSStreamPurgeFailedError(err error, opts ...ErrorOption) *ApiError {
1✔
3154
        eopts := parseOpts(opts)
1✔
3155
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3156
                return ae
×
3157
        }
×
3158

3159
        e := ApiErrors[JSStreamPurgeFailedF]
1✔
3160
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
3161
        return &ApiError{
1✔
3162
                Code:        e.Code,
1✔
3163
                ErrCode:     e.ErrCode,
1✔
3164
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
3165
        }
1✔
3166
}
3167

3168
// NewJSStreamReplicasNotSupportedError creates a new JSStreamReplicasNotSupportedErr error: "replicas > 1 not supported in non-clustered mode"
3169
func NewJSStreamReplicasNotSupportedError(opts ...ErrorOption) *ApiError {
×
3170
        eopts := parseOpts(opts)
×
3171
        if ae, ok := eopts.err.(*ApiError); ok {
×
3172
                return ae
×
3173
        }
×
3174

3175
        return ApiErrors[JSStreamReplicasNotSupportedErr]
×
3176
}
3177

3178
// NewJSStreamReplicasNotUpdatableError creates a new JSStreamReplicasNotUpdatableErr error: "Replicas configuration can not be updated"
3179
func NewJSStreamReplicasNotUpdatableError(opts ...ErrorOption) *ApiError {
×
3180
        eopts := parseOpts(opts)
×
3181
        if ae, ok := eopts.err.(*ApiError); ok {
×
3182
                return ae
×
3183
        }
×
3184

3185
        return ApiErrors[JSStreamReplicasNotUpdatableErr]
×
3186
}
3187

3188
// NewJSStreamRestoreError creates a new JSStreamRestoreErrF error: "restore failed: {err}"
3189
func NewJSStreamRestoreError(err error, opts ...ErrorOption) *ApiError {
7✔
3190
        eopts := parseOpts(opts)
7✔
3191
        if ae, ok := eopts.err.(*ApiError); ok {
9✔
3192
                return ae
2✔
3193
        }
2✔
3194

3195
        e := ApiErrors[JSStreamRestoreErrF]
5✔
3196
        args := e.toReplacerArgs([]interface{}{"{err}", err})
5✔
3197
        return &ApiError{
5✔
3198
                Code:        e.Code,
5✔
3199
                ErrCode:     e.ErrCode,
5✔
3200
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
3201
        }
5✔
3202
}
3203

3204
// NewJSStreamRollupFailedError creates a new JSStreamRollupFailedF error: "{err}"
3205
func NewJSStreamRollupFailedError(err error, opts ...ErrorOption) *ApiError {
5✔
3206
        eopts := parseOpts(opts)
5✔
3207
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
3208
                return ae
×
3209
        }
×
3210

3211
        e := ApiErrors[JSStreamRollupFailedF]
5✔
3212
        args := e.toReplacerArgs([]interface{}{"{err}", err})
5✔
3213
        return &ApiError{
5✔
3214
                Code:        e.Code,
5✔
3215
                ErrCode:     e.ErrCode,
5✔
3216
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
3217
        }
5✔
3218
}
3219

3220
// NewJSStreamSealedError creates a new JSStreamSealedErr error: "invalid operation on sealed stream"
3221
func NewJSStreamSealedError(opts ...ErrorOption) *ApiError {
8✔
3222
        eopts := parseOpts(opts)
8✔
3223
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
3224
                return ae
×
3225
        }
×
3226

3227
        return ApiErrors[JSStreamSealedErr]
8✔
3228
}
3229

3230
// NewJSStreamSequenceNotMatchError creates a new JSStreamSequenceNotMatchErr error: "expected stream sequence does not match"
3231
func NewJSStreamSequenceNotMatchError(opts ...ErrorOption) *ApiError {
×
3232
        eopts := parseOpts(opts)
×
3233
        if ae, ok := eopts.err.(*ApiError); ok {
×
3234
                return ae
×
3235
        }
×
3236

3237
        return ApiErrors[JSStreamSequenceNotMatchErr]
×
3238
}
3239

3240
// NewJSStreamSnapshotError creates a new JSStreamSnapshotErrF error: "snapshot failed: {err}"
3241
func NewJSStreamSnapshotError(err error, opts ...ErrorOption) *ApiError {
×
3242
        eopts := parseOpts(opts)
×
3243
        if ae, ok := eopts.err.(*ApiError); ok {
×
3244
                return ae
×
3245
        }
×
3246

3247
        e := ApiErrors[JSStreamSnapshotErrF]
×
3248
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
3249
        return &ApiError{
×
3250
                Code:        e.Code,
×
3251
                ErrCode:     e.ErrCode,
×
3252
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
3253
        }
×
3254
}
3255

3256
// NewJSStreamStoreFailedError creates a new JSStreamStoreFailedF error: "{err}"
3257
func NewJSStreamStoreFailedError(err error, opts ...ErrorOption) *ApiError {
2,976✔
3258
        eopts := parseOpts(opts)
2,976✔
3259
        if ae, ok := eopts.err.(*ApiError); ok {
2,976✔
3260
                return ae
×
3261
        }
×
3262

3263
        e := ApiErrors[JSStreamStoreFailedF]
2,976✔
3264
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2,976✔
3265
        return &ApiError{
2,976✔
3266
                Code:        e.Code,
2,976✔
3267
                ErrCode:     e.ErrCode,
2,976✔
3268
                Description: strings.NewReplacer(args...).Replace(e.Description),
2,976✔
3269
        }
2,976✔
3270
}
3271

3272
// NewJSStreamSubjectOverlapError creates a new JSStreamSubjectOverlapErr error: "subjects overlap with an existing stream"
3273
func NewJSStreamSubjectOverlapError(opts ...ErrorOption) *ApiError {
25✔
3274
        eopts := parseOpts(opts)
25✔
3275
        if ae, ok := eopts.err.(*ApiError); ok {
25✔
3276
                return ae
×
3277
        }
×
3278

3279
        return ApiErrors[JSStreamSubjectOverlapErr]
25✔
3280
}
3281

3282
// NewJSStreamTemplateCreateError creates a new JSStreamTemplateCreateErrF error: "{err}"
3283
func NewJSStreamTemplateCreateError(err error, opts ...ErrorOption) *ApiError {
×
3284
        eopts := parseOpts(opts)
×
3285
        if ae, ok := eopts.err.(*ApiError); ok {
×
3286
                return ae
×
3287
        }
×
3288

3289
        e := ApiErrors[JSStreamTemplateCreateErrF]
×
3290
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
3291
        return &ApiError{
×
3292
                Code:        e.Code,
×
3293
                ErrCode:     e.ErrCode,
×
3294
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
3295
        }
×
3296
}
3297

3298
// NewJSStreamTemplateDeleteError creates a new JSStreamTemplateDeleteErrF error: "{err}"
3299
func NewJSStreamTemplateDeleteError(err error, opts ...ErrorOption) *ApiError {
×
3300
        eopts := parseOpts(opts)
×
3301
        if ae, ok := eopts.err.(*ApiError); ok {
×
3302
                return ae
×
3303
        }
×
3304

3305
        e := ApiErrors[JSStreamTemplateDeleteErrF]
×
3306
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
3307
        return &ApiError{
×
3308
                Code:        e.Code,
×
3309
                ErrCode:     e.ErrCode,
×
3310
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
3311
        }
×
3312
}
3313

3314
// NewJSStreamTemplateNotFoundError creates a new JSStreamTemplateNotFoundErr error: "template not found"
3315
func NewJSStreamTemplateNotFoundError(opts ...ErrorOption) *ApiError {
×
3316
        eopts := parseOpts(opts)
×
3317
        if ae, ok := eopts.err.(*ApiError); ok {
×
3318
                return ae
×
3319
        }
×
3320

3321
        return ApiErrors[JSStreamTemplateNotFoundErr]
×
3322
}
3323

3324
// NewJSStreamTooManyRequestsError creates a new JSStreamTooManyRequests error: "too many requests"
3325
func NewJSStreamTooManyRequestsError(opts ...ErrorOption) *ApiError {
95✔
3326
        eopts := parseOpts(opts)
95✔
3327
        if ae, ok := eopts.err.(*ApiError); ok {
95✔
3328
                return ae
×
3329
        }
×
3330

3331
        return ApiErrors[JSStreamTooManyRequests]
95✔
3332
}
3333

3334
// NewJSStreamTransformInvalidDestinationError creates a new JSStreamTransformInvalidDestination error: "stream transform: {err}"
3335
func NewJSStreamTransformInvalidDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
3336
        eopts := parseOpts(opts)
1✔
3337
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3338
                return ae
×
3339
        }
×
3340

3341
        e := ApiErrors[JSStreamTransformInvalidDestination]
1✔
3342
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
3343
        return &ApiError{
1✔
3344
                Code:        e.Code,
1✔
3345
                ErrCode:     e.ErrCode,
1✔
3346
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
3347
        }
1✔
3348
}
3349

3350
// NewJSStreamTransformInvalidSourceError creates a new JSStreamTransformInvalidSource error: "stream transform source: {err}"
3351
func NewJSStreamTransformInvalidSourceError(err error, opts ...ErrorOption) *ApiError {
1✔
3352
        eopts := parseOpts(opts)
1✔
3353
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3354
                return ae
×
3355
        }
×
3356

3357
        e := ApiErrors[JSStreamTransformInvalidSource]
1✔
3358
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
3359
        return &ApiError{
1✔
3360
                Code:        e.Code,
1✔
3361
                ErrCode:     e.ErrCode,
1✔
3362
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
3363
        }
1✔
3364
}
3365

3366
// NewJSStreamUpdateError creates a new JSStreamUpdateErrF error: "{err}"
3367
func NewJSStreamUpdateError(err error, opts ...ErrorOption) *ApiError {
33✔
3368
        eopts := parseOpts(opts)
33✔
3369
        if ae, ok := eopts.err.(*ApiError); ok {
60✔
3370
                return ae
27✔
3371
        }
27✔
3372

3373
        e := ApiErrors[JSStreamUpdateErrF]
6✔
3374
        args := e.toReplacerArgs([]interface{}{"{err}", err})
6✔
3375
        return &ApiError{
6✔
3376
                Code:        e.Code,
6✔
3377
                ErrCode:     e.ErrCode,
6✔
3378
                Description: strings.NewReplacer(args...).Replace(e.Description),
6✔
3379
        }
6✔
3380
}
3381

3382
// NewJSStreamWrongLastMsgIDError creates a new JSStreamWrongLastMsgIDErrF error: "wrong last msg ID: {id}"
3383
func NewJSStreamWrongLastMsgIDError(id interface{}, opts ...ErrorOption) *ApiError {
1✔
3384
        eopts := parseOpts(opts)
1✔
3385
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3386
                return ae
×
3387
        }
×
3388

3389
        e := ApiErrors[JSStreamWrongLastMsgIDErrF]
1✔
3390
        args := e.toReplacerArgs([]interface{}{"{id}", id})
1✔
3391
        return &ApiError{
1✔
3392
                Code:        e.Code,
1✔
3393
                ErrCode:     e.ErrCode,
1✔
3394
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
3395
        }
1✔
3396
}
3397

3398
// NewJSStreamWrongLastSequenceConstantError creates a new JSStreamWrongLastSequenceConstantErr error: "wrong last sequence"
3399
func NewJSStreamWrongLastSequenceConstantError(opts ...ErrorOption) *ApiError {
23✔
3400
        eopts := parseOpts(opts)
23✔
3401
        if ae, ok := eopts.err.(*ApiError); ok {
23✔
3402
                return ae
×
3403
        }
×
3404

3405
        return ApiErrors[JSStreamWrongLastSequenceConstantErr]
23✔
3406
}
3407

3408
// NewJSStreamWrongLastSequenceError creates a new JSStreamWrongLastSequenceErrF error: "wrong last sequence: {seq}"
3409
func NewJSStreamWrongLastSequenceError(seq uint64, opts ...ErrorOption) *ApiError {
126✔
3410
        eopts := parseOpts(opts)
126✔
3411
        if ae, ok := eopts.err.(*ApiError); ok {
126✔
3412
                return ae
×
3413
        }
×
3414

3415
        e := ApiErrors[JSStreamWrongLastSequenceErrF]
126✔
3416
        args := e.toReplacerArgs([]interface{}{"{seq}", seq})
126✔
3417
        return &ApiError{
126✔
3418
                Code:        e.Code,
126✔
3419
                ErrCode:     e.ErrCode,
126✔
3420
                Description: strings.NewReplacer(args...).Replace(e.Description),
126✔
3421
        }
126✔
3422
}
3423

3424
// NewJSTempStorageFailedError creates a new JSTempStorageFailedErr error: "JetStream unable to open temp storage for restore"
3425
func NewJSTempStorageFailedError(opts ...ErrorOption) *ApiError {
×
3426
        eopts := parseOpts(opts)
×
3427
        if ae, ok := eopts.err.(*ApiError); ok {
×
3428
                return ae
×
3429
        }
×
3430

3431
        return ApiErrors[JSTempStorageFailedErr]
×
3432
}
3433

3434
// NewJSTemplateNameNotMatchSubjectError creates a new JSTemplateNameNotMatchSubjectErr error: "template name in subject does not match request"
3435
func NewJSTemplateNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
×
3436
        eopts := parseOpts(opts)
×
3437
        if ae, ok := eopts.err.(*ApiError); ok {
×
3438
                return ae
×
3439
        }
×
3440

3441
        return ApiErrors[JSTemplateNameNotMatchSubjectErr]
×
3442
}
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