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

nats-io / nats-server / 22792489433

06 Mar 2026 03:18PM UTC coverage: 83.041% (+0.05%) from 82.988%
22792489433

push

github

web-flow
[IMPROVED] Always compact, even for non-changed state (#7913)

These conditions were effectively noops. We need to snapshot/compact
when we reach minimum compaction limits, and this compaction needs to
happen regardless of if stream/consumer state changed or not. Actually
in the case of consumers, `EncodedState` isn't guaranteed to equal
byte-by-byte either, since `Pending` and `Redelivered` are maps and are
iterated randomly by Go (credit to @wallyqs for this one).

This PR is purely a code improvement and doesn't have any functional
differences.

Signed-off-by: Maurice van Veen <github@mauricevanveen.com>

75136 of 90481 relevant lines covered (83.04%)

360439.86 hits per line

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

56.14
/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
        // JSAtomicPublishUnsupportedHeaderBatchErr atomic publish unsupported header used: {header}
33
        JSAtomicPublishUnsupportedHeaderBatchErr ErrorIdentifier = 10177
34

35
        // JSBadRequestErr bad request
36
        JSBadRequestErr ErrorIdentifier = 10003
37

38
        // JSBatchPublishDisabledErr batch publish is disabled
39
        JSBatchPublishDisabledErr ErrorIdentifier = 10205
40

41
        // JSBatchPublishInvalidBatchIDErr batch publish ID is invalid
42
        JSBatchPublishInvalidBatchIDErr ErrorIdentifier = 10207
43

44
        // JSBatchPublishInvalidPatternErr batch publish pattern is invalid
45
        JSBatchPublishInvalidPatternErr ErrorIdentifier = 10206
46

47
        // JSBatchPublishUnknownBatchIDErr batch publish ID unknown
48
        JSBatchPublishUnknownBatchIDErr ErrorIdentifier = 10208
49

50
        // JSClusterIncompleteErr incomplete results
51
        JSClusterIncompleteErr ErrorIdentifier = 10004
52

53
        // JSClusterNoPeersErrF Error causing no peers to be available ({err})
54
        JSClusterNoPeersErrF ErrorIdentifier = 10005
55

56
        // JSClusterNotActiveErr JetStream not in clustered mode
57
        JSClusterNotActiveErr ErrorIdentifier = 10006
58

59
        // JSClusterNotAssignedErr JetStream cluster not assigned to this server
60
        JSClusterNotAssignedErr ErrorIdentifier = 10007
61

62
        // JSClusterNotAvailErr JetStream system temporarily unavailable
63
        JSClusterNotAvailErr ErrorIdentifier = 10008
64

65
        // JSClusterNotLeaderErr JetStream cluster can not handle request
66
        JSClusterNotLeaderErr ErrorIdentifier = 10009
67

68
        // JSClusterPeerNotMemberErr peer not a member
69
        JSClusterPeerNotMemberErr ErrorIdentifier = 10040
70

71
        // JSClusterRequiredErr JetStream clustering support required
72
        JSClusterRequiredErr ErrorIdentifier = 10010
73

74
        // JSClusterServerMemberChangeInflightErr cluster member change is in progress
75
        JSClusterServerMemberChangeInflightErr ErrorIdentifier = 10202
76

77
        // JSClusterServerNotMemberErr server is not a member of the cluster
78
        JSClusterServerNotMemberErr ErrorIdentifier = 10044
79

80
        // JSClusterTagsErr tags placement not supported for operation
81
        JSClusterTagsErr ErrorIdentifier = 10011
82

83
        // JSClusterUnSupportFeatureErr not currently supported in clustered mode
84
        JSClusterUnSupportFeatureErr ErrorIdentifier = 10036
85

86
        // JSConsumerAckPolicyInvalidErr consumer ack policy invalid
87
        JSConsumerAckPolicyInvalidErr ErrorIdentifier = 10181
88

89
        // JSConsumerAckWaitNegativeErr consumer ack wait needs to be positive
90
        JSConsumerAckWaitNegativeErr ErrorIdentifier = 10183
91

92
        // JSConsumerAlreadyExists action CREATE is used for a existing consumer with a different config (consumer already exists)
93
        JSConsumerAlreadyExists ErrorIdentifier = 10148
94

95
        // JSConsumerBackOffNegativeErr consumer backoff needs to be positive
96
        JSConsumerBackOffNegativeErr ErrorIdentifier = 10184
97

98
        // JSConsumerBadDurableNameErr durable name can not contain '.', '*', '>'
99
        JSConsumerBadDurableNameErr ErrorIdentifier = 10103
100

101
        // JSConsumerConfigRequiredErr consumer config required
102
        JSConsumerConfigRequiredErr ErrorIdentifier = 10078
103

104
        // JSConsumerCreateDurableAndNameMismatch Consumer Durable and Name have to be equal if both are provided
105
        JSConsumerCreateDurableAndNameMismatch ErrorIdentifier = 10132
106

107
        // JSConsumerCreateErrF General consumer creation failure string ({err})
108
        JSConsumerCreateErrF ErrorIdentifier = 10012
109

110
        // JSConsumerCreateFilterSubjectMismatchErr Consumer create request did not match filtered subject from create subject
111
        JSConsumerCreateFilterSubjectMismatchErr ErrorIdentifier = 10131
112

113
        // JSConsumerDeliverCycleErr consumer deliver subject forms a cycle
114
        JSConsumerDeliverCycleErr ErrorIdentifier = 10081
115

116
        // JSConsumerDeliverToWildcardsErr consumer deliver subject has wildcards
117
        JSConsumerDeliverToWildcardsErr ErrorIdentifier = 10079
118

119
        // JSConsumerDescriptionTooLongErrF consumer description is too long, maximum allowed is {max}
120
        JSConsumerDescriptionTooLongErrF ErrorIdentifier = 10107
121

122
        // JSConsumerDirectRequiresEphemeralErr consumer direct requires an ephemeral consumer
123
        JSConsumerDirectRequiresEphemeralErr ErrorIdentifier = 10091
124

125
        // JSConsumerDirectRequiresPushErr consumer direct requires a push based consumer
126
        JSConsumerDirectRequiresPushErr ErrorIdentifier = 10090
127

128
        // JSConsumerDoesNotExist action UPDATE is used for a nonexisting consumer (consumer does not exist)
129
        JSConsumerDoesNotExist ErrorIdentifier = 10149
130

131
        // JSConsumerDuplicateFilterSubjects consumer cannot have both FilterSubject and FilterSubjects specified
132
        JSConsumerDuplicateFilterSubjects ErrorIdentifier = 10136
133

134
        // JSConsumerDurableNameNotInSubjectErr consumer expected to be durable but no durable name set in subject
135
        JSConsumerDurableNameNotInSubjectErr ErrorIdentifier = 10016
136

137
        // JSConsumerDurableNameNotMatchSubjectErr consumer name in subject does not match durable name in request
138
        JSConsumerDurableNameNotMatchSubjectErr ErrorIdentifier = 10017
139

140
        // JSConsumerDurableNameNotSetErr consumer expected to be durable but a durable name was not set
141
        JSConsumerDurableNameNotSetErr ErrorIdentifier = 10018
142

143
        // JSConsumerEmptyFilter consumer filter in FilterSubjects cannot be empty
144
        JSConsumerEmptyFilter ErrorIdentifier = 10139
145

146
        // JSConsumerEmptyGroupName Group name cannot be an empty string
147
        JSConsumerEmptyGroupName ErrorIdentifier = 10161
148

149
        // JSConsumerEphemeralWithDurableInSubjectErr consumer expected to be ephemeral but detected a durable name set in subject
150
        JSConsumerEphemeralWithDurableInSubjectErr ErrorIdentifier = 10019
151

152
        // JSConsumerEphemeralWithDurableNameErr consumer expected to be ephemeral but a durable name was set in request
153
        JSConsumerEphemeralWithDurableNameErr ErrorIdentifier = 10020
154

155
        // JSConsumerExistingActiveErr consumer already exists and is still active
156
        JSConsumerExistingActiveErr ErrorIdentifier = 10105
157

158
        // JSConsumerFCRequiresPushErr consumer flow control requires a push based consumer
159
        JSConsumerFCRequiresPushErr ErrorIdentifier = 10089
160

161
        // JSConsumerFilterNotSubsetErr consumer filter subject is not a valid subset of the interest subjects
162
        JSConsumerFilterNotSubsetErr ErrorIdentifier = 10093
163

164
        // JSConsumerHBRequiresPushErr consumer idle heartbeat requires a push based consumer
165
        JSConsumerHBRequiresPushErr ErrorIdentifier = 10088
166

167
        // JSConsumerInactiveThresholdExcess consumer inactive threshold exceeds system limit of {limit}
168
        JSConsumerInactiveThresholdExcess ErrorIdentifier = 10153
169

170
        // JSConsumerInvalidDeliverSubject invalid push consumer deliver subject
171
        JSConsumerInvalidDeliverSubject ErrorIdentifier = 10112
172

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

176
        // JSConsumerInvalidPolicyErrF Generic delivery policy error ({err})
177
        JSConsumerInvalidPolicyErrF ErrorIdentifier = 10094
178

179
        // JSConsumerInvalidPriorityGroupErr Provided priority group does not exist for this consumer
180
        JSConsumerInvalidPriorityGroupErr ErrorIdentifier = 10160
181

182
        // JSConsumerInvalidResetErr invalid reset: {err}
183
        JSConsumerInvalidResetErr ErrorIdentifier = 10204
184

185
        // JSConsumerInvalidSamplingErrF failed to parse consumer sampling configuration: {err}
186
        JSConsumerInvalidSamplingErrF ErrorIdentifier = 10095
187

188
        // JSConsumerMaxDeliverBackoffErr max deliver is required to be > length of backoff values
189
        JSConsumerMaxDeliverBackoffErr ErrorIdentifier = 10116
190

191
        // JSConsumerMaxPendingAckExcessErrF consumer max ack pending exceeds system limit of {limit}
192
        JSConsumerMaxPendingAckExcessErrF ErrorIdentifier = 10121
193

194
        // JSConsumerMaxPendingAckPolicyRequiredErr consumer requires ack policy for max ack pending
195
        JSConsumerMaxPendingAckPolicyRequiredErr ErrorIdentifier = 10082
196

197
        // JSConsumerMaxRequestBatchExceededF consumer max request batch exceeds server limit of {limit}
198
        JSConsumerMaxRequestBatchExceededF ErrorIdentifier = 10125
199

200
        // JSConsumerMaxRequestBatchNegativeErr consumer max request batch needs to be > 0
201
        JSConsumerMaxRequestBatchNegativeErr ErrorIdentifier = 10114
202

203
        // JSConsumerMaxRequestExpiresTooSmall consumer max request expires needs to be >= 1ms
204
        JSConsumerMaxRequestExpiresTooSmall ErrorIdentifier = 10115
205

206
        // JSConsumerMaxWaitingNegativeErr consumer max waiting needs to be positive
207
        JSConsumerMaxWaitingNegativeErr ErrorIdentifier = 10087
208

209
        // JSConsumerMetadataLengthErrF consumer metadata exceeds maximum size of {limit}
210
        JSConsumerMetadataLengthErrF ErrorIdentifier = 10135
211

212
        // JSConsumerMultipleFiltersNotAllowed consumer with multiple subject filters cannot use subject based API
213
        JSConsumerMultipleFiltersNotAllowed ErrorIdentifier = 10137
214

215
        // JSConsumerNameContainsPathSeparatorsErr Consumer name can not contain path separators
216
        JSConsumerNameContainsPathSeparatorsErr ErrorIdentifier = 10127
217

218
        // JSConsumerNameExistErr consumer name already in use
219
        JSConsumerNameExistErr ErrorIdentifier = 10013
220

221
        // JSConsumerNameTooLongErrF consumer name is too long, maximum allowed is {max}
222
        JSConsumerNameTooLongErrF ErrorIdentifier = 10102
223

224
        // JSConsumerNotFoundErr consumer not found
225
        JSConsumerNotFoundErr ErrorIdentifier = 10014
226

227
        // JSConsumerOfflineErr consumer is offline
228
        JSConsumerOfflineErr ErrorIdentifier = 10119
229

230
        // JSConsumerOfflineReasonErrF consumer is offline: {err}
231
        JSConsumerOfflineReasonErrF ErrorIdentifier = 10195
232

233
        // JSConsumerOnMappedErr consumer direct on a mapped consumer
234
        JSConsumerOnMappedErr ErrorIdentifier = 10092
235

236
        // JSConsumerOverlappingSubjectFilters consumer subject filters cannot overlap
237
        JSConsumerOverlappingSubjectFilters ErrorIdentifier = 10138
238

239
        // JSConsumerPinnedTTLWithoutPriorityPolicyNone PinnedTTL cannot be set when PriorityPolicy is none
240
        JSConsumerPinnedTTLWithoutPriorityPolicyNone ErrorIdentifier = 10197
241

242
        // JSConsumerPriorityGroupWithPolicyNone consumer can not have priority groups when policy is none
243
        JSConsumerPriorityGroupWithPolicyNone ErrorIdentifier = 10196
244

245
        // JSConsumerPriorityPolicyWithoutGroup Setting PriorityPolicy requires at least one PriorityGroup to be set
246
        JSConsumerPriorityPolicyWithoutGroup ErrorIdentifier = 10159
247

248
        // JSConsumerPullNotDurableErr consumer in pull mode requires a durable name
249
        JSConsumerPullNotDurableErr ErrorIdentifier = 10085
250

251
        // JSConsumerPullRequiresAckErr consumer in pull mode requires explicit ack policy on workqueue stream
252
        JSConsumerPullRequiresAckErr ErrorIdentifier = 10084
253

254
        // JSConsumerPullWithRateLimitErr consumer in pull mode can not have rate limit set
255
        JSConsumerPullWithRateLimitErr ErrorIdentifier = 10086
256

257
        // JSConsumerPushMaxWaitingErr consumer in push mode can not set max waiting
258
        JSConsumerPushMaxWaitingErr ErrorIdentifier = 10080
259

260
        // JSConsumerPushWithPriorityGroupErr priority groups can not be used with push consumers
261
        JSConsumerPushWithPriorityGroupErr ErrorIdentifier = 10178
262

263
        // JSConsumerReplacementWithDifferentNameErr consumer replacement durable config not the same
264
        JSConsumerReplacementWithDifferentNameErr ErrorIdentifier = 10106
265

266
        // JSConsumerReplayPolicyInvalidErr consumer replay policy invalid
267
        JSConsumerReplayPolicyInvalidErr ErrorIdentifier = 10182
268

269
        // JSConsumerReplicasExceedsStream consumer config replica count exceeds parent stream
270
        JSConsumerReplicasExceedsStream ErrorIdentifier = 10126
271

272
        // JSConsumerReplicasShouldMatchStream consumer config replicas must match interest retention stream's replicas
273
        JSConsumerReplicasShouldMatchStream ErrorIdentifier = 10134
274

275
        // JSConsumerSmallHeartbeatErr consumer idle heartbeat needs to be >= 100ms
276
        JSConsumerSmallHeartbeatErr ErrorIdentifier = 10083
277

278
        // JSConsumerStoreFailedErrF error creating store for consumer: {err}
279
        JSConsumerStoreFailedErrF ErrorIdentifier = 10104
280

281
        // JSConsumerWQConsumerNotDeliverAllErr consumer must be deliver all on workqueue stream
282
        JSConsumerWQConsumerNotDeliverAllErr ErrorIdentifier = 10101
283

284
        // JSConsumerWQConsumerNotUniqueErr filtered consumer not unique on workqueue stream
285
        JSConsumerWQConsumerNotUniqueErr ErrorIdentifier = 10100
286

287
        // JSConsumerWQMultipleUnfilteredErr multiple non-filtered consumers not allowed on workqueue stream
288
        JSConsumerWQMultipleUnfilteredErr ErrorIdentifier = 10099
289

290
        // JSConsumerWQRequiresExplicitAckErr workqueue stream requires explicit ack
291
        JSConsumerWQRequiresExplicitAckErr ErrorIdentifier = 10098
292

293
        // JSConsumerWithFlowControlNeedsHeartbeats consumer with flow control also needs heartbeats
294
        JSConsumerWithFlowControlNeedsHeartbeats ErrorIdentifier = 10108
295

296
        // JSInsufficientResourcesErr insufficient resources
297
        JSInsufficientResourcesErr ErrorIdentifier = 10023
298

299
        // JSInvalidJSONErr invalid JSON: {err}
300
        JSInvalidJSONErr ErrorIdentifier = 10025
301

302
        // JSMaximumConsumersLimitErr maximum consumers limit reached
303
        JSMaximumConsumersLimitErr ErrorIdentifier = 10026
304

305
        // JSMaximumStreamsLimitErr maximum number of streams reached
306
        JSMaximumStreamsLimitErr ErrorIdentifier = 10027
307

308
        // JSMemoryResourcesExceededErr insufficient memory resources available
309
        JSMemoryResourcesExceededErr ErrorIdentifier = 10028
310

311
        // JSMessageCounterBrokenErr message counter is broken
312
        JSMessageCounterBrokenErr ErrorIdentifier = 10172
313

314
        // JSMessageIncrDisabledErr message counters is disabled
315
        JSMessageIncrDisabledErr ErrorIdentifier = 10168
316

317
        // JSMessageIncrInvalidErr message counter increment is invalid
318
        JSMessageIncrInvalidErr ErrorIdentifier = 10171
319

320
        // JSMessageIncrMissingErr message counter increment is missing
321
        JSMessageIncrMissingErr ErrorIdentifier = 10169
322

323
        // JSMessageIncrPayloadErr message counter has payload
324
        JSMessageIncrPayloadErr ErrorIdentifier = 10170
325

326
        // JSMessageSchedulesDisabledErr message schedules is disabled
327
        JSMessageSchedulesDisabledErr ErrorIdentifier = 10188
328

329
        // JSMessageSchedulesPatternInvalidErr message schedules pattern is invalid
330
        JSMessageSchedulesPatternInvalidErr ErrorIdentifier = 10189
331

332
        // JSMessageSchedulesRollupInvalidErr message schedules invalid rollup
333
        JSMessageSchedulesRollupInvalidErr ErrorIdentifier = 10192
334

335
        // JSMessageSchedulesSourceInvalidErr message schedules source is invalid
336
        JSMessageSchedulesSourceInvalidErr ErrorIdentifier = 10203
337

338
        // JSMessageSchedulesTTLInvalidErr message schedules invalid per-message TTL
339
        JSMessageSchedulesTTLInvalidErr ErrorIdentifier = 10191
340

341
        // JSMessageSchedulesTargetInvalidErr message schedules target is invalid
342
        JSMessageSchedulesTargetInvalidErr ErrorIdentifier = 10190
343

344
        // JSMessageTTLDisabledErr per-message TTL is disabled
345
        JSMessageTTLDisabledErr ErrorIdentifier = 10166
346

347
        // JSMessageTTLInvalidErr invalid per-message TTL
348
        JSMessageTTLInvalidErr ErrorIdentifier = 10165
349

350
        // JSMirrorConsumerSetupFailedErrF generic mirror consumer setup failure string ({err})
351
        JSMirrorConsumerSetupFailedErrF ErrorIdentifier = 10029
352

353
        // JSMirrorInvalidStreamName mirrored stream name is invalid
354
        JSMirrorInvalidStreamName ErrorIdentifier = 10142
355

356
        // JSMirrorInvalidSubjectFilter mirror transform source: {err}
357
        JSMirrorInvalidSubjectFilter ErrorIdentifier = 10151
358

359
        // JSMirrorInvalidTransformDestination mirror transform: {err}
360
        JSMirrorInvalidTransformDestination ErrorIdentifier = 10154
361

362
        // JSMirrorMaxMessageSizeTooBigErr stream mirror must have max message size >= source
363
        JSMirrorMaxMessageSizeTooBigErr ErrorIdentifier = 10030
364

365
        // JSMirrorMultipleFiltersNotAllowed mirror with multiple subject transforms cannot also have a single subject filter
366
        JSMirrorMultipleFiltersNotAllowed ErrorIdentifier = 10150
367

368
        // JSMirrorOverlappingSubjectFilters mirror subject filters can not overlap
369
        JSMirrorOverlappingSubjectFilters ErrorIdentifier = 10152
370

371
        // JSMirrorWithAtomicPublishErr stream mirrors can not also use atomic publishing
372
        JSMirrorWithAtomicPublishErr ErrorIdentifier = 10198
373

374
        // JSMirrorWithBatchPublishErr stream mirrors can not also use batch publishing
375
        JSMirrorWithBatchPublishErr ErrorIdentifier = 10209
376

377
        // JSMirrorWithCountersErr stream mirrors can not also calculate counters
378
        JSMirrorWithCountersErr ErrorIdentifier = 10173
379

380
        // JSMirrorWithFirstSeqErr stream mirrors can not have first sequence configured
381
        JSMirrorWithFirstSeqErr ErrorIdentifier = 10143
382

383
        // JSMirrorWithMsgSchedulesErr stream mirrors can not also schedule messages
384
        JSMirrorWithMsgSchedulesErr ErrorIdentifier = 10186
385

386
        // JSMirrorWithSourcesErr stream mirrors can not also contain other sources
387
        JSMirrorWithSourcesErr ErrorIdentifier = 10031
388

389
        // JSMirrorWithStartSeqAndTimeErr stream mirrors can not have both start seq and start time configured
390
        JSMirrorWithStartSeqAndTimeErr ErrorIdentifier = 10032
391

392
        // JSMirrorWithSubjectFiltersErr stream mirrors can not contain filtered subjects
393
        JSMirrorWithSubjectFiltersErr ErrorIdentifier = 10033
394

395
        // JSMirrorWithSubjectsErr stream mirrors can not contain subjects
396
        JSMirrorWithSubjectsErr ErrorIdentifier = 10034
397

398
        // JSNoAccountErr account not found
399
        JSNoAccountErr ErrorIdentifier = 10035
400

401
        // JSNoLimitsErr no JetStream default or applicable tiered limit present
402
        JSNoLimitsErr ErrorIdentifier = 10120
403

404
        // JSNoMessageFoundErr no message found
405
        JSNoMessageFoundErr ErrorIdentifier = 10037
406

407
        // JSNotEmptyRequestErr expected an empty request payload
408
        JSNotEmptyRequestErr ErrorIdentifier = 10038
409

410
        // JSNotEnabledErr JetStream not enabled
411
        JSNotEnabledErr ErrorIdentifier = 10076
412

413
        // JSNotEnabledForAccountErr JetStream not enabled for account
414
        JSNotEnabledForAccountErr ErrorIdentifier = 10039
415

416
        // JSPedanticErrF pedantic mode: {err}
417
        JSPedanticErrF ErrorIdentifier = 10157
418

419
        // JSPeerRemapErr peer remap failed
420
        JSPeerRemapErr ErrorIdentifier = 10075
421

422
        // JSRaftGeneralErrF General RAFT error string ({err})
423
        JSRaftGeneralErrF ErrorIdentifier = 10041
424

425
        // JSReplicasCountCannotBeNegative replicas count cannot be negative
426
        JSReplicasCountCannotBeNegative ErrorIdentifier = 10133
427

428
        // JSRequiredApiLevelErr JetStream minimum api level required
429
        JSRequiredApiLevelErr ErrorIdentifier = 10185
430

431
        // JSRestoreSubscribeFailedErrF JetStream unable to subscribe to restore snapshot {subject}: {err}
432
        JSRestoreSubscribeFailedErrF ErrorIdentifier = 10042
433

434
        // JSSequenceNotFoundErrF sequence {seq} not found
435
        JSSequenceNotFoundErrF ErrorIdentifier = 10043
436

437
        // JSSnapshotDeliverSubjectInvalidErr deliver subject not valid
438
        JSSnapshotDeliverSubjectInvalidErr ErrorIdentifier = 10015
439

440
        // JSSourceConsumerSetupFailedErrF General source consumer setup failure string ({err})
441
        JSSourceConsumerSetupFailedErrF ErrorIdentifier = 10045
442

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

446
        // JSSourceInvalidStreamName sourced stream name is invalid
447
        JSSourceInvalidStreamName ErrorIdentifier = 10141
448

449
        // JSSourceInvalidSubjectFilter source transform source: {err}
450
        JSSourceInvalidSubjectFilter ErrorIdentifier = 10145
451

452
        // JSSourceInvalidTransformDestination source transform: {err}
453
        JSSourceInvalidTransformDestination ErrorIdentifier = 10146
454

455
        // JSSourceMaxMessageSizeTooBigErr stream source must have max message size >= target
456
        JSSourceMaxMessageSizeTooBigErr ErrorIdentifier = 10046
457

458
        // JSSourceMultipleFiltersNotAllowed source with multiple subject transforms cannot also have a single subject filter
459
        JSSourceMultipleFiltersNotAllowed ErrorIdentifier = 10144
460

461
        // JSSourceOverlappingSubjectFilters source filters can not overlap
462
        JSSourceOverlappingSubjectFilters ErrorIdentifier = 10147
463

464
        // JSSourceWithMsgSchedulesErr stream source can not also schedule messages
465
        JSSourceWithMsgSchedulesErr ErrorIdentifier = 10187
466

467
        // JSStorageResourcesExceededErr insufficient storage resources available
468
        JSStorageResourcesExceededErr ErrorIdentifier = 10047
469

470
        // JSStreamAssignmentErrF Generic stream assignment error string ({err})
471
        JSStreamAssignmentErrF ErrorIdentifier = 10048
472

473
        // JSStreamCreateErrF Generic stream creation error string ({err})
474
        JSStreamCreateErrF ErrorIdentifier = 10049
475

476
        // JSStreamDeleteErrF General stream deletion error string ({err})
477
        JSStreamDeleteErrF ErrorIdentifier = 10050
478

479
        // JSStreamDuplicateMessageConflict duplicate message id is in process
480
        JSStreamDuplicateMessageConflict ErrorIdentifier = 10158
481

482
        // JSStreamExpectedLastSeqPerSubjectInvalid missing sequence for expected last sequence per subject
483
        JSStreamExpectedLastSeqPerSubjectInvalid ErrorIdentifier = 10193
484

485
        // JSStreamExpectedLastSeqPerSubjectNotReady expected last sequence per subject temporarily unavailable
486
        JSStreamExpectedLastSeqPerSubjectNotReady ErrorIdentifier = 10163
487

488
        // JSStreamExternalApiOverlapErrF stream external api prefix {prefix} must not overlap with {subject}
489
        JSStreamExternalApiOverlapErrF ErrorIdentifier = 10021
490

491
        // JSStreamExternalDelPrefixOverlapsErrF stream external delivery prefix {prefix} overlaps with stream subject {subject}
492
        JSStreamExternalDelPrefixOverlapsErrF ErrorIdentifier = 10022
493

494
        // JSStreamGeneralErrorF General stream failure string ({err})
495
        JSStreamGeneralErrorF ErrorIdentifier = 10051
496

497
        // JSStreamHeaderExceedsMaximumErr header size exceeds maximum allowed of 64k
498
        JSStreamHeaderExceedsMaximumErr ErrorIdentifier = 10097
499

500
        // JSStreamInfoMaxSubjectsErr subject details would exceed maximum allowed
501
        JSStreamInfoMaxSubjectsErr ErrorIdentifier = 10117
502

503
        // JSStreamInvalidConfigF Stream configuration validation error string ({err})
504
        JSStreamInvalidConfigF ErrorIdentifier = 10052
505

506
        // JSStreamInvalidErr stream not valid
507
        JSStreamInvalidErr ErrorIdentifier = 10096
508

509
        // JSStreamInvalidExternalDeliverySubjErrF stream external delivery prefix {prefix} must not contain wildcards
510
        JSStreamInvalidExternalDeliverySubjErrF ErrorIdentifier = 10024
511

512
        // JSStreamLimitsErrF General stream limits exceeded error string ({err})
513
        JSStreamLimitsErrF ErrorIdentifier = 10053
514

515
        // JSStreamMaxBytesRequired account requires a stream config to have max bytes set
516
        JSStreamMaxBytesRequired ErrorIdentifier = 10113
517

518
        // JSStreamMaxStreamBytesExceeded stream max bytes exceeds account limit max stream bytes
519
        JSStreamMaxStreamBytesExceeded ErrorIdentifier = 10122
520

521
        // JSStreamMessageExceedsMaximumErr message size exceeds maximum allowed
522
        JSStreamMessageExceedsMaximumErr ErrorIdentifier = 10054
523

524
        // JSStreamMinLastSeqErr min last sequence
525
        JSStreamMinLastSeqErr ErrorIdentifier = 10180
526

527
        // JSStreamMirrorNotUpdatableErr stream mirror configuration can not be updated
528
        JSStreamMirrorNotUpdatableErr ErrorIdentifier = 10055
529

530
        // JSStreamMismatchErr stream name in subject does not match request
531
        JSStreamMismatchErr ErrorIdentifier = 10056
532

533
        // JSStreamMoveAndScaleErr can not move and scale a stream in a single update
534
        JSStreamMoveAndScaleErr ErrorIdentifier = 10123
535

536
        // JSStreamMoveInProgressF stream move already in progress: {msg}
537
        JSStreamMoveInProgressF ErrorIdentifier = 10124
538

539
        // JSStreamMoveNotInProgress stream move not in progress
540
        JSStreamMoveNotInProgress ErrorIdentifier = 10129
541

542
        // JSStreamMsgDeleteFailedF Generic message deletion failure error string ({err})
543
        JSStreamMsgDeleteFailedF ErrorIdentifier = 10057
544

545
        // JSStreamNameContainsPathSeparatorsErr Stream name can not contain path separators
546
        JSStreamNameContainsPathSeparatorsErr ErrorIdentifier = 10128
547

548
        // JSStreamNameExistErr stream name already in use with a different configuration
549
        JSStreamNameExistErr ErrorIdentifier = 10058
550

551
        // JSStreamNameExistRestoreFailedErr stream name already in use, cannot restore
552
        JSStreamNameExistRestoreFailedErr ErrorIdentifier = 10130
553

554
        // JSStreamNotFoundErr stream not found
555
        JSStreamNotFoundErr ErrorIdentifier = 10059
556

557
        // JSStreamNotMatchErr expected stream does not match
558
        JSStreamNotMatchErr ErrorIdentifier = 10060
559

560
        // JSStreamOfflineErr stream is offline
561
        JSStreamOfflineErr ErrorIdentifier = 10118
562

563
        // JSStreamOfflineReasonErrF stream is offline: {err}
564
        JSStreamOfflineReasonErrF ErrorIdentifier = 10194
565

566
        // JSStreamPurgeFailedF Generic stream purge failure error string ({err})
567
        JSStreamPurgeFailedF ErrorIdentifier = 10110
568

569
        // JSStreamReplicasNotSupportedErr replicas > 1 not supported in non-clustered mode
570
        JSStreamReplicasNotSupportedErr ErrorIdentifier = 10074
571

572
        // JSStreamReplicasNotUpdatableErr Replicas configuration can not be updated
573
        JSStreamReplicasNotUpdatableErr ErrorIdentifier = 10061
574

575
        // JSStreamRestoreErrF restore failed: {err}
576
        JSStreamRestoreErrF ErrorIdentifier = 10062
577

578
        // JSStreamRollupFailedF Generic stream rollup failure error string ({err})
579
        JSStreamRollupFailedF ErrorIdentifier = 10111
580

581
        // JSStreamSealedErr invalid operation on sealed stream
582
        JSStreamSealedErr ErrorIdentifier = 10109
583

584
        // JSStreamSequenceNotMatchErr expected stream sequence does not match
585
        JSStreamSequenceNotMatchErr ErrorIdentifier = 10063
586

587
        // JSStreamSnapshotErrF snapshot failed: {err}
588
        JSStreamSnapshotErrF ErrorIdentifier = 10064
589

590
        // JSStreamStoreFailedF Generic error when storing a message failed ({err})
591
        JSStreamStoreFailedF ErrorIdentifier = 10077
592

593
        // JSStreamSubjectOverlapErr subjects overlap with an existing stream
594
        JSStreamSubjectOverlapErr ErrorIdentifier = 10065
595

596
        // JSStreamTemplateCreateErrF Generic template creation failed string ({err})
597
        JSStreamTemplateCreateErrF ErrorIdentifier = 10066
598

599
        // JSStreamTemplateDeleteErrF Generic stream template deletion failed error string ({err})
600
        JSStreamTemplateDeleteErrF ErrorIdentifier = 10067
601

602
        // JSStreamTemplateNotFoundErr template not found
603
        JSStreamTemplateNotFoundErr ErrorIdentifier = 10068
604

605
        // JSStreamTooManyRequests too many requests
606
        JSStreamTooManyRequests ErrorIdentifier = 10167
607

608
        // JSStreamTransformInvalidDestination stream transform: {err}
609
        JSStreamTransformInvalidDestination ErrorIdentifier = 10156
610

611
        // JSStreamTransformInvalidSource stream transform source: {err}
612
        JSStreamTransformInvalidSource ErrorIdentifier = 10155
613

614
        // JSStreamUpdateErrF Generic stream update error string ({err})
615
        JSStreamUpdateErrF ErrorIdentifier = 10069
616

617
        // JSStreamWrongLastMsgIDErrF wrong last msg ID: {id}
618
        JSStreamWrongLastMsgIDErrF ErrorIdentifier = 10070
619

620
        // JSStreamWrongLastSequenceConstantErr wrong last sequence
621
        JSStreamWrongLastSequenceConstantErr ErrorIdentifier = 10164
622

623
        // JSStreamWrongLastSequenceErrF wrong last sequence: {seq}
624
        JSStreamWrongLastSequenceErrF ErrorIdentifier = 10071
625

626
        // JSTempStorageFailedErr JetStream unable to open temp storage for restore
627
        JSTempStorageFailedErr ErrorIdentifier = 10072
628

629
        // JSTemplateNameNotMatchSubjectErr template name in subject does not match request
630
        JSTemplateNameNotMatchSubjectErr ErrorIdentifier = 10073
631
)
632

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

868
// NewJSAccountResourcesExceededError creates a new JSAccountResourcesExceededErr error: "resource limits exceeded for account"
869
func NewJSAccountResourcesExceededError(opts ...ErrorOption) *ApiError {
20,065✔
870
        eopts := parseOpts(opts)
20,065✔
871
        if ae, ok := eopts.err.(*ApiError); ok {
20,065✔
872
                return ae
×
873
        }
×
874

875
        return ApiErrors[JSAccountResourcesExceededErr]
20,065✔
876
}
877

878
// NewJSAtomicPublishContainsDuplicateMessageError creates a new JSAtomicPublishContainsDuplicateMessageErr error: "atomic publish batch contains duplicate message id"
879
func NewJSAtomicPublishContainsDuplicateMessageError(opts ...ErrorOption) *ApiError {
22,020✔
880
        eopts := parseOpts(opts)
22,020✔
881
        if ae, ok := eopts.err.(*ApiError); ok {
22,020✔
882
                return ae
×
883
        }
×
884

885
        return ApiErrors[JSAtomicPublishContainsDuplicateMessageErr]
22,020✔
886
}
887

888
// NewJSAtomicPublishDisabledError creates a new JSAtomicPublishDisabledErr error: "atomic publish is disabled"
889
func NewJSAtomicPublishDisabledError(opts ...ErrorOption) *ApiError {
24✔
890
        eopts := parseOpts(opts)
24✔
891
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
892
                return ae
×
893
        }
×
894

895
        return ApiErrors[JSAtomicPublishDisabledErr]
24✔
896
}
897

898
// NewJSAtomicPublishIncompleteBatchError creates a new JSAtomicPublishIncompleteBatchErr error: "atomic publish batch is incomplete"
899
func NewJSAtomicPublishIncompleteBatchError(opts ...ErrorOption) *ApiError {
62✔
900
        eopts := parseOpts(opts)
62✔
901
        if ae, ok := eopts.err.(*ApiError); ok {
62✔
902
                return ae
×
903
        }
×
904

905
        return ApiErrors[JSAtomicPublishIncompleteBatchErr]
62✔
906
}
907

908
// NewJSAtomicPublishInvalidBatchCommitError creates a new JSAtomicPublishInvalidBatchCommitErr error: "atomic publish batch commit is invalid"
909
func NewJSAtomicPublishInvalidBatchCommitError(opts ...ErrorOption) *ApiError {
6✔
910
        eopts := parseOpts(opts)
6✔
911
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
912
                return ae
×
913
        }
×
914

915
        return ApiErrors[JSAtomicPublishInvalidBatchCommitErr]
6✔
916
}
917

918
// NewJSAtomicPublishInvalidBatchIDError creates a new JSAtomicPublishInvalidBatchIDErr error: "atomic publish batch ID is invalid"
919
func NewJSAtomicPublishInvalidBatchIDError(opts ...ErrorOption) *ApiError {
4✔
920
        eopts := parseOpts(opts)
4✔
921
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
922
                return ae
×
923
        }
×
924

925
        return ApiErrors[JSAtomicPublishInvalidBatchIDErr]
4✔
926
}
927

928
// NewJSAtomicPublishMissingSeqError creates a new JSAtomicPublishMissingSeqErr error: "atomic publish sequence is missing"
929
func NewJSAtomicPublishMissingSeqError(opts ...ErrorOption) *ApiError {
24✔
930
        eopts := parseOpts(opts)
24✔
931
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
932
                return ae
×
933
        }
×
934

935
        return ApiErrors[JSAtomicPublishMissingSeqErr]
24✔
936
}
937

938
// NewJSAtomicPublishTooLargeBatchError creates a new JSAtomicPublishTooLargeBatchErrF error: "atomic publish batch is too large: {size}"
939
func NewJSAtomicPublishTooLargeBatchError(size interface{}, opts ...ErrorOption) *ApiError {
10✔
940
        eopts := parseOpts(opts)
10✔
941
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
942
                return ae
×
943
        }
×
944

945
        e := ApiErrors[JSAtomicPublishTooLargeBatchErrF]
10✔
946
        args := e.toReplacerArgs([]interface{}{"{size}", size})
10✔
947
        return &ApiError{
10✔
948
                Code:        e.Code,
10✔
949
                ErrCode:     e.ErrCode,
10✔
950
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
951
        }
10✔
952
}
953

954
// NewJSAtomicPublishUnsupportedHeaderBatchError creates a new JSAtomicPublishUnsupportedHeaderBatchErr error: "atomic publish unsupported header used: {header}"
955
func NewJSAtomicPublishUnsupportedHeaderBatchError(header interface{}, opts ...ErrorOption) *ApiError {
4✔
956
        eopts := parseOpts(opts)
4✔
957
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
958
                return ae
×
959
        }
×
960

961
        e := ApiErrors[JSAtomicPublishUnsupportedHeaderBatchErr]
4✔
962
        args := e.toReplacerArgs([]interface{}{"{header}", header})
4✔
963
        return &ApiError{
4✔
964
                Code:        e.Code,
4✔
965
                ErrCode:     e.ErrCode,
4✔
966
                Description: strings.NewReplacer(args...).Replace(e.Description),
4✔
967
        }
4✔
968
}
969

970
// NewJSBadRequestError creates a new JSBadRequestErr error: "bad request"
971
func NewJSBadRequestError(opts ...ErrorOption) *ApiError {
10✔
972
        eopts := parseOpts(opts)
10✔
973
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
974
                return ae
×
975
        }
×
976

977
        return ApiErrors[JSBadRequestErr]
10✔
978
}
979

980
// NewJSBatchPublishDisabledError creates a new JSBatchPublishDisabledErr error: "batch publish is disabled"
981
func NewJSBatchPublishDisabledError(opts ...ErrorOption) *ApiError {
24✔
982
        eopts := parseOpts(opts)
24✔
983
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
984
                return ae
×
985
        }
×
986

987
        return ApiErrors[JSBatchPublishDisabledErr]
24✔
988
}
989

990
// NewJSBatchPublishInvalidBatchIDError creates a new JSBatchPublishInvalidBatchIDErr error: "batch publish ID is invalid"
991
func NewJSBatchPublishInvalidBatchIDError(opts ...ErrorOption) *ApiError {
24✔
992
        eopts := parseOpts(opts)
24✔
993
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
994
                return ae
×
995
        }
×
996

997
        return ApiErrors[JSBatchPublishInvalidBatchIDErr]
24✔
998
}
999

1000
// NewJSBatchPublishInvalidPatternError creates a new JSBatchPublishInvalidPatternErr error: "batch publish pattern is invalid"
1001
func NewJSBatchPublishInvalidPatternError(opts ...ErrorOption) *ApiError {
28✔
1002
        eopts := parseOpts(opts)
28✔
1003
        if ae, ok := eopts.err.(*ApiError); ok {
28✔
1004
                return ae
×
1005
        }
×
1006

1007
        return ApiErrors[JSBatchPublishInvalidPatternErr]
28✔
1008
}
1009

1010
// NewJSBatchPublishUnknownBatchIDError creates a new JSBatchPublishUnknownBatchIDErr error: "batch publish ID unknown"
1011
func NewJSBatchPublishUnknownBatchIDError(opts ...ErrorOption) *ApiError {
24✔
1012
        eopts := parseOpts(opts)
24✔
1013
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
1014
                return ae
×
1015
        }
×
1016

1017
        return ApiErrors[JSBatchPublishUnknownBatchIDErr]
24✔
1018
}
1019

1020
// NewJSClusterIncompleteError creates a new JSClusterIncompleteErr error: "incomplete results"
1021
func NewJSClusterIncompleteError(opts ...ErrorOption) *ApiError {
×
1022
        eopts := parseOpts(opts)
×
1023
        if ae, ok := eopts.err.(*ApiError); ok {
×
1024
                return ae
×
1025
        }
×
1026

1027
        return ApiErrors[JSClusterIncompleteErr]
×
1028
}
1029

1030
// NewJSClusterNoPeersError creates a new JSClusterNoPeersErrF error: "{err}"
1031
func NewJSClusterNoPeersError(err error, opts ...ErrorOption) *ApiError {
59✔
1032
        eopts := parseOpts(opts)
59✔
1033
        if ae, ok := eopts.err.(*ApiError); ok {
59✔
1034
                return ae
×
1035
        }
×
1036

1037
        e := ApiErrors[JSClusterNoPeersErrF]
59✔
1038
        args := e.toReplacerArgs([]interface{}{"{err}", err})
59✔
1039
        return &ApiError{
59✔
1040
                Code:        e.Code,
59✔
1041
                ErrCode:     e.ErrCode,
59✔
1042
                Description: strings.NewReplacer(args...).Replace(e.Description),
59✔
1043
        }
59✔
1044
}
1045

1046
// NewJSClusterNotActiveError creates a new JSClusterNotActiveErr error: "JetStream not in clustered mode"
1047
func NewJSClusterNotActiveError(opts ...ErrorOption) *ApiError {
1✔
1048
        eopts := parseOpts(opts)
1✔
1049
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1050
                return ae
×
1051
        }
×
1052

1053
        return ApiErrors[JSClusterNotActiveErr]
1✔
1054
}
1055

1056
// NewJSClusterNotAssignedError creates a new JSClusterNotAssignedErr error: "JetStream cluster not assigned to this server"
1057
func NewJSClusterNotAssignedError(opts ...ErrorOption) *ApiError {
2✔
1058
        eopts := parseOpts(opts)
2✔
1059
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1060
                return ae
×
1061
        }
×
1062

1063
        return ApiErrors[JSClusterNotAssignedErr]
2✔
1064
}
1065

1066
// NewJSClusterNotAvailError creates a new JSClusterNotAvailErr error: "JetStream system temporarily unavailable"
1067
func NewJSClusterNotAvailError(opts ...ErrorOption) *ApiError {
12✔
1068
        eopts := parseOpts(opts)
12✔
1069
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
1070
                return ae
×
1071
        }
×
1072

1073
        return ApiErrors[JSClusterNotAvailErr]
12✔
1074
}
1075

1076
// NewJSClusterNotLeaderError creates a new JSClusterNotLeaderErr error: "JetStream cluster can not handle request"
1077
func NewJSClusterNotLeaderError(opts ...ErrorOption) *ApiError {
3✔
1078
        eopts := parseOpts(opts)
3✔
1079
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1080
                return ae
×
1081
        }
×
1082

1083
        return ApiErrors[JSClusterNotLeaderErr]
3✔
1084
}
1085

1086
// NewJSClusterPeerNotMemberError creates a new JSClusterPeerNotMemberErr error: "peer not a member"
1087
func NewJSClusterPeerNotMemberError(opts ...ErrorOption) *ApiError {
1✔
1088
        eopts := parseOpts(opts)
1✔
1089
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1090
                return ae
×
1091
        }
×
1092

1093
        return ApiErrors[JSClusterPeerNotMemberErr]
1✔
1094
}
1095

1096
// NewJSClusterRequiredError creates a new JSClusterRequiredErr error: "JetStream clustering support required"
1097
func NewJSClusterRequiredError(opts ...ErrorOption) *ApiError {
6✔
1098
        eopts := parseOpts(opts)
6✔
1099
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1100
                return ae
×
1101
        }
×
1102

1103
        return ApiErrors[JSClusterRequiredErr]
6✔
1104
}
1105

1106
// NewJSClusterServerMemberChangeInflightError creates a new JSClusterServerMemberChangeInflightErr error: "cluster member change is in progress"
1107
func NewJSClusterServerMemberChangeInflightError(opts ...ErrorOption) *ApiError {
6✔
1108
        eopts := parseOpts(opts)
6✔
1109
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1110
                return ae
×
1111
        }
×
1112

1113
        return ApiErrors[JSClusterServerMemberChangeInflightErr]
6✔
1114
}
1115

1116
// NewJSClusterServerNotMemberError creates a new JSClusterServerNotMemberErr error: "server is not a member of the cluster"
1117
func NewJSClusterServerNotMemberError(opts ...ErrorOption) *ApiError {
6✔
1118
        eopts := parseOpts(opts)
6✔
1119
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1120
                return ae
×
1121
        }
×
1122

1123
        return ApiErrors[JSClusterServerNotMemberErr]
6✔
1124
}
1125

1126
// NewJSClusterTagsError creates a new JSClusterTagsErr error: "tags placement not supported for operation"
1127
func NewJSClusterTagsError(opts ...ErrorOption) *ApiError {
×
1128
        eopts := parseOpts(opts)
×
1129
        if ae, ok := eopts.err.(*ApiError); ok {
×
1130
                return ae
×
1131
        }
×
1132

1133
        return ApiErrors[JSClusterTagsErr]
×
1134
}
1135

1136
// NewJSClusterUnSupportFeatureError creates a new JSClusterUnSupportFeatureErr error: "not currently supported in clustered mode"
1137
func NewJSClusterUnSupportFeatureError(opts ...ErrorOption) *ApiError {
×
1138
        eopts := parseOpts(opts)
×
1139
        if ae, ok := eopts.err.(*ApiError); ok {
×
1140
                return ae
×
1141
        }
×
1142

1143
        return ApiErrors[JSClusterUnSupportFeatureErr]
×
1144
}
1145

1146
// NewJSConsumerAckPolicyInvalidError creates a new JSConsumerAckPolicyInvalidErr error: "consumer ack policy invalid"
1147
func NewJSConsumerAckPolicyInvalidError(opts ...ErrorOption) *ApiError {
2✔
1148
        eopts := parseOpts(opts)
2✔
1149
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1150
                return ae
×
1151
        }
×
1152

1153
        return ApiErrors[JSConsumerAckPolicyInvalidErr]
2✔
1154
}
1155

1156
// NewJSConsumerAckWaitNegativeError creates a new JSConsumerAckWaitNegativeErr error: "consumer ack wait needs to be positive"
1157
func NewJSConsumerAckWaitNegativeError(opts ...ErrorOption) *ApiError {
2✔
1158
        eopts := parseOpts(opts)
2✔
1159
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1160
                return ae
×
1161
        }
×
1162

1163
        return ApiErrors[JSConsumerAckWaitNegativeErr]
2✔
1164
}
1165

1166
// NewJSConsumerAlreadyExistsError creates a new JSConsumerAlreadyExists error: "consumer already exists"
1167
func NewJSConsumerAlreadyExistsError(opts ...ErrorOption) *ApiError {
5✔
1168
        eopts := parseOpts(opts)
5✔
1169
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
1170
                return ae
×
1171
        }
×
1172

1173
        return ApiErrors[JSConsumerAlreadyExists]
5✔
1174
}
1175

1176
// NewJSConsumerBackOffNegativeError creates a new JSConsumerBackOffNegativeErr error: "consumer backoff needs to be positive"
1177
func NewJSConsumerBackOffNegativeError(opts ...ErrorOption) *ApiError {
2✔
1178
        eopts := parseOpts(opts)
2✔
1179
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1180
                return ae
×
1181
        }
×
1182

1183
        return ApiErrors[JSConsumerBackOffNegativeErr]
2✔
1184
}
1185

1186
// NewJSConsumerBadDurableNameError creates a new JSConsumerBadDurableNameErr error: "durable name can not contain '.', '*', '>'"
1187
func NewJSConsumerBadDurableNameError(opts ...ErrorOption) *ApiError {
×
1188
        eopts := parseOpts(opts)
×
1189
        if ae, ok := eopts.err.(*ApiError); ok {
×
1190
                return ae
×
1191
        }
×
1192

1193
        return ApiErrors[JSConsumerBadDurableNameErr]
×
1194
}
1195

1196
// NewJSConsumerConfigRequiredError creates a new JSConsumerConfigRequiredErr error: "consumer config required"
1197
func NewJSConsumerConfigRequiredError(opts ...ErrorOption) *ApiError {
2✔
1198
        eopts := parseOpts(opts)
2✔
1199
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1200
                return ae
×
1201
        }
×
1202

1203
        return ApiErrors[JSConsumerConfigRequiredErr]
2✔
1204
}
1205

1206
// NewJSConsumerCreateDurableAndNameMismatchError creates a new JSConsumerCreateDurableAndNameMismatch error: "Consumer Durable and Name have to be equal if both are provided"
1207
func NewJSConsumerCreateDurableAndNameMismatchError(opts ...ErrorOption) *ApiError {
1✔
1208
        eopts := parseOpts(opts)
1✔
1209
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1210
                return ae
×
1211
        }
×
1212

1213
        return ApiErrors[JSConsumerCreateDurableAndNameMismatch]
1✔
1214
}
1215

1216
// NewJSConsumerCreateError creates a new JSConsumerCreateErrF error: "{err}"
1217
func NewJSConsumerCreateError(err error, opts ...ErrorOption) *ApiError {
75✔
1218
        eopts := parseOpts(opts)
75✔
1219
        if ae, ok := eopts.err.(*ApiError); ok {
132✔
1220
                return ae
57✔
1221
        }
57✔
1222

1223
        e := ApiErrors[JSConsumerCreateErrF]
18✔
1224
        args := e.toReplacerArgs([]interface{}{"{err}", err})
18✔
1225
        return &ApiError{
18✔
1226
                Code:        e.Code,
18✔
1227
                ErrCode:     e.ErrCode,
18✔
1228
                Description: strings.NewReplacer(args...).Replace(e.Description),
18✔
1229
        }
18✔
1230
}
1231

1232
// NewJSConsumerCreateFilterSubjectMismatchError creates a new JSConsumerCreateFilterSubjectMismatchErr error: "Consumer create request did not match filtered subject from create subject"
1233
func NewJSConsumerCreateFilterSubjectMismatchError(opts ...ErrorOption) *ApiError {
2✔
1234
        eopts := parseOpts(opts)
2✔
1235
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1236
                return ae
×
1237
        }
×
1238

1239
        return ApiErrors[JSConsumerCreateFilterSubjectMismatchErr]
2✔
1240
}
1241

1242
// NewJSConsumerDeliverCycleError creates a new JSConsumerDeliverCycleErr error: "consumer deliver subject forms a cycle"
1243
func NewJSConsumerDeliverCycleError(opts ...ErrorOption) *ApiError {
4✔
1244
        eopts := parseOpts(opts)
4✔
1245
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1246
                return ae
×
1247
        }
×
1248

1249
        return ApiErrors[JSConsumerDeliverCycleErr]
4✔
1250
}
1251

1252
// NewJSConsumerDeliverToWildcardsError creates a new JSConsumerDeliverToWildcardsErr error: "consumer deliver subject has wildcards"
1253
func NewJSConsumerDeliverToWildcardsError(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[JSConsumerDeliverToWildcardsErr]
4✔
1260
}
1261

1262
// NewJSConsumerDescriptionTooLongError creates a new JSConsumerDescriptionTooLongErrF error: "consumer description is too long, maximum allowed is {max}"
1263
func NewJSConsumerDescriptionTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
1✔
1264
        eopts := parseOpts(opts)
1✔
1265
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1266
                return ae
×
1267
        }
×
1268

1269
        e := ApiErrors[JSConsumerDescriptionTooLongErrF]
1✔
1270
        args := e.toReplacerArgs([]interface{}{"{max}", max})
1✔
1271
        return &ApiError{
1✔
1272
                Code:        e.Code,
1✔
1273
                ErrCode:     e.ErrCode,
1✔
1274
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1275
        }
1✔
1276
}
1277

1278
// NewJSConsumerDirectRequiresEphemeralError creates a new JSConsumerDirectRequiresEphemeralErr error: "consumer direct requires an ephemeral consumer"
1279
func NewJSConsumerDirectRequiresEphemeralError(opts ...ErrorOption) *ApiError {
×
1280
        eopts := parseOpts(opts)
×
1281
        if ae, ok := eopts.err.(*ApiError); ok {
×
1282
                return ae
×
1283
        }
×
1284

1285
        return ApiErrors[JSConsumerDirectRequiresEphemeralErr]
×
1286
}
1287

1288
// NewJSConsumerDirectRequiresPushError creates a new JSConsumerDirectRequiresPushErr error: "consumer direct requires a push based consumer"
1289
func NewJSConsumerDirectRequiresPushError(opts ...ErrorOption) *ApiError {
×
1290
        eopts := parseOpts(opts)
×
1291
        if ae, ok := eopts.err.(*ApiError); ok {
×
1292
                return ae
×
1293
        }
×
1294

1295
        return ApiErrors[JSConsumerDirectRequiresPushErr]
×
1296
}
1297

1298
// NewJSConsumerDoesNotExistError creates a new JSConsumerDoesNotExist error: "consumer does not exist"
1299
func NewJSConsumerDoesNotExistError(opts ...ErrorOption) *ApiError {
3✔
1300
        eopts := parseOpts(opts)
3✔
1301
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1302
                return ae
×
1303
        }
×
1304

1305
        return ApiErrors[JSConsumerDoesNotExist]
3✔
1306
}
1307

1308
// NewJSConsumerDuplicateFilterSubjectsError creates a new JSConsumerDuplicateFilterSubjects error: "consumer cannot have both FilterSubject and FilterSubjects specified"
1309
func NewJSConsumerDuplicateFilterSubjectsError(opts ...ErrorOption) *ApiError {
1✔
1310
        eopts := parseOpts(opts)
1✔
1311
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1312
                return ae
×
1313
        }
×
1314

1315
        return ApiErrors[JSConsumerDuplicateFilterSubjects]
1✔
1316
}
1317

1318
// NewJSConsumerDurableNameNotInSubjectError creates a new JSConsumerDurableNameNotInSubjectErr error: "consumer expected to be durable but no durable name set in subject"
1319
func NewJSConsumerDurableNameNotInSubjectError(opts ...ErrorOption) *ApiError {
×
1320
        eopts := parseOpts(opts)
×
1321
        if ae, ok := eopts.err.(*ApiError); ok {
×
1322
                return ae
×
1323
        }
×
1324

1325
        return ApiErrors[JSConsumerDurableNameNotInSubjectErr]
×
1326
}
1327

1328
// NewJSConsumerDurableNameNotMatchSubjectError creates a new JSConsumerDurableNameNotMatchSubjectErr error: "consumer name in subject does not match durable name in request"
1329
func NewJSConsumerDurableNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
×
1330
        eopts := parseOpts(opts)
×
1331
        if ae, ok := eopts.err.(*ApiError); ok {
×
1332
                return ae
×
1333
        }
×
1334

1335
        return ApiErrors[JSConsumerDurableNameNotMatchSubjectErr]
×
1336
}
1337

1338
// NewJSConsumerDurableNameNotSetError creates a new JSConsumerDurableNameNotSetErr error: "consumer expected to be durable but a durable name was not set"
1339
func NewJSConsumerDurableNameNotSetError(opts ...ErrorOption) *ApiError {
1✔
1340
        eopts := parseOpts(opts)
1✔
1341
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1342
                return ae
×
1343
        }
×
1344

1345
        return ApiErrors[JSConsumerDurableNameNotSetErr]
1✔
1346
}
1347

1348
// NewJSConsumerEmptyFilterError creates a new JSConsumerEmptyFilter error: "consumer filter in FilterSubjects cannot be empty"
1349
func NewJSConsumerEmptyFilterError(opts ...ErrorOption) *ApiError {
1✔
1350
        eopts := parseOpts(opts)
1✔
1351
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1352
                return ae
×
1353
        }
×
1354

1355
        return ApiErrors[JSConsumerEmptyFilter]
1✔
1356
}
1357

1358
// NewJSConsumerEmptyGroupNameError creates a new JSConsumerEmptyGroupName error: "Group name cannot be an empty string"
1359
func NewJSConsumerEmptyGroupNameError(opts ...ErrorOption) *ApiError {
4✔
1360
        eopts := parseOpts(opts)
4✔
1361
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1362
                return ae
×
1363
        }
×
1364

1365
        return ApiErrors[JSConsumerEmptyGroupName]
4✔
1366
}
1367

1368
// NewJSConsumerEphemeralWithDurableInSubjectError creates a new JSConsumerEphemeralWithDurableInSubjectErr error: "consumer expected to be ephemeral but detected a durable name set in subject"
1369
func NewJSConsumerEphemeralWithDurableInSubjectError(opts ...ErrorOption) *ApiError {
×
1370
        eopts := parseOpts(opts)
×
1371
        if ae, ok := eopts.err.(*ApiError); ok {
×
1372
                return ae
×
1373
        }
×
1374

1375
        return ApiErrors[JSConsumerEphemeralWithDurableInSubjectErr]
×
1376
}
1377

1378
// NewJSConsumerEphemeralWithDurableNameError creates a new JSConsumerEphemeralWithDurableNameErr error: "consumer expected to be ephemeral but a durable name was set in request"
1379
func NewJSConsumerEphemeralWithDurableNameError(opts ...ErrorOption) *ApiError {
3✔
1380
        eopts := parseOpts(opts)
3✔
1381
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1382
                return ae
×
1383
        }
×
1384

1385
        return ApiErrors[JSConsumerEphemeralWithDurableNameErr]
3✔
1386
}
1387

1388
// NewJSConsumerExistingActiveError creates a new JSConsumerExistingActiveErr error: "consumer already exists and is still active"
1389
func NewJSConsumerExistingActiveError(opts ...ErrorOption) *ApiError {
×
1390
        eopts := parseOpts(opts)
×
1391
        if ae, ok := eopts.err.(*ApiError); ok {
×
1392
                return ae
×
1393
        }
×
1394

1395
        return ApiErrors[JSConsumerExistingActiveErr]
×
1396
}
1397

1398
// NewJSConsumerFCRequiresPushError creates a new JSConsumerFCRequiresPushErr error: "consumer flow control requires a push based consumer"
1399
func NewJSConsumerFCRequiresPushError(opts ...ErrorOption) *ApiError {
×
1400
        eopts := parseOpts(opts)
×
1401
        if ae, ok := eopts.err.(*ApiError); ok {
×
1402
                return ae
×
1403
        }
×
1404

1405
        return ApiErrors[JSConsumerFCRequiresPushErr]
×
1406
}
1407

1408
// NewJSConsumerFilterNotSubsetError creates a new JSConsumerFilterNotSubsetErr error: "consumer filter subject is not a valid subset of the interest subjects"
1409
func NewJSConsumerFilterNotSubsetError(opts ...ErrorOption) *ApiError {
×
1410
        eopts := parseOpts(opts)
×
1411
        if ae, ok := eopts.err.(*ApiError); ok {
×
1412
                return ae
×
1413
        }
×
1414

1415
        return ApiErrors[JSConsumerFilterNotSubsetErr]
×
1416
}
1417

1418
// NewJSConsumerHBRequiresPushError creates a new JSConsumerHBRequiresPushErr error: "consumer idle heartbeat requires a push based consumer"
1419
func NewJSConsumerHBRequiresPushError(opts ...ErrorOption) *ApiError {
×
1420
        eopts := parseOpts(opts)
×
1421
        if ae, ok := eopts.err.(*ApiError); ok {
×
1422
                return ae
×
1423
        }
×
1424

1425
        return ApiErrors[JSConsumerHBRequiresPushErr]
×
1426
}
1427

1428
// NewJSConsumerInactiveThresholdExcessError creates a new JSConsumerInactiveThresholdExcess error: "consumer inactive threshold exceeds system limit of {limit}"
1429
func NewJSConsumerInactiveThresholdExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
2✔
1430
        eopts := parseOpts(opts)
2✔
1431
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1432
                return ae
×
1433
        }
×
1434

1435
        e := ApiErrors[JSConsumerInactiveThresholdExcess]
2✔
1436
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
2✔
1437
        return &ApiError{
2✔
1438
                Code:        e.Code,
2✔
1439
                ErrCode:     e.ErrCode,
2✔
1440
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1441
        }
2✔
1442
}
1443

1444
// NewJSConsumerInvalidDeliverSubjectError creates a new JSConsumerInvalidDeliverSubject error: "invalid push consumer deliver subject"
1445
func NewJSConsumerInvalidDeliverSubjectError(opts ...ErrorOption) *ApiError {
2✔
1446
        eopts := parseOpts(opts)
2✔
1447
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1448
                return ae
×
1449
        }
×
1450

1451
        return ApiErrors[JSConsumerInvalidDeliverSubject]
2✔
1452
}
1453

1454
// NewJSConsumerInvalidGroupNameError creates a new JSConsumerInvalidGroupNameErr error: "Valid priority group name must match A-Z, a-z, 0-9, -_/=)+ and may not exceed 16 characters"
1455
func NewJSConsumerInvalidGroupNameError(opts ...ErrorOption) *ApiError {
2✔
1456
        eopts := parseOpts(opts)
2✔
1457
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1458
                return ae
×
1459
        }
×
1460

1461
        return ApiErrors[JSConsumerInvalidGroupNameErr]
2✔
1462
}
1463

1464
// NewJSConsumerInvalidPolicyError creates a new JSConsumerInvalidPolicyErrF error: "{err}"
1465
func NewJSConsumerInvalidPolicyError(err error, opts ...ErrorOption) *ApiError {
10✔
1466
        eopts := parseOpts(opts)
10✔
1467
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1468
                return ae
×
1469
        }
×
1470

1471
        e := ApiErrors[JSConsumerInvalidPolicyErrF]
10✔
1472
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1473
        return &ApiError{
10✔
1474
                Code:        e.Code,
10✔
1475
                ErrCode:     e.ErrCode,
10✔
1476
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1477
        }
10✔
1478
}
1479

1480
// NewJSConsumerInvalidPriorityGroupError creates a new JSConsumerInvalidPriorityGroupErr error: "Provided priority group does not exist for this consumer"
1481
func NewJSConsumerInvalidPriorityGroupError(opts ...ErrorOption) *ApiError {
2✔
1482
        eopts := parseOpts(opts)
2✔
1483
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1484
                return ae
×
1485
        }
×
1486

1487
        return ApiErrors[JSConsumerInvalidPriorityGroupErr]
2✔
1488
}
1489

1490
// NewJSConsumerInvalidResetError creates a new JSConsumerInvalidResetErr error: "invalid reset: {err}"
1491
func NewJSConsumerInvalidResetError(err error, opts ...ErrorOption) *ApiError {
4✔
1492
        eopts := parseOpts(opts)
4✔
1493
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1494
                return ae
×
1495
        }
×
1496

1497
        e := ApiErrors[JSConsumerInvalidResetErr]
4✔
1498
        args := e.toReplacerArgs([]interface{}{"{err}", err})
4✔
1499
        return &ApiError{
4✔
1500
                Code:        e.Code,
4✔
1501
                ErrCode:     e.ErrCode,
4✔
1502
                Description: strings.NewReplacer(args...).Replace(e.Description),
4✔
1503
        }
4✔
1504
}
1505

1506
// NewJSConsumerInvalidSamplingError creates a new JSConsumerInvalidSamplingErrF error: "failed to parse consumer sampling configuration: {err}"
1507
func NewJSConsumerInvalidSamplingError(err error, opts ...ErrorOption) *ApiError {
×
1508
        eopts := parseOpts(opts)
×
1509
        if ae, ok := eopts.err.(*ApiError); ok {
×
1510
                return ae
×
1511
        }
×
1512

1513
        e := ApiErrors[JSConsumerInvalidSamplingErrF]
×
1514
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1515
        return &ApiError{
×
1516
                Code:        e.Code,
×
1517
                ErrCode:     e.ErrCode,
×
1518
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1519
        }
×
1520
}
1521

1522
// NewJSConsumerMaxDeliverBackoffError creates a new JSConsumerMaxDeliverBackoffErr error: "max deliver is required to be > length of backoff values"
1523
func NewJSConsumerMaxDeliverBackoffError(opts ...ErrorOption) *ApiError {
3✔
1524
        eopts := parseOpts(opts)
3✔
1525
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1526
                return ae
×
1527
        }
×
1528

1529
        return ApiErrors[JSConsumerMaxDeliverBackoffErr]
3✔
1530
}
1531

1532
// NewJSConsumerMaxPendingAckExcessError creates a new JSConsumerMaxPendingAckExcessErrF error: "consumer max ack pending exceeds system limit of {limit}"
1533
func NewJSConsumerMaxPendingAckExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
12✔
1534
        eopts := parseOpts(opts)
12✔
1535
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
1536
                return ae
×
1537
        }
×
1538

1539
        e := ApiErrors[JSConsumerMaxPendingAckExcessErrF]
12✔
1540
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
12✔
1541
        return &ApiError{
12✔
1542
                Code:        e.Code,
12✔
1543
                ErrCode:     e.ErrCode,
12✔
1544
                Description: strings.NewReplacer(args...).Replace(e.Description),
12✔
1545
        }
12✔
1546
}
1547

1548
// NewJSConsumerMaxPendingAckPolicyRequiredError creates a new JSConsumerMaxPendingAckPolicyRequiredErr error: "consumer requires ack policy for max ack pending"
1549
func NewJSConsumerMaxPendingAckPolicyRequiredError(opts ...ErrorOption) *ApiError {
2✔
1550
        eopts := parseOpts(opts)
2✔
1551
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1552
                return ae
×
1553
        }
×
1554

1555
        return ApiErrors[JSConsumerMaxPendingAckPolicyRequiredErr]
2✔
1556
}
1557

1558
// NewJSConsumerMaxRequestBatchExceededError creates a new JSConsumerMaxRequestBatchExceededF error: "consumer max request batch exceeds server limit of {limit}"
1559
func NewJSConsumerMaxRequestBatchExceededError(limit interface{}, opts ...ErrorOption) *ApiError {
4✔
1560
        eopts := parseOpts(opts)
4✔
1561
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1562
                return ae
×
1563
        }
×
1564

1565
        e := ApiErrors[JSConsumerMaxRequestBatchExceededF]
4✔
1566
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
4✔
1567
        return &ApiError{
4✔
1568
                Code:        e.Code,
4✔
1569
                ErrCode:     e.ErrCode,
4✔
1570
                Description: strings.NewReplacer(args...).Replace(e.Description),
4✔
1571
        }
4✔
1572
}
1573

1574
// NewJSConsumerMaxRequestBatchNegativeError creates a new JSConsumerMaxRequestBatchNegativeErr error: "consumer max request batch needs to be > 0"
1575
func NewJSConsumerMaxRequestBatchNegativeError(opts ...ErrorOption) *ApiError {
×
1576
        eopts := parseOpts(opts)
×
1577
        if ae, ok := eopts.err.(*ApiError); ok {
×
1578
                return ae
×
1579
        }
×
1580

1581
        return ApiErrors[JSConsumerMaxRequestBatchNegativeErr]
×
1582
}
1583

1584
// NewJSConsumerMaxRequestExpiresTooSmallError creates a new JSConsumerMaxRequestExpiresTooSmall error: "consumer max request expires needs to be >= 1ms"
1585
func NewJSConsumerMaxRequestExpiresTooSmallError(opts ...ErrorOption) *ApiError {
×
1586
        eopts := parseOpts(opts)
×
1587
        if ae, ok := eopts.err.(*ApiError); ok {
×
1588
                return ae
×
1589
        }
×
1590

1591
        return ApiErrors[JSConsumerMaxRequestExpiresTooSmall]
×
1592
}
1593

1594
// NewJSConsumerMaxWaitingNegativeError creates a new JSConsumerMaxWaitingNegativeErr error: "consumer max waiting needs to be positive"
1595
func NewJSConsumerMaxWaitingNegativeError(opts ...ErrorOption) *ApiError {
×
1596
        eopts := parseOpts(opts)
×
1597
        if ae, ok := eopts.err.(*ApiError); ok {
×
1598
                return ae
×
1599
        }
×
1600

1601
        return ApiErrors[JSConsumerMaxWaitingNegativeErr]
×
1602
}
1603

1604
// NewJSConsumerMetadataLengthError creates a new JSConsumerMetadataLengthErrF error: "consumer metadata exceeds maximum size of {limit}"
1605
func NewJSConsumerMetadataLengthError(limit interface{}, opts ...ErrorOption) *ApiError {
1✔
1606
        eopts := parseOpts(opts)
1✔
1607
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1608
                return ae
×
1609
        }
×
1610

1611
        e := ApiErrors[JSConsumerMetadataLengthErrF]
1✔
1612
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
1✔
1613
        return &ApiError{
1✔
1614
                Code:        e.Code,
1✔
1615
                ErrCode:     e.ErrCode,
1✔
1616
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1617
        }
1✔
1618
}
1619

1620
// NewJSConsumerMultipleFiltersNotAllowedError creates a new JSConsumerMultipleFiltersNotAllowed error: "consumer with multiple subject filters cannot use subject based API"
1621
func NewJSConsumerMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
1622
        eopts := parseOpts(opts)
1✔
1623
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1624
                return ae
×
1625
        }
×
1626

1627
        return ApiErrors[JSConsumerMultipleFiltersNotAllowed]
1✔
1628
}
1629

1630
// NewJSConsumerNameContainsPathSeparatorsError creates a new JSConsumerNameContainsPathSeparatorsErr error: "Consumer name can not contain path separators"
1631
func NewJSConsumerNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
8✔
1632
        eopts := parseOpts(opts)
8✔
1633
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1634
                return ae
×
1635
        }
×
1636

1637
        return ApiErrors[JSConsumerNameContainsPathSeparatorsErr]
8✔
1638
}
1639

1640
// NewJSConsumerNameExistError creates a new JSConsumerNameExistErr error: "consumer name already in use"
1641
func NewJSConsumerNameExistError(opts ...ErrorOption) *ApiError {
2✔
1642
        eopts := parseOpts(opts)
2✔
1643
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1644
                return ae
×
1645
        }
×
1646

1647
        return ApiErrors[JSConsumerNameExistErr]
2✔
1648
}
1649

1650
// NewJSConsumerNameTooLongError creates a new JSConsumerNameTooLongErrF error: "consumer name is too long, maximum allowed is {max}"
1651
func NewJSConsumerNameTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
×
1652
        eopts := parseOpts(opts)
×
1653
        if ae, ok := eopts.err.(*ApiError); ok {
×
1654
                return ae
×
1655
        }
×
1656

1657
        e := ApiErrors[JSConsumerNameTooLongErrF]
×
1658
        args := e.toReplacerArgs([]interface{}{"{max}", max})
×
1659
        return &ApiError{
×
1660
                Code:        e.Code,
×
1661
                ErrCode:     e.ErrCode,
×
1662
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1663
        }
×
1664
}
1665

1666
// NewJSConsumerNotFoundError creates a new JSConsumerNotFoundErr error: "consumer not found"
1667
func NewJSConsumerNotFoundError(opts ...ErrorOption) *ApiError {
2,860✔
1668
        eopts := parseOpts(opts)
2,860✔
1669
        if ae, ok := eopts.err.(*ApiError); ok {
2,860✔
1670
                return ae
×
1671
        }
×
1672

1673
        return ApiErrors[JSConsumerNotFoundErr]
2,860✔
1674
}
1675

1676
// NewJSConsumerOfflineError creates a new JSConsumerOfflineErr error: "consumer is offline"
1677
func NewJSConsumerOfflineError(opts ...ErrorOption) *ApiError {
6✔
1678
        eopts := parseOpts(opts)
6✔
1679
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1680
                return ae
×
1681
        }
×
1682

1683
        return ApiErrors[JSConsumerOfflineErr]
6✔
1684
}
1685

1686
// NewJSConsumerOfflineReasonError creates a new JSConsumerOfflineReasonErrF error: "consumer is offline: {err}"
1687
func NewJSConsumerOfflineReasonError(err error, opts ...ErrorOption) *ApiError {
24✔
1688
        eopts := parseOpts(opts)
24✔
1689
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
1690
                return ae
×
1691
        }
×
1692

1693
        e := ApiErrors[JSConsumerOfflineReasonErrF]
24✔
1694
        args := e.toReplacerArgs([]interface{}{"{err}", err})
24✔
1695
        return &ApiError{
24✔
1696
                Code:        e.Code,
24✔
1697
                ErrCode:     e.ErrCode,
24✔
1698
                Description: strings.NewReplacer(args...).Replace(e.Description),
24✔
1699
        }
24✔
1700
}
1701

1702
// NewJSConsumerOnMappedError creates a new JSConsumerOnMappedErr error: "consumer direct on a mapped consumer"
1703
func NewJSConsumerOnMappedError(opts ...ErrorOption) *ApiError {
×
1704
        eopts := parseOpts(opts)
×
1705
        if ae, ok := eopts.err.(*ApiError); ok {
×
1706
                return ae
×
1707
        }
×
1708

1709
        return ApiErrors[JSConsumerOnMappedErr]
×
1710
}
1711

1712
// NewJSConsumerOverlappingSubjectFiltersError creates a new JSConsumerOverlappingSubjectFilters error: "consumer subject filters cannot overlap"
1713
func NewJSConsumerOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
3✔
1714
        eopts := parseOpts(opts)
3✔
1715
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1716
                return ae
×
1717
        }
×
1718

1719
        return ApiErrors[JSConsumerOverlappingSubjectFilters]
3✔
1720
}
1721

1722
// NewJSConsumerPinnedTTLWithoutPriorityPolicyNoneError creates a new JSConsumerPinnedTTLWithoutPriorityPolicyNone error: "PinnedTTL cannot be set when PriorityPolicy is none"
1723
func NewJSConsumerPinnedTTLWithoutPriorityPolicyNoneError(opts ...ErrorOption) *ApiError {
1✔
1724
        eopts := parseOpts(opts)
1✔
1725
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1726
                return ae
×
1727
        }
×
1728

1729
        return ApiErrors[JSConsumerPinnedTTLWithoutPriorityPolicyNone]
1✔
1730
}
1731

1732
// NewJSConsumerPriorityGroupWithPolicyNoneError creates a new JSConsumerPriorityGroupWithPolicyNone error: "consumer can not have priority groups when policy is none"
1733
func NewJSConsumerPriorityGroupWithPolicyNoneError(opts ...ErrorOption) *ApiError {
1✔
1734
        eopts := parseOpts(opts)
1✔
1735
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1736
                return ae
×
1737
        }
×
1738

1739
        return ApiErrors[JSConsumerPriorityGroupWithPolicyNone]
1✔
1740
}
1741

1742
// NewJSConsumerPriorityPolicyWithoutGroupError creates a new JSConsumerPriorityPolicyWithoutGroup error: "Setting PriorityPolicy requires at least one PriorityGroup to be set"
1743
func NewJSConsumerPriorityPolicyWithoutGroupError(opts ...ErrorOption) *ApiError {
4✔
1744
        eopts := parseOpts(opts)
4✔
1745
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1746
                return ae
×
1747
        }
×
1748

1749
        return ApiErrors[JSConsumerPriorityPolicyWithoutGroup]
4✔
1750
}
1751

1752
// NewJSConsumerPullNotDurableError creates a new JSConsumerPullNotDurableErr error: "consumer in pull mode requires a durable name"
1753
func NewJSConsumerPullNotDurableError(opts ...ErrorOption) *ApiError {
×
1754
        eopts := parseOpts(opts)
×
1755
        if ae, ok := eopts.err.(*ApiError); ok {
×
1756
                return ae
×
1757
        }
×
1758

1759
        return ApiErrors[JSConsumerPullNotDurableErr]
×
1760
}
1761

1762
// NewJSConsumerPullRequiresAckError creates a new JSConsumerPullRequiresAckErr error: "consumer in pull mode requires explicit ack policy on workqueue stream"
1763
func NewJSConsumerPullRequiresAckError(opts ...ErrorOption) *ApiError {
6✔
1764
        eopts := parseOpts(opts)
6✔
1765
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1766
                return ae
×
1767
        }
×
1768

1769
        return ApiErrors[JSConsumerPullRequiresAckErr]
6✔
1770
}
1771

1772
// NewJSConsumerPullWithRateLimitError creates a new JSConsumerPullWithRateLimitErr error: "consumer in pull mode can not have rate limit set"
1773
func NewJSConsumerPullWithRateLimitError(opts ...ErrorOption) *ApiError {
1✔
1774
        eopts := parseOpts(opts)
1✔
1775
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1776
                return ae
×
1777
        }
×
1778

1779
        return ApiErrors[JSConsumerPullWithRateLimitErr]
1✔
1780
}
1781

1782
// NewJSConsumerPushMaxWaitingError creates a new JSConsumerPushMaxWaitingErr error: "consumer in push mode can not set max waiting"
1783
func NewJSConsumerPushMaxWaitingError(opts ...ErrorOption) *ApiError {
3✔
1784
        eopts := parseOpts(opts)
3✔
1785
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1786
                return ae
×
1787
        }
×
1788

1789
        return ApiErrors[JSConsumerPushMaxWaitingErr]
3✔
1790
}
1791

1792
// NewJSConsumerPushWithPriorityGroupError creates a new JSConsumerPushWithPriorityGroupErr error: "priority groups can not be used with push consumers"
1793
func NewJSConsumerPushWithPriorityGroupError(opts ...ErrorOption) *ApiError {
1✔
1794
        eopts := parseOpts(opts)
1✔
1795
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1796
                return ae
×
1797
        }
×
1798

1799
        return ApiErrors[JSConsumerPushWithPriorityGroupErr]
1✔
1800
}
1801

1802
// NewJSConsumerReplacementWithDifferentNameError creates a new JSConsumerReplacementWithDifferentNameErr error: "consumer replacement durable config not the same"
1803
func NewJSConsumerReplacementWithDifferentNameError(opts ...ErrorOption) *ApiError {
×
1804
        eopts := parseOpts(opts)
×
1805
        if ae, ok := eopts.err.(*ApiError); ok {
×
1806
                return ae
×
1807
        }
×
1808

1809
        return ApiErrors[JSConsumerReplacementWithDifferentNameErr]
×
1810
}
1811

1812
// NewJSConsumerReplayPolicyInvalidError creates a new JSConsumerReplayPolicyInvalidErr error: "consumer replay policy invalid"
1813
func NewJSConsumerReplayPolicyInvalidError(opts ...ErrorOption) *ApiError {
2✔
1814
        eopts := parseOpts(opts)
2✔
1815
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1816
                return ae
×
1817
        }
×
1818

1819
        return ApiErrors[JSConsumerReplayPolicyInvalidErr]
2✔
1820
}
1821

1822
// NewJSConsumerReplicasExceedsStreamError creates a new JSConsumerReplicasExceedsStream error: "consumer config replica count exceeds parent stream"
1823
func NewJSConsumerReplicasExceedsStreamError(opts ...ErrorOption) *ApiError {
1✔
1824
        eopts := parseOpts(opts)
1✔
1825
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1826
                return ae
×
1827
        }
×
1828

1829
        return ApiErrors[JSConsumerReplicasExceedsStream]
1✔
1830
}
1831

1832
// NewJSConsumerReplicasShouldMatchStreamError creates a new JSConsumerReplicasShouldMatchStream error: "consumer config replicas must match interest retention stream's replicas"
1833
func NewJSConsumerReplicasShouldMatchStreamError(opts ...ErrorOption) *ApiError {
2✔
1834
        eopts := parseOpts(opts)
2✔
1835
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1836
                return ae
×
1837
        }
×
1838

1839
        return ApiErrors[JSConsumerReplicasShouldMatchStream]
2✔
1840
}
1841

1842
// NewJSConsumerSmallHeartbeatError creates a new JSConsumerSmallHeartbeatErr error: "consumer idle heartbeat needs to be >= 100ms"
1843
func NewJSConsumerSmallHeartbeatError(opts ...ErrorOption) *ApiError {
1✔
1844
        eopts := parseOpts(opts)
1✔
1845
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1846
                return ae
×
1847
        }
×
1848

1849
        return ApiErrors[JSConsumerSmallHeartbeatErr]
1✔
1850
}
1851

1852
// NewJSConsumerStoreFailedError creates a new JSConsumerStoreFailedErrF error: "error creating store for consumer: {err}"
1853
func NewJSConsumerStoreFailedError(err error, opts ...ErrorOption) *ApiError {
9✔
1854
        eopts := parseOpts(opts)
9✔
1855
        if ae, ok := eopts.err.(*ApiError); ok {
9✔
1856
                return ae
×
1857
        }
×
1858

1859
        e := ApiErrors[JSConsumerStoreFailedErrF]
9✔
1860
        args := e.toReplacerArgs([]interface{}{"{err}", err})
9✔
1861
        return &ApiError{
9✔
1862
                Code:        e.Code,
9✔
1863
                ErrCode:     e.ErrCode,
9✔
1864
                Description: strings.NewReplacer(args...).Replace(e.Description),
9✔
1865
        }
9✔
1866
}
1867

1868
// NewJSConsumerWQConsumerNotDeliverAllError creates a new JSConsumerWQConsumerNotDeliverAllErr error: "consumer must be deliver all on workqueue stream"
1869
func NewJSConsumerWQConsumerNotDeliverAllError(opts ...ErrorOption) *ApiError {
×
1870
        eopts := parseOpts(opts)
×
1871
        if ae, ok := eopts.err.(*ApiError); ok {
×
1872
                return ae
×
1873
        }
×
1874

1875
        return ApiErrors[JSConsumerWQConsumerNotDeliverAllErr]
×
1876
}
1877

1878
// NewJSConsumerWQConsumerNotUniqueError creates a new JSConsumerWQConsumerNotUniqueErr error: "filtered consumer not unique on workqueue stream"
1879
func NewJSConsumerWQConsumerNotUniqueError(opts ...ErrorOption) *ApiError {
11✔
1880
        eopts := parseOpts(opts)
11✔
1881
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
1882
                return ae
×
1883
        }
×
1884

1885
        return ApiErrors[JSConsumerWQConsumerNotUniqueErr]
11✔
1886
}
1887

1888
// NewJSConsumerWQMultipleUnfilteredError creates a new JSConsumerWQMultipleUnfilteredErr error: "multiple non-filtered consumers not allowed on workqueue stream"
1889
func NewJSConsumerWQMultipleUnfilteredError(opts ...ErrorOption) *ApiError {
2✔
1890
        eopts := parseOpts(opts)
2✔
1891
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1892
                return ae
×
1893
        }
×
1894

1895
        return ApiErrors[JSConsumerWQMultipleUnfilteredErr]
2✔
1896
}
1897

1898
// NewJSConsumerWQRequiresExplicitAckError creates a new JSConsumerWQRequiresExplicitAckErr error: "workqueue stream requires explicit ack"
1899
func NewJSConsumerWQRequiresExplicitAckError(opts ...ErrorOption) *ApiError {
×
1900
        eopts := parseOpts(opts)
×
1901
        if ae, ok := eopts.err.(*ApiError); ok {
×
1902
                return ae
×
1903
        }
×
1904

1905
        return ApiErrors[JSConsumerWQRequiresExplicitAckErr]
×
1906
}
1907

1908
// NewJSConsumerWithFlowControlNeedsHeartbeatsError creates a new JSConsumerWithFlowControlNeedsHeartbeats error: "consumer with flow control also needs heartbeats"
1909
func NewJSConsumerWithFlowControlNeedsHeartbeatsError(opts ...ErrorOption) *ApiError {
4✔
1910
        eopts := parseOpts(opts)
4✔
1911
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1912
                return ae
×
1913
        }
×
1914

1915
        return ApiErrors[JSConsumerWithFlowControlNeedsHeartbeats]
4✔
1916
}
1917

1918
// NewJSInsufficientResourcesError creates a new JSInsufficientResourcesErr error: "insufficient resources"
1919
func NewJSInsufficientResourcesError(opts ...ErrorOption) *ApiError {
12✔
1920
        eopts := parseOpts(opts)
12✔
1921
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
1922
                return ae
×
1923
        }
×
1924

1925
        return ApiErrors[JSInsufficientResourcesErr]
12✔
1926
}
1927

1928
// NewJSInvalidJSONError creates a new JSInvalidJSONErr error: "invalid JSON: {err}"
1929
func NewJSInvalidJSONError(err error, opts ...ErrorOption) *ApiError {
8✔
1930
        eopts := parseOpts(opts)
8✔
1931
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1932
                return ae
×
1933
        }
×
1934

1935
        e := ApiErrors[JSInvalidJSONErr]
8✔
1936
        args := e.toReplacerArgs([]interface{}{"{err}", err})
8✔
1937
        return &ApiError{
8✔
1938
                Code:        e.Code,
8✔
1939
                ErrCode:     e.ErrCode,
8✔
1940
                Description: strings.NewReplacer(args...).Replace(e.Description),
8✔
1941
        }
8✔
1942
}
1943

1944
// NewJSMaximumConsumersLimitError creates a new JSMaximumConsumersLimitErr error: "maximum consumers limit reached"
1945
func NewJSMaximumConsumersLimitError(opts ...ErrorOption) *ApiError {
43✔
1946
        eopts := parseOpts(opts)
43✔
1947
        if ae, ok := eopts.err.(*ApiError); ok {
43✔
1948
                return ae
×
1949
        }
×
1950

1951
        return ApiErrors[JSMaximumConsumersLimitErr]
43✔
1952
}
1953

1954
// NewJSMaximumStreamsLimitError creates a new JSMaximumStreamsLimitErr error: "maximum number of streams reached"
1955
func NewJSMaximumStreamsLimitError(opts ...ErrorOption) *ApiError {
16✔
1956
        eopts := parseOpts(opts)
16✔
1957
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
1958
                return ae
×
1959
        }
×
1960

1961
        return ApiErrors[JSMaximumStreamsLimitErr]
16✔
1962
}
1963

1964
// NewJSMemoryResourcesExceededError creates a new JSMemoryResourcesExceededErr error: "insufficient memory resources available"
1965
func NewJSMemoryResourcesExceededError(opts ...ErrorOption) *ApiError {
9✔
1966
        eopts := parseOpts(opts)
9✔
1967
        if ae, ok := eopts.err.(*ApiError); ok {
9✔
1968
                return ae
×
1969
        }
×
1970

1971
        return ApiErrors[JSMemoryResourcesExceededErr]
9✔
1972
}
1973

1974
// NewJSMessageCounterBrokenError creates a new JSMessageCounterBrokenErr error: "message counter is broken"
1975
func NewJSMessageCounterBrokenError(opts ...ErrorOption) *ApiError {
4✔
1976
        eopts := parseOpts(opts)
4✔
1977
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1978
                return ae
×
1979
        }
×
1980

1981
        return ApiErrors[JSMessageCounterBrokenErr]
4✔
1982
}
1983

1984
// NewJSMessageIncrDisabledError creates a new JSMessageIncrDisabledErr error: "message counters is disabled"
1985
func NewJSMessageIncrDisabledError(opts ...ErrorOption) *ApiError {
4✔
1986
        eopts := parseOpts(opts)
4✔
1987
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1988
                return ae
×
1989
        }
×
1990

1991
        return ApiErrors[JSMessageIncrDisabledErr]
4✔
1992
}
1993

1994
// NewJSMessageIncrInvalidError creates a new JSMessageIncrInvalidErr error: "message counter increment is invalid"
1995
func NewJSMessageIncrInvalidError(opts ...ErrorOption) *ApiError {
24✔
1996
        eopts := parseOpts(opts)
24✔
1997
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
1998
                return ae
×
1999
        }
×
2000

2001
        return ApiErrors[JSMessageIncrInvalidErr]
24✔
2002
}
2003

2004
// NewJSMessageIncrMissingError creates a new JSMessageIncrMissingErr error: "message counter increment is missing"
2005
func NewJSMessageIncrMissingError(opts ...ErrorOption) *ApiError {
8✔
2006
        eopts := parseOpts(opts)
8✔
2007
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
2008
                return ae
×
2009
        }
×
2010

2011
        return ApiErrors[JSMessageIncrMissingErr]
8✔
2012
}
2013

2014
// NewJSMessageIncrPayloadError creates a new JSMessageIncrPayloadErr error: "message counter has payload"
2015
func NewJSMessageIncrPayloadError(opts ...ErrorOption) *ApiError {
4✔
2016
        eopts := parseOpts(opts)
4✔
2017
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2018
                return ae
×
2019
        }
×
2020

2021
        return ApiErrors[JSMessageIncrPayloadErr]
4✔
2022
}
2023

2024
// NewJSMessageSchedulesDisabledError creates a new JSMessageSchedulesDisabledErr error: "message schedules is disabled"
2025
func NewJSMessageSchedulesDisabledError(opts ...ErrorOption) *ApiError {
20✔
2026
        eopts := parseOpts(opts)
20✔
2027
        if ae, ok := eopts.err.(*ApiError); ok {
20✔
2028
                return ae
×
2029
        }
×
2030

2031
        return ApiErrors[JSMessageSchedulesDisabledErr]
20✔
2032
}
2033

2034
// NewJSMessageSchedulesPatternInvalidError creates a new JSMessageSchedulesPatternInvalidErr error: "message schedules pattern is invalid"
2035
func NewJSMessageSchedulesPatternInvalidError(opts ...ErrorOption) *ApiError {
15✔
2036
        eopts := parseOpts(opts)
15✔
2037
        if ae, ok := eopts.err.(*ApiError); ok {
15✔
2038
                return ae
×
2039
        }
×
2040

2041
        return ApiErrors[JSMessageSchedulesPatternInvalidErr]
15✔
2042
}
2043

2044
// NewJSMessageSchedulesRollupInvalidError creates a new JSMessageSchedulesRollupInvalidErr error: "message schedules invalid rollup"
2045
func NewJSMessageSchedulesRollupInvalidError(opts ...ErrorOption) *ApiError {
8✔
2046
        eopts := parseOpts(opts)
8✔
2047
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
2048
                return ae
×
2049
        }
×
2050

2051
        return ApiErrors[JSMessageSchedulesRollupInvalidErr]
8✔
2052
}
2053

2054
// NewJSMessageSchedulesSourceInvalidError creates a new JSMessageSchedulesSourceInvalidErr error: "message schedules source is invalid"
2055
func NewJSMessageSchedulesSourceInvalidError(opts ...ErrorOption) *ApiError {
32✔
2056
        eopts := parseOpts(opts)
32✔
2057
        if ae, ok := eopts.err.(*ApiError); ok {
32✔
2058
                return ae
×
2059
        }
×
2060

2061
        return ApiErrors[JSMessageSchedulesSourceInvalidErr]
32✔
2062
}
2063

2064
// NewJSMessageSchedulesTTLInvalidError creates a new JSMessageSchedulesTTLInvalidErr error: "message schedules invalid per-message TTL"
2065
func NewJSMessageSchedulesTTLInvalidError(opts ...ErrorOption) *ApiError {
10✔
2066
        eopts := parseOpts(opts)
10✔
2067
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2068
                return ae
×
2069
        }
×
2070

2071
        return ApiErrors[JSMessageSchedulesTTLInvalidErr]
10✔
2072
}
2073

2074
// NewJSMessageSchedulesTargetInvalidError creates a new JSMessageSchedulesTargetInvalidErr error: "message schedules target is invalid"
2075
func NewJSMessageSchedulesTargetInvalidError(opts ...ErrorOption) *ApiError {
30✔
2076
        eopts := parseOpts(opts)
30✔
2077
        if ae, ok := eopts.err.(*ApiError); ok {
30✔
2078
                return ae
×
2079
        }
×
2080

2081
        return ApiErrors[JSMessageSchedulesTargetInvalidErr]
30✔
2082
}
2083

2084
// NewJSMessageTTLDisabledError creates a new JSMessageTTLDisabledErr error: "per-message TTL is disabled"
2085
func NewJSMessageTTLDisabledError(opts ...ErrorOption) *ApiError {
16✔
2086
        eopts := parseOpts(opts)
16✔
2087
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2088
                return ae
×
2089
        }
×
2090

2091
        return ApiErrors[JSMessageTTLDisabledErr]
16✔
2092
}
2093

2094
// NewJSMessageTTLInvalidError creates a new JSMessageTTLInvalidErr error: "invalid per-message TTL"
2095
func NewJSMessageTTLInvalidError(opts ...ErrorOption) *ApiError {
23✔
2096
        eopts := parseOpts(opts)
23✔
2097
        if ae, ok := eopts.err.(*ApiError); ok {
23✔
2098
                return ae
×
2099
        }
×
2100

2101
        return ApiErrors[JSMessageTTLInvalidErr]
23✔
2102
}
2103

2104
// NewJSMirrorConsumerSetupFailedError creates a new JSMirrorConsumerSetupFailedErrF error: "{err}"
2105
func NewJSMirrorConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
2106
        eopts := parseOpts(opts)
×
2107
        if ae, ok := eopts.err.(*ApiError); ok {
×
2108
                return ae
×
2109
        }
×
2110

2111
        e := ApiErrors[JSMirrorConsumerSetupFailedErrF]
×
2112
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2113
        return &ApiError{
×
2114
                Code:        e.Code,
×
2115
                ErrCode:     e.ErrCode,
×
2116
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2117
        }
×
2118
}
2119

2120
// NewJSMirrorInvalidStreamNameError creates a new JSMirrorInvalidStreamName error: "mirrored stream name is invalid"
2121
func NewJSMirrorInvalidStreamNameError(opts ...ErrorOption) *ApiError {
×
2122
        eopts := parseOpts(opts)
×
2123
        if ae, ok := eopts.err.(*ApiError); ok {
×
2124
                return ae
×
2125
        }
×
2126

2127
        return ApiErrors[JSMirrorInvalidStreamName]
×
2128
}
2129

2130
// NewJSMirrorInvalidSubjectFilterError creates a new JSMirrorInvalidSubjectFilter error: "mirror transform source: {err}"
2131
func NewJSMirrorInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
2✔
2132
        eopts := parseOpts(opts)
2✔
2133
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2134
                return ae
×
2135
        }
×
2136

2137
        e := ApiErrors[JSMirrorInvalidSubjectFilter]
2✔
2138
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2✔
2139
        return &ApiError{
2✔
2140
                Code:        e.Code,
2✔
2141
                ErrCode:     e.ErrCode,
2✔
2142
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2143
        }
2✔
2144
}
2145

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

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

2162
// NewJSMirrorMaxMessageSizeTooBigError creates a new JSMirrorMaxMessageSizeTooBigErr error: "stream mirror must have max message size >= source"
2163
func NewJSMirrorMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
2164
        eopts := parseOpts(opts)
×
2165
        if ae, ok := eopts.err.(*ApiError); ok {
×
2166
                return ae
×
2167
        }
×
2168

2169
        return ApiErrors[JSMirrorMaxMessageSizeTooBigErr]
×
2170
}
2171

2172
// NewJSMirrorMultipleFiltersNotAllowedError creates a new JSMirrorMultipleFiltersNotAllowed error: "mirror with multiple subject transforms cannot also have a single subject filter"
2173
func NewJSMirrorMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
2174
        eopts := parseOpts(opts)
1✔
2175
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2176
                return ae
×
2177
        }
×
2178

2179
        return ApiErrors[JSMirrorMultipleFiltersNotAllowed]
1✔
2180
}
2181

2182
// NewJSMirrorOverlappingSubjectFiltersError creates a new JSMirrorOverlappingSubjectFilters error: "mirror subject filters can not overlap"
2183
func NewJSMirrorOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
2✔
2184
        eopts := parseOpts(opts)
2✔
2185
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2186
                return ae
×
2187
        }
×
2188

2189
        return ApiErrors[JSMirrorOverlappingSubjectFilters]
2✔
2190
}
2191

2192
// NewJSMirrorWithAtomicPublishError creates a new JSMirrorWithAtomicPublishErr error: "stream mirrors can not also use atomic publishing"
2193
func NewJSMirrorWithAtomicPublishError(opts ...ErrorOption) *ApiError {
4✔
2194
        eopts := parseOpts(opts)
4✔
2195
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2196
                return ae
×
2197
        }
×
2198

2199
        return ApiErrors[JSMirrorWithAtomicPublishErr]
4✔
2200
}
2201

2202
// NewJSMirrorWithBatchPublishError creates a new JSMirrorWithBatchPublishErr error: "stream mirrors can not also use batch publishing"
2203
func NewJSMirrorWithBatchPublishError(opts ...ErrorOption) *ApiError {
4✔
2204
        eopts := parseOpts(opts)
4✔
2205
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2206
                return ae
×
2207
        }
×
2208

2209
        return ApiErrors[JSMirrorWithBatchPublishErr]
4✔
2210
}
2211

2212
// NewJSMirrorWithCountersError creates a new JSMirrorWithCountersErr error: "stream mirrors can not also calculate counters"
2213
func NewJSMirrorWithCountersError(opts ...ErrorOption) *ApiError {
4✔
2214
        eopts := parseOpts(opts)
4✔
2215
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2216
                return ae
×
2217
        }
×
2218

2219
        return ApiErrors[JSMirrorWithCountersErr]
4✔
2220
}
2221

2222
// NewJSMirrorWithFirstSeqError creates a new JSMirrorWithFirstSeqErr error: "stream mirrors can not have first sequence configured"
2223
func NewJSMirrorWithFirstSeqError(opts ...ErrorOption) *ApiError {
2✔
2224
        eopts := parseOpts(opts)
2✔
2225
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2226
                return ae
×
2227
        }
×
2228

2229
        return ApiErrors[JSMirrorWithFirstSeqErr]
2✔
2230
}
2231

2232
// NewJSMirrorWithMsgSchedulesError creates a new JSMirrorWithMsgSchedulesErr error: "stream mirrors can not also schedule messages"
2233
func NewJSMirrorWithMsgSchedulesError(opts ...ErrorOption) *ApiError {
2✔
2234
        eopts := parseOpts(opts)
2✔
2235
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2236
                return ae
×
2237
        }
×
2238

2239
        return ApiErrors[JSMirrorWithMsgSchedulesErr]
2✔
2240
}
2241

2242
// NewJSMirrorWithSourcesError creates a new JSMirrorWithSourcesErr error: "stream mirrors can not also contain other sources"
2243
func NewJSMirrorWithSourcesError(opts ...ErrorOption) *ApiError {
×
2244
        eopts := parseOpts(opts)
×
2245
        if ae, ok := eopts.err.(*ApiError); ok {
×
2246
                return ae
×
2247
        }
×
2248

2249
        return ApiErrors[JSMirrorWithSourcesErr]
×
2250
}
2251

2252
// NewJSMirrorWithStartSeqAndTimeError creates a new JSMirrorWithStartSeqAndTimeErr error: "stream mirrors can not have both start seq and start time configured"
2253
func NewJSMirrorWithStartSeqAndTimeError(opts ...ErrorOption) *ApiError {
×
2254
        eopts := parseOpts(opts)
×
2255
        if ae, ok := eopts.err.(*ApiError); ok {
×
2256
                return ae
×
2257
        }
×
2258

2259
        return ApiErrors[JSMirrorWithStartSeqAndTimeErr]
×
2260
}
2261

2262
// NewJSMirrorWithSubjectFiltersError creates a new JSMirrorWithSubjectFiltersErr error: "stream mirrors can not contain filtered subjects"
2263
func NewJSMirrorWithSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
2264
        eopts := parseOpts(opts)
×
2265
        if ae, ok := eopts.err.(*ApiError); ok {
×
2266
                return ae
×
2267
        }
×
2268

2269
        return ApiErrors[JSMirrorWithSubjectFiltersErr]
×
2270
}
2271

2272
// NewJSMirrorWithSubjectsError creates a new JSMirrorWithSubjectsErr error: "stream mirrors can not contain subjects"
2273
func NewJSMirrorWithSubjectsError(opts ...ErrorOption) *ApiError {
2✔
2274
        eopts := parseOpts(opts)
2✔
2275
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2276
                return ae
×
2277
        }
×
2278

2279
        return ApiErrors[JSMirrorWithSubjectsErr]
2✔
2280
}
2281

2282
// NewJSNoAccountError creates a new JSNoAccountErr error: "account not found"
2283
func NewJSNoAccountError(opts ...ErrorOption) *ApiError {
1✔
2284
        eopts := parseOpts(opts)
1✔
2285
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2286
                return ae
×
2287
        }
×
2288

2289
        return ApiErrors[JSNoAccountErr]
1✔
2290
}
2291

2292
// NewJSNoLimitsError creates a new JSNoLimitsErr error: "no JetStream default or applicable tiered limit present"
2293
func NewJSNoLimitsError(opts ...ErrorOption) *ApiError {
4✔
2294
        eopts := parseOpts(opts)
4✔
2295
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2296
                return ae
×
2297
        }
×
2298

2299
        return ApiErrors[JSNoLimitsErr]
4✔
2300
}
2301

2302
// NewJSNoMessageFoundError creates a new JSNoMessageFoundErr error: "no message found"
2303
func NewJSNoMessageFoundError(opts ...ErrorOption) *ApiError {
845✔
2304
        eopts := parseOpts(opts)
845✔
2305
        if ae, ok := eopts.err.(*ApiError); ok {
845✔
2306
                return ae
×
2307
        }
×
2308

2309
        return ApiErrors[JSNoMessageFoundErr]
845✔
2310
}
2311

2312
// NewJSNotEmptyRequestError creates a new JSNotEmptyRequestErr error: "expected an empty request payload"
2313
func NewJSNotEmptyRequestError(opts ...ErrorOption) *ApiError {
3✔
2314
        eopts := parseOpts(opts)
3✔
2315
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2316
                return ae
×
2317
        }
×
2318

2319
        return ApiErrors[JSNotEmptyRequestErr]
3✔
2320
}
2321

2322
// NewJSNotEnabledError creates a new JSNotEnabledErr error: "JetStream not enabled"
2323
func NewJSNotEnabledError(opts ...ErrorOption) *ApiError {
11✔
2324
        eopts := parseOpts(opts)
11✔
2325
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
2326
                return ae
×
2327
        }
×
2328

2329
        return ApiErrors[JSNotEnabledErr]
11✔
2330
}
2331

2332
// NewJSNotEnabledForAccountError creates a new JSNotEnabledForAccountErr error: "JetStream not enabled for account"
2333
func NewJSNotEnabledForAccountError(opts ...ErrorOption) *ApiError {
312✔
2334
        eopts := parseOpts(opts)
312✔
2335
        if ae, ok := eopts.err.(*ApiError); ok {
312✔
2336
                return ae
×
2337
        }
×
2338

2339
        return ApiErrors[JSNotEnabledForAccountErr]
312✔
2340
}
2341

2342
// NewJSPedanticError creates a new JSPedanticErrF error: "pedantic mode: {err}"
2343
func NewJSPedanticError(err error, opts ...ErrorOption) *ApiError {
36✔
2344
        eopts := parseOpts(opts)
36✔
2345
        if ae, ok := eopts.err.(*ApiError); ok {
36✔
2346
                return ae
×
2347
        }
×
2348

2349
        e := ApiErrors[JSPedanticErrF]
36✔
2350
        args := e.toReplacerArgs([]interface{}{"{err}", err})
36✔
2351
        return &ApiError{
36✔
2352
                Code:        e.Code,
36✔
2353
                ErrCode:     e.ErrCode,
36✔
2354
                Description: strings.NewReplacer(args...).Replace(e.Description),
36✔
2355
        }
36✔
2356
}
2357

2358
// NewJSPeerRemapError creates a new JSPeerRemapErr error: "peer remap failed"
2359
func NewJSPeerRemapError(opts ...ErrorOption) *ApiError {
5✔
2360
        eopts := parseOpts(opts)
5✔
2361
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2362
                return ae
1✔
2363
        }
1✔
2364

2365
        return ApiErrors[JSPeerRemapErr]
4✔
2366
}
2367

2368
// NewJSRaftGeneralError creates a new JSRaftGeneralErrF error: "{err}"
2369
func NewJSRaftGeneralError(err error, opts ...ErrorOption) *ApiError {
×
2370
        eopts := parseOpts(opts)
×
2371
        if ae, ok := eopts.err.(*ApiError); ok {
×
2372
                return ae
×
2373
        }
×
2374

2375
        e := ApiErrors[JSRaftGeneralErrF]
×
2376
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2377
        return &ApiError{
×
2378
                Code:        e.Code,
×
2379
                ErrCode:     e.ErrCode,
×
2380
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2381
        }
×
2382
}
2383

2384
// NewJSReplicasCountCannotBeNegativeError creates a new JSReplicasCountCannotBeNegative error: "replicas count cannot be negative"
2385
func NewJSReplicasCountCannotBeNegativeError(opts ...ErrorOption) *ApiError {
16✔
2386
        eopts := parseOpts(opts)
16✔
2387
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2388
                return ae
×
2389
        }
×
2390

2391
        return ApiErrors[JSReplicasCountCannotBeNegative]
16✔
2392
}
2393

2394
// NewJSRequiredApiLevelError creates a new JSRequiredApiLevelErr error: "JetStream minimum api level required"
2395
func NewJSRequiredApiLevelError(opts ...ErrorOption) *ApiError {
44✔
2396
        eopts := parseOpts(opts)
44✔
2397
        if ae, ok := eopts.err.(*ApiError); ok {
44✔
2398
                return ae
×
2399
        }
×
2400

2401
        return ApiErrors[JSRequiredApiLevelErr]
44✔
2402
}
2403

2404
// NewJSRestoreSubscribeFailedError creates a new JSRestoreSubscribeFailedErrF error: "JetStream unable to subscribe to restore snapshot {subject}: {err}"
2405
func NewJSRestoreSubscribeFailedError(err error, subject interface{}, opts ...ErrorOption) *ApiError {
1✔
2406
        eopts := parseOpts(opts)
1✔
2407
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2408
                return ae
×
2409
        }
×
2410

2411
        e := ApiErrors[JSRestoreSubscribeFailedErrF]
1✔
2412
        args := e.toReplacerArgs([]interface{}{"{err}", err, "{subject}", subject})
1✔
2413
        return &ApiError{
1✔
2414
                Code:        e.Code,
1✔
2415
                ErrCode:     e.ErrCode,
1✔
2416
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2417
        }
1✔
2418
}
2419

2420
// NewJSSequenceNotFoundError creates a new JSSequenceNotFoundErrF error: "sequence {seq} not found"
2421
func NewJSSequenceNotFoundError(seq uint64, opts ...ErrorOption) *ApiError {
2,019✔
2422
        eopts := parseOpts(opts)
2,019✔
2423
        if ae, ok := eopts.err.(*ApiError); ok {
2,019✔
2424
                return ae
×
2425
        }
×
2426

2427
        e := ApiErrors[JSSequenceNotFoundErrF]
2,019✔
2428
        args := e.toReplacerArgs([]interface{}{"{seq}", seq})
2,019✔
2429
        return &ApiError{
2,019✔
2430
                Code:        e.Code,
2,019✔
2431
                ErrCode:     e.ErrCode,
2,019✔
2432
                Description: strings.NewReplacer(args...).Replace(e.Description),
2,019✔
2433
        }
2,019✔
2434
}
2435

2436
// NewJSSnapshotDeliverSubjectInvalidError creates a new JSSnapshotDeliverSubjectInvalidErr error: "deliver subject not valid"
2437
func NewJSSnapshotDeliverSubjectInvalidError(opts ...ErrorOption) *ApiError {
1✔
2438
        eopts := parseOpts(opts)
1✔
2439
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2440
                return ae
×
2441
        }
×
2442

2443
        return ApiErrors[JSSnapshotDeliverSubjectInvalidErr]
1✔
2444
}
2445

2446
// NewJSSourceConsumerSetupFailedError creates a new JSSourceConsumerSetupFailedErrF error: "{err}"
2447
func NewJSSourceConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
2448
        eopts := parseOpts(opts)
×
2449
        if ae, ok := eopts.err.(*ApiError); ok {
×
2450
                return ae
×
2451
        }
×
2452

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

2462
// NewJSSourceDuplicateDetectedError creates a new JSSourceDuplicateDetected error: "duplicate source configuration detected"
2463
func NewJSSourceDuplicateDetectedError(opts ...ErrorOption) *ApiError {
×
2464
        eopts := parseOpts(opts)
×
2465
        if ae, ok := eopts.err.(*ApiError); ok {
×
2466
                return ae
×
2467
        }
×
2468

2469
        return ApiErrors[JSSourceDuplicateDetected]
×
2470
}
2471

2472
// NewJSSourceInvalidStreamNameError creates a new JSSourceInvalidStreamName error: "sourced stream name is invalid"
2473
func NewJSSourceInvalidStreamNameError(opts ...ErrorOption) *ApiError {
2✔
2474
        eopts := parseOpts(opts)
2✔
2475
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2476
                return ae
×
2477
        }
×
2478

2479
        return ApiErrors[JSSourceInvalidStreamName]
2✔
2480
}
2481

2482
// NewJSSourceInvalidSubjectFilterError creates a new JSSourceInvalidSubjectFilter error: "source transform source: {err}"
2483
func NewJSSourceInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
5✔
2484
        eopts := parseOpts(opts)
5✔
2485
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2486
                return ae
×
2487
        }
×
2488

2489
        e := ApiErrors[JSSourceInvalidSubjectFilter]
5✔
2490
        args := e.toReplacerArgs([]interface{}{"{err}", err})
5✔
2491
        return &ApiError{
5✔
2492
                Code:        e.Code,
5✔
2493
                ErrCode:     e.ErrCode,
5✔
2494
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
2495
        }
5✔
2496
}
2497

2498
// NewJSSourceInvalidTransformDestinationError creates a new JSSourceInvalidTransformDestination error: "source transform: {err}"
2499
func NewJSSourceInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
5✔
2500
        eopts := parseOpts(opts)
5✔
2501
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2502
                return ae
×
2503
        }
×
2504

2505
        e := ApiErrors[JSSourceInvalidTransformDestination]
5✔
2506
        args := e.toReplacerArgs([]interface{}{"{err}", err})
5✔
2507
        return &ApiError{
5✔
2508
                Code:        e.Code,
5✔
2509
                ErrCode:     e.ErrCode,
5✔
2510
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
2511
        }
5✔
2512
}
2513

2514
// NewJSSourceMaxMessageSizeTooBigError creates a new JSSourceMaxMessageSizeTooBigErr error: "stream source must have max message size >= target"
2515
func NewJSSourceMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
2516
        eopts := parseOpts(opts)
×
2517
        if ae, ok := eopts.err.(*ApiError); ok {
×
2518
                return ae
×
2519
        }
×
2520

2521
        return ApiErrors[JSSourceMaxMessageSizeTooBigErr]
×
2522
}
2523

2524
// NewJSSourceMultipleFiltersNotAllowedError creates a new JSSourceMultipleFiltersNotAllowed error: "source with multiple subject transforms cannot also have a single subject filter"
2525
func NewJSSourceMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
4✔
2526
        eopts := parseOpts(opts)
4✔
2527
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2528
                return ae
×
2529
        }
×
2530

2531
        return ApiErrors[JSSourceMultipleFiltersNotAllowed]
4✔
2532
}
2533

2534
// NewJSSourceOverlappingSubjectFiltersError creates a new JSSourceOverlappingSubjectFilters error: "source filters can not overlap"
2535
func NewJSSourceOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
4✔
2536
        eopts := parseOpts(opts)
4✔
2537
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2538
                return ae
×
2539
        }
×
2540

2541
        return ApiErrors[JSSourceOverlappingSubjectFilters]
4✔
2542
}
2543

2544
// NewJSSourceWithMsgSchedulesError creates a new JSSourceWithMsgSchedulesErr error: "stream source can not also schedule messages"
2545
func NewJSSourceWithMsgSchedulesError(opts ...ErrorOption) *ApiError {
2✔
2546
        eopts := parseOpts(opts)
2✔
2547
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2548
                return ae
×
2549
        }
×
2550

2551
        return ApiErrors[JSSourceWithMsgSchedulesErr]
2✔
2552
}
2553

2554
// NewJSStorageResourcesExceededError creates a new JSStorageResourcesExceededErr error: "insufficient storage resources available"
2555
func NewJSStorageResourcesExceededError(opts ...ErrorOption) *ApiError {
34✔
2556
        eopts := parseOpts(opts)
34✔
2557
        if ae, ok := eopts.err.(*ApiError); ok {
34✔
2558
                return ae
×
2559
        }
×
2560

2561
        return ApiErrors[JSStorageResourcesExceededErr]
34✔
2562
}
2563

2564
// NewJSStreamAssignmentError creates a new JSStreamAssignmentErrF error: "{err}"
2565
func NewJSStreamAssignmentError(err error, opts ...ErrorOption) *ApiError {
×
2566
        eopts := parseOpts(opts)
×
2567
        if ae, ok := eopts.err.(*ApiError); ok {
×
2568
                return ae
×
2569
        }
×
2570

2571
        e := ApiErrors[JSStreamAssignmentErrF]
×
2572
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2573
        return &ApiError{
×
2574
                Code:        e.Code,
×
2575
                ErrCode:     e.ErrCode,
×
2576
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2577
        }
×
2578
}
2579

2580
// NewJSStreamCreateError creates a new JSStreamCreateErrF error: "{err}"
2581
func NewJSStreamCreateError(err error, opts ...ErrorOption) *ApiError {
68✔
2582
        eopts := parseOpts(opts)
68✔
2583
        if ae, ok := eopts.err.(*ApiError); ok {
133✔
2584
                return ae
65✔
2585
        }
65✔
2586

2587
        e := ApiErrors[JSStreamCreateErrF]
3✔
2588
        args := e.toReplacerArgs([]interface{}{"{err}", err})
3✔
2589
        return &ApiError{
3✔
2590
                Code:        e.Code,
3✔
2591
                ErrCode:     e.ErrCode,
3✔
2592
                Description: strings.NewReplacer(args...).Replace(e.Description),
3✔
2593
        }
3✔
2594
}
2595

2596
// NewJSStreamDeleteError creates a new JSStreamDeleteErrF error: "{err}"
2597
func NewJSStreamDeleteError(err error, opts ...ErrorOption) *ApiError {
×
2598
        eopts := parseOpts(opts)
×
2599
        if ae, ok := eopts.err.(*ApiError); ok {
×
2600
                return ae
×
2601
        }
×
2602

2603
        e := ApiErrors[JSStreamDeleteErrF]
×
2604
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2605
        return &ApiError{
×
2606
                Code:        e.Code,
×
2607
                ErrCode:     e.ErrCode,
×
2608
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2609
        }
×
2610
}
2611

2612
// NewJSStreamDuplicateMessageConflictError creates a new JSStreamDuplicateMessageConflict error: "duplicate message id is in process"
2613
func NewJSStreamDuplicateMessageConflictError(opts ...ErrorOption) *ApiError {
80✔
2614
        eopts := parseOpts(opts)
80✔
2615
        if ae, ok := eopts.err.(*ApiError); ok {
80✔
2616
                return ae
×
2617
        }
×
2618

2619
        return ApiErrors[JSStreamDuplicateMessageConflict]
80✔
2620
}
2621

2622
// NewJSStreamExpectedLastSeqPerSubjectInvalidError creates a new JSStreamExpectedLastSeqPerSubjectInvalid error: "missing sequence for expected last sequence per subject"
2623
func NewJSStreamExpectedLastSeqPerSubjectInvalidError(opts ...ErrorOption) *ApiError {
8✔
2624
        eopts := parseOpts(opts)
8✔
2625
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
2626
                return ae
×
2627
        }
×
2628

2629
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectInvalid]
8✔
2630
}
2631

2632
// NewJSStreamExpectedLastSeqPerSubjectNotReadyError creates a new JSStreamExpectedLastSeqPerSubjectNotReady error: "expected last sequence per subject temporarily unavailable"
2633
func NewJSStreamExpectedLastSeqPerSubjectNotReadyError(opts ...ErrorOption) *ApiError {
×
2634
        eopts := parseOpts(opts)
×
2635
        if ae, ok := eopts.err.(*ApiError); ok {
×
2636
                return ae
×
2637
        }
×
2638

2639
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectNotReady]
×
2640
}
2641

2642
// NewJSStreamExternalApiOverlapError creates a new JSStreamExternalApiOverlapErrF error: "stream external api prefix {prefix} must not overlap with {subject}"
2643
func NewJSStreamExternalApiOverlapError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
2✔
2644
        eopts := parseOpts(opts)
2✔
2645
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2646
                return ae
×
2647
        }
×
2648

2649
        e := ApiErrors[JSStreamExternalApiOverlapErrF]
2✔
2650
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
2✔
2651
        return &ApiError{
2✔
2652
                Code:        e.Code,
2✔
2653
                ErrCode:     e.ErrCode,
2✔
2654
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2655
        }
2✔
2656
}
2657

2658
// NewJSStreamExternalDelPrefixOverlapsError creates a new JSStreamExternalDelPrefixOverlapsErrF error: "stream external delivery prefix {prefix} overlaps with stream subject {subject}"
2659
func NewJSStreamExternalDelPrefixOverlapsError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
×
2660
        eopts := parseOpts(opts)
×
2661
        if ae, ok := eopts.err.(*ApiError); ok {
×
2662
                return ae
×
2663
        }
×
2664

2665
        e := ApiErrors[JSStreamExternalDelPrefixOverlapsErrF]
×
2666
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
×
2667
        return &ApiError{
×
2668
                Code:        e.Code,
×
2669
                ErrCode:     e.ErrCode,
×
2670
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2671
        }
×
2672
}
2673

2674
// NewJSStreamGeneralError creates a new JSStreamGeneralErrorF error: "{err}"
2675
func NewJSStreamGeneralError(err error, opts ...ErrorOption) *ApiError {
3✔
2676
        eopts := parseOpts(opts)
3✔
2677
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2678
                return ae
×
2679
        }
×
2680

2681
        e := ApiErrors[JSStreamGeneralErrorF]
3✔
2682
        args := e.toReplacerArgs([]interface{}{"{err}", err})
3✔
2683
        return &ApiError{
3✔
2684
                Code:        e.Code,
3✔
2685
                ErrCode:     e.ErrCode,
3✔
2686
                Description: strings.NewReplacer(args...).Replace(e.Description),
3✔
2687
        }
3✔
2688
}
2689

2690
// NewJSStreamHeaderExceedsMaximumError creates a new JSStreamHeaderExceedsMaximumErr error: "header size exceeds maximum allowed of 64k"
2691
func NewJSStreamHeaderExceedsMaximumError(opts ...ErrorOption) *ApiError {
1✔
2692
        eopts := parseOpts(opts)
1✔
2693
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2694
                return ae
×
2695
        }
×
2696

2697
        return ApiErrors[JSStreamHeaderExceedsMaximumErr]
1✔
2698
}
2699

2700
// NewJSStreamInfoMaxSubjectsError creates a new JSStreamInfoMaxSubjectsErr error: "subject details would exceed maximum allowed"
2701
func NewJSStreamInfoMaxSubjectsError(opts ...ErrorOption) *ApiError {
×
2702
        eopts := parseOpts(opts)
×
2703
        if ae, ok := eopts.err.(*ApiError); ok {
×
2704
                return ae
×
2705
        }
×
2706

2707
        return ApiErrors[JSStreamInfoMaxSubjectsErr]
×
2708
}
2709

2710
// NewJSStreamInvalidConfigError creates a new JSStreamInvalidConfigF error: "{err}"
2711
func NewJSStreamInvalidConfigError(err error, opts ...ErrorOption) *ApiError {
163✔
2712
        eopts := parseOpts(opts)
163✔
2713
        if ae, ok := eopts.err.(*ApiError); ok {
182✔
2714
                return ae
19✔
2715
        }
19✔
2716

2717
        e := ApiErrors[JSStreamInvalidConfigF]
144✔
2718
        args := e.toReplacerArgs([]interface{}{"{err}", err})
144✔
2719
        return &ApiError{
144✔
2720
                Code:        e.Code,
144✔
2721
                ErrCode:     e.ErrCode,
144✔
2722
                Description: strings.NewReplacer(args...).Replace(e.Description),
144✔
2723
        }
144✔
2724
}
2725

2726
// NewJSStreamInvalidError creates a new JSStreamInvalidErr error: "stream not valid"
2727
func NewJSStreamInvalidError(opts ...ErrorOption) *ApiError {
×
2728
        eopts := parseOpts(opts)
×
2729
        if ae, ok := eopts.err.(*ApiError); ok {
×
2730
                return ae
×
2731
        }
×
2732

2733
        return ApiErrors[JSStreamInvalidErr]
×
2734
}
2735

2736
// NewJSStreamInvalidExternalDeliverySubjError creates a new JSStreamInvalidExternalDeliverySubjErrF error: "stream external delivery prefix {prefix} must not contain wildcards"
2737
func NewJSStreamInvalidExternalDeliverySubjError(prefix interface{}, opts ...ErrorOption) *ApiError {
×
2738
        eopts := parseOpts(opts)
×
2739
        if ae, ok := eopts.err.(*ApiError); ok {
×
2740
                return ae
×
2741
        }
×
2742

2743
        e := ApiErrors[JSStreamInvalidExternalDeliverySubjErrF]
×
2744
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix})
×
2745
        return &ApiError{
×
2746
                Code:        e.Code,
×
2747
                ErrCode:     e.ErrCode,
×
2748
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2749
        }
×
2750
}
2751

2752
// NewJSStreamLimitsError creates a new JSStreamLimitsErrF error: "{err}"
2753
func NewJSStreamLimitsError(err error, opts ...ErrorOption) *ApiError {
17✔
2754
        eopts := parseOpts(opts)
17✔
2755
        if ae, ok := eopts.err.(*ApiError); ok {
34✔
2756
                return ae
17✔
2757
        }
17✔
2758

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

2768
// NewJSStreamMaxBytesRequiredError creates a new JSStreamMaxBytesRequired error: "account requires a stream config to have max bytes set"
2769
func NewJSStreamMaxBytesRequiredError(opts ...ErrorOption) *ApiError {
11✔
2770
        eopts := parseOpts(opts)
11✔
2771
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
2772
                return ae
×
2773
        }
×
2774

2775
        return ApiErrors[JSStreamMaxBytesRequired]
11✔
2776
}
2777

2778
// NewJSStreamMaxStreamBytesExceededError creates a new JSStreamMaxStreamBytesExceeded error: "stream max bytes exceeds account limit max stream bytes"
2779
func NewJSStreamMaxStreamBytesExceededError(opts ...ErrorOption) *ApiError {
12✔
2780
        eopts := parseOpts(opts)
12✔
2781
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
2782
                return ae
×
2783
        }
×
2784

2785
        return ApiErrors[JSStreamMaxStreamBytesExceeded]
12✔
2786
}
2787

2788
// NewJSStreamMessageExceedsMaximumError creates a new JSStreamMessageExceedsMaximumErr error: "message size exceeds maximum allowed"
2789
func NewJSStreamMessageExceedsMaximumError(opts ...ErrorOption) *ApiError {
19✔
2790
        eopts := parseOpts(opts)
19✔
2791
        if ae, ok := eopts.err.(*ApiError); ok {
19✔
2792
                return ae
×
2793
        }
×
2794

2795
        return ApiErrors[JSStreamMessageExceedsMaximumErr]
19✔
2796
}
2797

2798
// NewJSStreamMinLastSeqError creates a new JSStreamMinLastSeqErr error: "min last sequence"
2799
func NewJSStreamMinLastSeqError(opts ...ErrorOption) *ApiError {
×
2800
        eopts := parseOpts(opts)
×
2801
        if ae, ok := eopts.err.(*ApiError); ok {
×
2802
                return ae
×
2803
        }
×
2804

2805
        return ApiErrors[JSStreamMinLastSeqErr]
×
2806
}
2807

2808
// NewJSStreamMirrorNotUpdatableError creates a new JSStreamMirrorNotUpdatableErr error: "stream mirror configuration can not be updated"
2809
func NewJSStreamMirrorNotUpdatableError(opts ...ErrorOption) *ApiError {
2✔
2810
        eopts := parseOpts(opts)
2✔
2811
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2812
                return ae
×
2813
        }
×
2814

2815
        return ApiErrors[JSStreamMirrorNotUpdatableErr]
2✔
2816
}
2817

2818
// NewJSStreamMismatchError creates a new JSStreamMismatchErr error: "stream name in subject does not match request"
2819
func NewJSStreamMismatchError(opts ...ErrorOption) *ApiError {
3✔
2820
        eopts := parseOpts(opts)
3✔
2821
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2822
                return ae
×
2823
        }
×
2824

2825
        return ApiErrors[JSStreamMismatchErr]
3✔
2826
}
2827

2828
// NewJSStreamMoveAndScaleError creates a new JSStreamMoveAndScaleErr error: "can not move and scale a stream in a single update"
2829
func NewJSStreamMoveAndScaleError(opts ...ErrorOption) *ApiError {
4✔
2830
        eopts := parseOpts(opts)
4✔
2831
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2832
                return ae
×
2833
        }
×
2834

2835
        return ApiErrors[JSStreamMoveAndScaleErr]
4✔
2836
}
2837

2838
// NewJSStreamMoveInProgressError creates a new JSStreamMoveInProgressF error: "stream move already in progress: {msg}"
2839
func NewJSStreamMoveInProgressError(msg 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[JSStreamMoveInProgressF]
2✔
2846
        args := e.toReplacerArgs([]interface{}{"{msg}", msg})
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
// NewJSStreamMoveNotInProgressError creates a new JSStreamMoveNotInProgress error: "stream move not in progress"
2855
func NewJSStreamMoveNotInProgressError(opts ...ErrorOption) *ApiError {
×
2856
        eopts := parseOpts(opts)
×
2857
        if ae, ok := eopts.err.(*ApiError); ok {
×
2858
                return ae
×
2859
        }
×
2860

2861
        return ApiErrors[JSStreamMoveNotInProgress]
×
2862
}
2863

2864
// NewJSStreamMsgDeleteFailedError creates a new JSStreamMsgDeleteFailedF error: "{err}"
2865
func NewJSStreamMsgDeleteFailedError(err error, opts ...ErrorOption) *ApiError {
10,837✔
2866
        eopts := parseOpts(opts)
10,837✔
2867
        if ae, ok := eopts.err.(*ApiError); ok {
10,837✔
2868
                return ae
×
2869
        }
×
2870

2871
        e := ApiErrors[JSStreamMsgDeleteFailedF]
10,837✔
2872
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10,837✔
2873
        return &ApiError{
10,837✔
2874
                Code:        e.Code,
10,837✔
2875
                ErrCode:     e.ErrCode,
10,837✔
2876
                Description: strings.NewReplacer(args...).Replace(e.Description),
10,837✔
2877
        }
10,837✔
2878
}
2879

2880
// NewJSStreamNameContainsPathSeparatorsError creates a new JSStreamNameContainsPathSeparatorsErr error: "Stream name can not contain path separators"
2881
func NewJSStreamNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
6✔
2882
        eopts := parseOpts(opts)
6✔
2883
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2884
                return ae
×
2885
        }
×
2886

2887
        return ApiErrors[JSStreamNameContainsPathSeparatorsErr]
6✔
2888
}
2889

2890
// NewJSStreamNameExistError creates a new JSStreamNameExistErr error: "stream name already in use with a different configuration"
2891
func NewJSStreamNameExistError(opts ...ErrorOption) *ApiError {
10✔
2892
        eopts := parseOpts(opts)
10✔
2893
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2894
                return ae
×
2895
        }
×
2896

2897
        return ApiErrors[JSStreamNameExistErr]
10✔
2898
}
2899

2900
// NewJSStreamNameExistRestoreFailedError creates a new JSStreamNameExistRestoreFailedErr error: "stream name already in use, cannot restore"
2901
func NewJSStreamNameExistRestoreFailedError(opts ...ErrorOption) *ApiError {
3✔
2902
        eopts := parseOpts(opts)
3✔
2903
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2904
                return ae
×
2905
        }
×
2906

2907
        return ApiErrors[JSStreamNameExistRestoreFailedErr]
3✔
2908
}
2909

2910
// NewJSStreamNotFoundError creates a new JSStreamNotFoundErr error: "stream not found"
2911
func NewJSStreamNotFoundError(opts ...ErrorOption) *ApiError {
30,312✔
2912
        eopts := parseOpts(opts)
30,312✔
2913
        if ae, ok := eopts.err.(*ApiError); ok {
31,065✔
2914
                return ae
753✔
2915
        }
753✔
2916

2917
        return ApiErrors[JSStreamNotFoundErr]
29,559✔
2918
}
2919

2920
// NewJSStreamNotMatchError creates a new JSStreamNotMatchErr error: "expected stream does not match"
2921
func NewJSStreamNotMatchError(opts ...ErrorOption) *ApiError {
5✔
2922
        eopts := parseOpts(opts)
5✔
2923
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2924
                return ae
×
2925
        }
×
2926

2927
        return ApiErrors[JSStreamNotMatchErr]
5✔
2928
}
2929

2930
// NewJSStreamOfflineError creates a new JSStreamOfflineErr error: "stream is offline"
2931
func NewJSStreamOfflineError(opts ...ErrorOption) *ApiError {
6✔
2932
        eopts := parseOpts(opts)
6✔
2933
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2934
                return ae
×
2935
        }
×
2936

2937
        return ApiErrors[JSStreamOfflineErr]
6✔
2938
}
2939

2940
// NewJSStreamOfflineReasonError creates a new JSStreamOfflineReasonErrF error: "stream is offline: {err}"
2941
func NewJSStreamOfflineReasonError(err error, opts ...ErrorOption) *ApiError {
40✔
2942
        eopts := parseOpts(opts)
40✔
2943
        if ae, ok := eopts.err.(*ApiError); ok {
40✔
2944
                return ae
×
2945
        }
×
2946

2947
        e := ApiErrors[JSStreamOfflineReasonErrF]
40✔
2948
        args := e.toReplacerArgs([]interface{}{"{err}", err})
40✔
2949
        return &ApiError{
40✔
2950
                Code:        e.Code,
40✔
2951
                ErrCode:     e.ErrCode,
40✔
2952
                Description: strings.NewReplacer(args...).Replace(e.Description),
40✔
2953
        }
40✔
2954
}
2955

2956
// NewJSStreamPurgeFailedError creates a new JSStreamPurgeFailedF error: "{err}"
2957
func NewJSStreamPurgeFailedError(err error, opts ...ErrorOption) *ApiError {
1✔
2958
        eopts := parseOpts(opts)
1✔
2959
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2960
                return ae
×
2961
        }
×
2962

2963
        e := ApiErrors[JSStreamPurgeFailedF]
1✔
2964
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2965
        return &ApiError{
1✔
2966
                Code:        e.Code,
1✔
2967
                ErrCode:     e.ErrCode,
1✔
2968
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2969
        }
1✔
2970
}
2971

2972
// NewJSStreamReplicasNotSupportedError creates a new JSStreamReplicasNotSupportedErr error: "replicas > 1 not supported in non-clustered mode"
2973
func NewJSStreamReplicasNotSupportedError(opts ...ErrorOption) *ApiError {
1✔
2974
        eopts := parseOpts(opts)
1✔
2975
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2976
                return ae
×
2977
        }
×
2978

2979
        return ApiErrors[JSStreamReplicasNotSupportedErr]
1✔
2980
}
2981

2982
// NewJSStreamReplicasNotUpdatableError creates a new JSStreamReplicasNotUpdatableErr error: "Replicas configuration can not be updated"
2983
func NewJSStreamReplicasNotUpdatableError(opts ...ErrorOption) *ApiError {
×
2984
        eopts := parseOpts(opts)
×
2985
        if ae, ok := eopts.err.(*ApiError); ok {
×
2986
                return ae
×
2987
        }
×
2988

2989
        return ApiErrors[JSStreamReplicasNotUpdatableErr]
×
2990
}
2991

2992
// NewJSStreamRestoreError creates a new JSStreamRestoreErrF error: "restore failed: {err}"
2993
func NewJSStreamRestoreError(err error, opts ...ErrorOption) *ApiError {
7✔
2994
        eopts := parseOpts(opts)
7✔
2995
        if ae, ok := eopts.err.(*ApiError); ok {
9✔
2996
                return ae
2✔
2997
        }
2✔
2998

2999
        e := ApiErrors[JSStreamRestoreErrF]
5✔
3000
        args := e.toReplacerArgs([]interface{}{"{err}", err})
5✔
3001
        return &ApiError{
5✔
3002
                Code:        e.Code,
5✔
3003
                ErrCode:     e.ErrCode,
5✔
3004
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
3005
        }
5✔
3006
}
3007

3008
// NewJSStreamRollupFailedError creates a new JSStreamRollupFailedF error: "{err}"
3009
func NewJSStreamRollupFailedError(err error, opts ...ErrorOption) *ApiError {
13✔
3010
        eopts := parseOpts(opts)
13✔
3011
        if ae, ok := eopts.err.(*ApiError); ok {
13✔
3012
                return ae
×
3013
        }
×
3014

3015
        e := ApiErrors[JSStreamRollupFailedF]
13✔
3016
        args := e.toReplacerArgs([]interface{}{"{err}", err})
13✔
3017
        return &ApiError{
13✔
3018
                Code:        e.Code,
13✔
3019
                ErrCode:     e.ErrCode,
13✔
3020
                Description: strings.NewReplacer(args...).Replace(e.Description),
13✔
3021
        }
13✔
3022
}
3023

3024
// NewJSStreamSealedError creates a new JSStreamSealedErr error: "invalid operation on sealed stream"
3025
func NewJSStreamSealedError(opts ...ErrorOption) *ApiError {
10✔
3026
        eopts := parseOpts(opts)
10✔
3027
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
3028
                return ae
×
3029
        }
×
3030

3031
        return ApiErrors[JSStreamSealedErr]
10✔
3032
}
3033

3034
// NewJSStreamSequenceNotMatchError creates a new JSStreamSequenceNotMatchErr error: "expected stream sequence does not match"
3035
func NewJSStreamSequenceNotMatchError(opts ...ErrorOption) *ApiError {
×
3036
        eopts := parseOpts(opts)
×
3037
        if ae, ok := eopts.err.(*ApiError); ok {
×
3038
                return ae
×
3039
        }
×
3040

3041
        return ApiErrors[JSStreamSequenceNotMatchErr]
×
3042
}
3043

3044
// NewJSStreamSnapshotError creates a new JSStreamSnapshotErrF error: "snapshot failed: {err}"
3045
func NewJSStreamSnapshotError(err error, opts ...ErrorOption) *ApiError {
×
3046
        eopts := parseOpts(opts)
×
3047
        if ae, ok := eopts.err.(*ApiError); ok {
×
3048
                return ae
×
3049
        }
×
3050

3051
        e := ApiErrors[JSStreamSnapshotErrF]
×
3052
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
3053
        return &ApiError{
×
3054
                Code:        e.Code,
×
3055
                ErrCode:     e.ErrCode,
×
3056
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
3057
        }
×
3058
}
3059

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

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

3076
// NewJSStreamSubjectOverlapError creates a new JSStreamSubjectOverlapErr error: "subjects overlap with an existing stream"
3077
func NewJSStreamSubjectOverlapError(opts ...ErrorOption) *ApiError {
25✔
3078
        eopts := parseOpts(opts)
25✔
3079
        if ae, ok := eopts.err.(*ApiError); ok {
25✔
3080
                return ae
×
3081
        }
×
3082

3083
        return ApiErrors[JSStreamSubjectOverlapErr]
25✔
3084
}
3085

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

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

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

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

3118
// NewJSStreamTemplateNotFoundError creates a new JSStreamTemplateNotFoundErr error: "template not found"
3119
func NewJSStreamTemplateNotFoundError(opts ...ErrorOption) *ApiError {
×
3120
        eopts := parseOpts(opts)
×
3121
        if ae, ok := eopts.err.(*ApiError); ok {
×
3122
                return ae
×
3123
        }
×
3124

3125
        return ApiErrors[JSStreamTemplateNotFoundErr]
×
3126
}
3127

3128
// NewJSStreamTooManyRequestsError creates a new JSStreamTooManyRequests error: "too many requests"
3129
func NewJSStreamTooManyRequestsError(opts ...ErrorOption) *ApiError {
266✔
3130
        eopts := parseOpts(opts)
266✔
3131
        if ae, ok := eopts.err.(*ApiError); ok {
266✔
3132
                return ae
×
3133
        }
×
3134

3135
        return ApiErrors[JSStreamTooManyRequests]
266✔
3136
}
3137

3138
// NewJSStreamTransformInvalidDestinationError creates a new JSStreamTransformInvalidDestination error: "stream transform: {err}"
3139
func NewJSStreamTransformInvalidDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
3140
        eopts := parseOpts(opts)
1✔
3141
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3142
                return ae
×
3143
        }
×
3144

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

3154
// NewJSStreamTransformInvalidSourceError creates a new JSStreamTransformInvalidSource error: "stream transform source: {err}"
3155
func NewJSStreamTransformInvalidSourceError(err error, opts ...ErrorOption) *ApiError {
1✔
3156
        eopts := parseOpts(opts)
1✔
3157
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3158
                return ae
×
3159
        }
×
3160

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

3170
// NewJSStreamUpdateError creates a new JSStreamUpdateErrF error: "{err}"
3171
func NewJSStreamUpdateError(err error, opts ...ErrorOption) *ApiError {
30✔
3172
        eopts := parseOpts(opts)
30✔
3173
        if ae, ok := eopts.err.(*ApiError); ok {
54✔
3174
                return ae
24✔
3175
        }
24✔
3176

3177
        e := ApiErrors[JSStreamUpdateErrF]
6✔
3178
        args := e.toReplacerArgs([]interface{}{"{err}", err})
6✔
3179
        return &ApiError{
6✔
3180
                Code:        e.Code,
6✔
3181
                ErrCode:     e.ErrCode,
6✔
3182
                Description: strings.NewReplacer(args...).Replace(e.Description),
6✔
3183
        }
6✔
3184
}
3185

3186
// NewJSStreamWrongLastMsgIDError creates a new JSStreamWrongLastMsgIDErrF error: "wrong last msg ID: {id}"
3187
func NewJSStreamWrongLastMsgIDError(id interface{}, opts ...ErrorOption) *ApiError {
5✔
3188
        eopts := parseOpts(opts)
5✔
3189
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
3190
                return ae
×
3191
        }
×
3192

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

3202
// NewJSStreamWrongLastSequenceConstantError creates a new JSStreamWrongLastSequenceConstantErr error: "wrong last sequence"
3203
func NewJSStreamWrongLastSequenceConstantError(opts ...ErrorOption) *ApiError {
23✔
3204
        eopts := parseOpts(opts)
23✔
3205
        if ae, ok := eopts.err.(*ApiError); ok {
23✔
3206
                return ae
×
3207
        }
×
3208

3209
        return ApiErrors[JSStreamWrongLastSequenceConstantErr]
23✔
3210
}
3211

3212
// NewJSStreamWrongLastSequenceError creates a new JSStreamWrongLastSequenceErrF error: "wrong last sequence: {seq}"
3213
func NewJSStreamWrongLastSequenceError(seq uint64, opts ...ErrorOption) *ApiError {
106✔
3214
        eopts := parseOpts(opts)
106✔
3215
        if ae, ok := eopts.err.(*ApiError); ok {
106✔
3216
                return ae
×
3217
        }
×
3218

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

3228
// NewJSTempStorageFailedError creates a new JSTempStorageFailedErr error: "JetStream unable to open temp storage for restore"
3229
func NewJSTempStorageFailedError(opts ...ErrorOption) *ApiError {
×
3230
        eopts := parseOpts(opts)
×
3231
        if ae, ok := eopts.err.(*ApiError); ok {
×
3232
                return ae
×
3233
        }
×
3234

3235
        return ApiErrors[JSTempStorageFailedErr]
×
3236
}
3237

3238
// NewJSTemplateNameNotMatchSubjectError creates a new JSTemplateNameNotMatchSubjectErr error: "template name in subject does not match request"
3239
func NewJSTemplateNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
×
3240
        eopts := parseOpts(opts)
×
3241
        if ae, ok := eopts.err.(*ApiError); ok {
×
3242
                return ae
×
3243
        }
×
3244

3245
        return ApiErrors[JSTemplateNameNotMatchSubjectErr]
×
3246
}
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