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

nats-io / nats-server / 23632413178

24 Mar 2026 12:20PM UTC coverage: 83.063% (-0.03%) from 83.09%
23632413178

push

github

neilalexander
Remove FIXME about auth callout nonce

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

75538 of 90941 relevant lines covered (83.06%)

357264.86 hits per line

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

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

3
package server
4

5
import "strings"
6

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

341
        // JSMessageSchedulesSourceInvalidErr message schedules source is invalid
342
        JSMessageSchedulesSourceInvalidErr ErrorIdentifier = 10203
343

344
        // JSMessageSchedulesTTLInvalidErr message schedules invalid per-message TTL
345
        JSMessageSchedulesTTLInvalidErr ErrorIdentifier = 10191
346

347
        // JSMessageSchedulesTargetInvalidErr message schedules target is invalid
348
        JSMessageSchedulesTargetInvalidErr ErrorIdentifier = 10190
349

350
        // JSMessageTTLDisabledErr per-message TTL is disabled
351
        JSMessageTTLDisabledErr ErrorIdentifier = 10166
352

353
        // JSMessageTTLInvalidErr invalid per-message TTL
354
        JSMessageTTLInvalidErr ErrorIdentifier = 10165
355

356
        // JSMirrorConsumerSetupFailedErrF generic mirror consumer setup failure string ({err})
357
        JSMirrorConsumerSetupFailedErrF ErrorIdentifier = 10029
358

359
        // JSMirrorInvalidStreamName mirrored stream name is invalid
360
        JSMirrorInvalidStreamName ErrorIdentifier = 10142
361

362
        // JSMirrorInvalidSubjectFilter mirror transform source: {err}
363
        JSMirrorInvalidSubjectFilter ErrorIdentifier = 10151
364

365
        // JSMirrorInvalidTransformDestination mirror transform: {err}
366
        JSMirrorInvalidTransformDestination ErrorIdentifier = 10154
367

368
        // JSMirrorMaxMessageSizeTooBigErr stream mirror must have max message size >= source
369
        JSMirrorMaxMessageSizeTooBigErr ErrorIdentifier = 10030
370

371
        // JSMirrorMultipleFiltersNotAllowed mirror with multiple subject transforms cannot also have a single subject filter
372
        JSMirrorMultipleFiltersNotAllowed ErrorIdentifier = 10150
373

374
        // JSMirrorOverlappingSubjectFilters mirror subject filters can not overlap
375
        JSMirrorOverlappingSubjectFilters ErrorIdentifier = 10152
376

377
        // JSMirrorWithAtomicPublishErr stream mirrors can not also use atomic publishing
378
        JSMirrorWithAtomicPublishErr ErrorIdentifier = 10198
379

380
        // JSMirrorWithBatchPublishErr stream mirrors can not also use batch publishing
381
        JSMirrorWithBatchPublishErr ErrorIdentifier = 10209
382

383
        // JSMirrorWithCountersErr stream mirrors can not also calculate counters
384
        JSMirrorWithCountersErr ErrorIdentifier = 10173
385

386
        // JSMirrorWithFirstSeqErr stream mirrors can not have first sequence configured
387
        JSMirrorWithFirstSeqErr ErrorIdentifier = 10143
388

389
        // JSMirrorWithMsgSchedulesErr stream mirrors can not also schedule messages
390
        JSMirrorWithMsgSchedulesErr ErrorIdentifier = 10186
391

392
        // JSMirrorWithSourcesErr stream mirrors can not also contain other sources
393
        JSMirrorWithSourcesErr ErrorIdentifier = 10031
394

395
        // JSMirrorWithStartSeqAndTimeErr stream mirrors can not have both start seq and start time configured
396
        JSMirrorWithStartSeqAndTimeErr ErrorIdentifier = 10032
397

398
        // JSMirrorWithSubjectFiltersErr stream mirrors can not contain filtered subjects
399
        JSMirrorWithSubjectFiltersErr ErrorIdentifier = 10033
400

401
        // JSMirrorWithSubjectsErr stream mirrors can not contain subjects
402
        JSMirrorWithSubjectsErr ErrorIdentifier = 10034
403

404
        // JSNoAccountErr account not found
405
        JSNoAccountErr ErrorIdentifier = 10035
406

407
        // JSNoLimitsErr no JetStream default or applicable tiered limit present
408
        JSNoLimitsErr ErrorIdentifier = 10120
409

410
        // JSNoMessageFoundErr no message found
411
        JSNoMessageFoundErr ErrorIdentifier = 10037
412

413
        // JSNotEmptyRequestErr expected an empty request payload
414
        JSNotEmptyRequestErr ErrorIdentifier = 10038
415

416
        // JSNotEnabledErr JetStream not enabled
417
        JSNotEnabledErr ErrorIdentifier = 10076
418

419
        // JSNotEnabledForAccountErr JetStream not enabled for account
420
        JSNotEnabledForAccountErr ErrorIdentifier = 10039
421

422
        // JSPedanticErrF pedantic mode: {err}
423
        JSPedanticErrF ErrorIdentifier = 10157
424

425
        // JSPeerRemapErr peer remap failed
426
        JSPeerRemapErr ErrorIdentifier = 10075
427

428
        // JSRaftGeneralErrF General RAFT error string ({err})
429
        JSRaftGeneralErrF ErrorIdentifier = 10041
430

431
        // JSReplicasCountCannotBeNegative replicas count cannot be negative
432
        JSReplicasCountCannotBeNegative ErrorIdentifier = 10133
433

434
        // JSRequiredApiLevelErr JetStream minimum api level required
435
        JSRequiredApiLevelErr ErrorIdentifier = 10185
436

437
        // JSRestoreSubscribeFailedErrF JetStream unable to subscribe to restore snapshot {subject}: {err}
438
        JSRestoreSubscribeFailedErrF ErrorIdentifier = 10042
439

440
        // JSSequenceNotFoundErrF sequence {seq} not found
441
        JSSequenceNotFoundErrF ErrorIdentifier = 10043
442

443
        // JSSnapshotDeliverSubjectInvalidErr deliver subject not valid
444
        JSSnapshotDeliverSubjectInvalidErr ErrorIdentifier = 10015
445

446
        // JSSourceConsumerSetupFailedErrF General source consumer setup failure string ({err})
447
        JSSourceConsumerSetupFailedErrF ErrorIdentifier = 10045
448

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

452
        // JSSourceInvalidStreamName sourced stream name is invalid
453
        JSSourceInvalidStreamName ErrorIdentifier = 10141
454

455
        // JSSourceInvalidSubjectFilter source transform source: {err}
456
        JSSourceInvalidSubjectFilter ErrorIdentifier = 10145
457

458
        // JSSourceInvalidTransformDestination source transform: {err}
459
        JSSourceInvalidTransformDestination ErrorIdentifier = 10146
460

461
        // JSSourceMaxMessageSizeTooBigErr stream source must have max message size >= target
462
        JSSourceMaxMessageSizeTooBigErr ErrorIdentifier = 10046
463

464
        // JSSourceMultipleFiltersNotAllowed source with multiple subject transforms cannot also have a single subject filter
465
        JSSourceMultipleFiltersNotAllowed ErrorIdentifier = 10144
466

467
        // JSSourceOverlappingSubjectFilters source filters can not overlap
468
        JSSourceOverlappingSubjectFilters ErrorIdentifier = 10147
469

470
        // JSSourceWithMsgSchedulesErr stream source can not also schedule messages
471
        JSSourceWithMsgSchedulesErr ErrorIdentifier = 10187
472

473
        // JSStorageResourcesExceededErr insufficient storage resources available
474
        JSStorageResourcesExceededErr ErrorIdentifier = 10047
475

476
        // JSStreamAssignmentErrF Generic stream assignment error string ({err})
477
        JSStreamAssignmentErrF ErrorIdentifier = 10048
478

479
        // JSStreamCreateErrF Generic stream creation error string ({err})
480
        JSStreamCreateErrF ErrorIdentifier = 10049
481

482
        // JSStreamDeleteErrF General stream deletion error string ({err})
483
        JSStreamDeleteErrF ErrorIdentifier = 10050
484

485
        // JSStreamDuplicateMessageConflict duplicate message id is in process
486
        JSStreamDuplicateMessageConflict ErrorIdentifier = 10158
487

488
        // JSStreamExpectedLastSeqPerSubjectInvalid missing sequence for expected last sequence per subject
489
        JSStreamExpectedLastSeqPerSubjectInvalid ErrorIdentifier = 10193
490

491
        // JSStreamExpectedLastSeqPerSubjectNotReady expected last sequence per subject temporarily unavailable
492
        JSStreamExpectedLastSeqPerSubjectNotReady ErrorIdentifier = 10163
493

494
        // JSStreamExternalApiOverlapErrF stream external api prefix {prefix} must not overlap with {subject}
495
        JSStreamExternalApiOverlapErrF ErrorIdentifier = 10021
496

497
        // JSStreamExternalDelPrefixOverlapsErrF stream external delivery prefix {prefix} overlaps with stream subject {subject}
498
        JSStreamExternalDelPrefixOverlapsErrF ErrorIdentifier = 10022
499

500
        // JSStreamGeneralErrorF General stream failure string ({err})
501
        JSStreamGeneralErrorF ErrorIdentifier = 10051
502

503
        // JSStreamHeaderExceedsMaximumErr header size exceeds maximum allowed of 64k
504
        JSStreamHeaderExceedsMaximumErr ErrorIdentifier = 10097
505

506
        // JSStreamInfoMaxSubjectsErr subject details would exceed maximum allowed
507
        JSStreamInfoMaxSubjectsErr ErrorIdentifier = 10117
508

509
        // JSStreamInvalidConfigF Stream configuration validation error string ({err})
510
        JSStreamInvalidConfigF ErrorIdentifier = 10052
511

512
        // JSStreamInvalidErr stream not valid
513
        JSStreamInvalidErr ErrorIdentifier = 10096
514

515
        // JSStreamInvalidExternalDeliverySubjErrF stream external delivery prefix {prefix} must not contain wildcards
516
        JSStreamInvalidExternalDeliverySubjErrF ErrorIdentifier = 10024
517

518
        // JSStreamLimitsErrF General stream limits exceeded error string ({err})
519
        JSStreamLimitsErrF ErrorIdentifier = 10053
520

521
        // JSStreamMaxBytesRequired account requires a stream config to have max bytes set
522
        JSStreamMaxBytesRequired ErrorIdentifier = 10113
523

524
        // JSStreamMaxStreamBytesExceeded stream max bytes exceeds account limit max stream bytes
525
        JSStreamMaxStreamBytesExceeded ErrorIdentifier = 10122
526

527
        // JSStreamMessageExceedsMaximumErr message size exceeds maximum allowed
528
        JSStreamMessageExceedsMaximumErr ErrorIdentifier = 10054
529

530
        // JSStreamMinLastSeqErr min last sequence
531
        JSStreamMinLastSeqErr ErrorIdentifier = 10180
532

533
        // JSStreamMirrorNotUpdatableErr stream mirror configuration can not be updated
534
        JSStreamMirrorNotUpdatableErr ErrorIdentifier = 10055
535

536
        // JSStreamMismatchErr stream name in subject does not match request
537
        JSStreamMismatchErr ErrorIdentifier = 10056
538

539
        // JSStreamMoveAndScaleErr can not move and scale a stream in a single update
540
        JSStreamMoveAndScaleErr ErrorIdentifier = 10123
541

542
        // JSStreamMoveInProgressF stream move already in progress: {msg}
543
        JSStreamMoveInProgressF ErrorIdentifier = 10124
544

545
        // JSStreamMoveNotInProgress stream move not in progress
546
        JSStreamMoveNotInProgress ErrorIdentifier = 10129
547

548
        // JSStreamMsgDeleteFailedF Generic message deletion failure error string ({err})
549
        JSStreamMsgDeleteFailedF ErrorIdentifier = 10057
550

551
        // JSStreamNameContainsPathSeparatorsErr Stream name can not contain path separators
552
        JSStreamNameContainsPathSeparatorsErr ErrorIdentifier = 10128
553

554
        // JSStreamNameExistErr stream name already in use with a different configuration
555
        JSStreamNameExistErr ErrorIdentifier = 10058
556

557
        // JSStreamNameExistRestoreFailedErr stream name already in use, cannot restore
558
        JSStreamNameExistRestoreFailedErr ErrorIdentifier = 10130
559

560
        // JSStreamNotFoundErr stream not found
561
        JSStreamNotFoundErr ErrorIdentifier = 10059
562

563
        // JSStreamNotMatchErr expected stream does not match
564
        JSStreamNotMatchErr ErrorIdentifier = 10060
565

566
        // JSStreamOfflineErr stream is offline
567
        JSStreamOfflineErr ErrorIdentifier = 10118
568

569
        // JSStreamOfflineReasonErrF stream is offline: {err}
570
        JSStreamOfflineReasonErrF ErrorIdentifier = 10194
571

572
        // JSStreamPurgeFailedF Generic stream purge failure error string ({err})
573
        JSStreamPurgeFailedF ErrorIdentifier = 10110
574

575
        // JSStreamReplicasNotSupportedErr replicas > 1 not supported in non-clustered mode
576
        JSStreamReplicasNotSupportedErr ErrorIdentifier = 10074
577

578
        // JSStreamReplicasNotUpdatableErr Replicas configuration can not be updated
579
        JSStreamReplicasNotUpdatableErr ErrorIdentifier = 10061
580

581
        // JSStreamRestoreErrF restore failed: {err}
582
        JSStreamRestoreErrF ErrorIdentifier = 10062
583

584
        // JSStreamRollupFailedF Generic stream rollup failure error string ({err})
585
        JSStreamRollupFailedF ErrorIdentifier = 10111
586

587
        // JSStreamSealedErr invalid operation on sealed stream
588
        JSStreamSealedErr ErrorIdentifier = 10109
589

590
        // JSStreamSequenceNotMatchErr expected stream sequence does not match
591
        JSStreamSequenceNotMatchErr ErrorIdentifier = 10063
592

593
        // JSStreamSnapshotErrF snapshot failed: {err}
594
        JSStreamSnapshotErrF ErrorIdentifier = 10064
595

596
        // JSStreamStoreFailedF Generic error when storing a message failed ({err})
597
        JSStreamStoreFailedF ErrorIdentifier = 10077
598

599
        // JSStreamSubjectOverlapErr subjects overlap with an existing stream
600
        JSStreamSubjectOverlapErr ErrorIdentifier = 10065
601

602
        // JSStreamTemplateCreateErrF Generic template creation failed string ({err})
603
        JSStreamTemplateCreateErrF ErrorIdentifier = 10066
604

605
        // JSStreamTemplateDeleteErrF Generic stream template deletion failed error string ({err})
606
        JSStreamTemplateDeleteErrF ErrorIdentifier = 10067
607

608
        // JSStreamTemplateNotFoundErr template not found
609
        JSStreamTemplateNotFoundErr ErrorIdentifier = 10068
610

611
        // JSStreamTooManyRequests too many requests
612
        JSStreamTooManyRequests ErrorIdentifier = 10167
613

614
        // JSStreamTransformInvalidDestination stream transform: {err}
615
        JSStreamTransformInvalidDestination ErrorIdentifier = 10156
616

617
        // JSStreamTransformInvalidSource stream transform source: {err}
618
        JSStreamTransformInvalidSource ErrorIdentifier = 10155
619

620
        // JSStreamUpdateErrF Generic stream update error string ({err})
621
        JSStreamUpdateErrF ErrorIdentifier = 10069
622

623
        // JSStreamWrongLastMsgIDErrF wrong last msg ID: {id}
624
        JSStreamWrongLastMsgIDErrF ErrorIdentifier = 10070
625

626
        // JSStreamWrongLastSequenceConstantErr wrong last sequence
627
        JSStreamWrongLastSequenceConstantErr ErrorIdentifier = 10164
628

629
        // JSStreamWrongLastSequenceErrF wrong last sequence: {seq}
630
        JSStreamWrongLastSequenceErrF ErrorIdentifier = 10071
631

632
        // JSTempStorageFailedErr JetStream unable to open temp storage for restore
633
        JSTempStorageFailedErr ErrorIdentifier = 10072
634

635
        // JSTemplateNameNotMatchSubjectErr template name in subject does not match request
636
        JSTemplateNameNotMatchSubjectErr ErrorIdentifier = 10073
637
)
638

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

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

883
        return ApiErrors[JSAccountResourcesExceededErr]
20,067✔
884
}
885

886
// NewJSAtomicPublishContainsDuplicateMessageError creates a new JSAtomicPublishContainsDuplicateMessageErr error: "atomic publish batch contains duplicate message id"
887
func NewJSAtomicPublishContainsDuplicateMessageError(opts ...ErrorOption) *ApiError {
21,920✔
888
        eopts := parseOpts(opts)
21,920✔
889
        if ae, ok := eopts.err.(*ApiError); ok {
21,920✔
890
                return ae
×
891
        }
×
892

893
        return ApiErrors[JSAtomicPublishContainsDuplicateMessageErr]
21,920✔
894
}
895

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

903
        return ApiErrors[JSAtomicPublishDisabledErr]
24✔
904
}
905

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

913
        return ApiErrors[JSAtomicPublishIncompleteBatchErr]
54✔
914
}
915

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

923
        return ApiErrors[JSAtomicPublishInvalidBatchCommitErr]
6✔
924
}
925

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

933
        return ApiErrors[JSAtomicPublishInvalidBatchIDErr]
4✔
934
}
935

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

943
        return ApiErrors[JSAtomicPublishMissingSeqErr]
24✔
944
}
945

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

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

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

969
        return ApiErrors[JSAtomicPublishTooManyInflight]
8✔
970
}
971

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

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

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

995
        return ApiErrors[JSBadRequestErr]
10✔
996
}
997

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

1005
        return ApiErrors[JSBatchPublishDisabledErr]
24✔
1006
}
1007

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

1015
        return ApiErrors[JSBatchPublishInvalidBatchIDErr]
28✔
1016
}
1017

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

1025
        return ApiErrors[JSBatchPublishInvalidPatternErr]
28✔
1026
}
1027

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

1035
        return ApiErrors[JSBatchPublishTooManyInflight]
8✔
1036
}
1037

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

1045
        return ApiErrors[JSBatchPublishUnknownBatchIDErr]
28✔
1046
}
1047

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

1055
        return ApiErrors[JSClusterIncompleteErr]
×
1056
}
1057

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

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

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

1081
        return ApiErrors[JSClusterNotActiveErr]
1✔
1082
}
1083

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

1091
        return ApiErrors[JSClusterNotAssignedErr]
2✔
1092
}
1093

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

1101
        return ApiErrors[JSClusterNotAvailErr]
13✔
1102
}
1103

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

1111
        return ApiErrors[JSClusterNotLeaderErr]
3✔
1112
}
1113

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

1121
        return ApiErrors[JSClusterPeerNotMemberErr]
1✔
1122
}
1123

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

1131
        return ApiErrors[JSClusterRequiredErr]
6✔
1132
}
1133

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

1141
        return ApiErrors[JSClusterServerMemberChangeInflightErr]
6✔
1142
}
1143

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

1151
        return ApiErrors[JSClusterServerNotMemberErr]
6✔
1152
}
1153

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

1161
        return ApiErrors[JSClusterTagsErr]
×
1162
}
1163

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

1171
        return ApiErrors[JSClusterUnSupportFeatureErr]
×
1172
}
1173

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

1181
        return ApiErrors[JSConsumerAckPolicyInvalidErr]
2✔
1182
}
1183

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

1191
        return ApiErrors[JSConsumerAckWaitNegativeErr]
2✔
1192
}
1193

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

1201
        return ApiErrors[JSConsumerAlreadyExists]
5✔
1202
}
1203

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

1211
        return ApiErrors[JSConsumerBackOffNegativeErr]
2✔
1212
}
1213

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

1221
        return ApiErrors[JSConsumerBadDurableNameErr]
×
1222
}
1223

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

1231
        return ApiErrors[JSConsumerConfigRequiredErr]
2✔
1232
}
1233

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

1241
        return ApiErrors[JSConsumerCreateDurableAndNameMismatch]
1✔
1242
}
1243

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

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

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

1267
        return ApiErrors[JSConsumerCreateFilterSubjectMismatchErr]
2✔
1268
}
1269

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

1277
        return ApiErrors[JSConsumerDeliverCycleErr]
4✔
1278
}
1279

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

1287
        return ApiErrors[JSConsumerDeliverToWildcardsErr]
4✔
1288
}
1289

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

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

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

1313
        return ApiErrors[JSConsumerDirectRequiresEphemeralErr]
×
1314
}
1315

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

1323
        return ApiErrors[JSConsumerDirectRequiresPushErr]
×
1324
}
1325

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

1333
        return ApiErrors[JSConsumerDoesNotExist]
3✔
1334
}
1335

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

1343
        return ApiErrors[JSConsumerDuplicateFilterSubjects]
1✔
1344
}
1345

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

1353
        return ApiErrors[JSConsumerDurableNameNotInSubjectErr]
×
1354
}
1355

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

1363
        return ApiErrors[JSConsumerDurableNameNotMatchSubjectErr]
×
1364
}
1365

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

1373
        return ApiErrors[JSConsumerDurableNameNotSetErr]
1✔
1374
}
1375

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

1383
        return ApiErrors[JSConsumerEmptyFilter]
1✔
1384
}
1385

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

1393
        return ApiErrors[JSConsumerEmptyGroupName]
4✔
1394
}
1395

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

1403
        return ApiErrors[JSConsumerEphemeralWithDurableInSubjectErr]
×
1404
}
1405

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

1413
        return ApiErrors[JSConsumerEphemeralWithDurableNameErr]
3✔
1414
}
1415

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

1423
        return ApiErrors[JSConsumerExistingActiveErr]
×
1424
}
1425

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

1433
        return ApiErrors[JSConsumerFCRequiresPushErr]
×
1434
}
1435

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

1443
        return ApiErrors[JSConsumerFilterNotSubsetErr]
×
1444
}
1445

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

1453
        return ApiErrors[JSConsumerHBRequiresPushErr]
×
1454
}
1455

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

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

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

1479
        return ApiErrors[JSConsumerInvalidDeliverSubject]
2✔
1480
}
1481

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

1489
        return ApiErrors[JSConsumerInvalidGroupNameErr]
2✔
1490
}
1491

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

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

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

1515
        return ApiErrors[JSConsumerInvalidPriorityGroupErr]
2✔
1516
}
1517

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

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

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

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

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

1557
        return ApiErrors[JSConsumerMaxDeliverBackoffErr]
3✔
1558
}
1559

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

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

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

1583
        return ApiErrors[JSConsumerMaxPendingAckPolicyRequiredErr]
2✔
1584
}
1585

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

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

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

1609
        return ApiErrors[JSConsumerMaxRequestBatchNegativeErr]
×
1610
}
1611

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

1619
        return ApiErrors[JSConsumerMaxRequestExpiresTooSmall]
×
1620
}
1621

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

1629
        return ApiErrors[JSConsumerMaxWaitingNegativeErr]
×
1630
}
1631

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

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

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

1655
        return ApiErrors[JSConsumerMultipleFiltersNotAllowed]
1✔
1656
}
1657

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

1665
        return ApiErrors[JSConsumerNameContainsPathSeparatorsErr]
8✔
1666
}
1667

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

1675
        return ApiErrors[JSConsumerNameExistErr]
2✔
1676
}
1677

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

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

1694
// NewJSConsumerNotFoundError creates a new JSConsumerNotFoundErr error: "consumer not found"
1695
func NewJSConsumerNotFoundError(opts ...ErrorOption) *ApiError {
2,869✔
1696
        eopts := parseOpts(opts)
2,869✔
1697
        if ae, ok := eopts.err.(*ApiError); ok {
2,869✔
1698
                return ae
×
1699
        }
×
1700

1701
        return ApiErrors[JSConsumerNotFoundErr]
2,869✔
1702
}
1703

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

1711
        return ApiErrors[JSConsumerOfflineErr]
6✔
1712
}
1713

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

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

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

1737
        return ApiErrors[JSConsumerOnMappedErr]
×
1738
}
1739

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

1747
        return ApiErrors[JSConsumerOverlappingSubjectFilters]
3✔
1748
}
1749

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

1757
        return ApiErrors[JSConsumerPinnedTTLWithoutPriorityPolicyNone]
1✔
1758
}
1759

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

1767
        return ApiErrors[JSConsumerPriorityGroupWithPolicyNone]
1✔
1768
}
1769

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

1777
        return ApiErrors[JSConsumerPriorityPolicyWithoutGroup]
4✔
1778
}
1779

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

1787
        return ApiErrors[JSConsumerPullNotDurableErr]
×
1788
}
1789

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

1797
        return ApiErrors[JSConsumerPullRequiresAckErr]
6✔
1798
}
1799

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

1807
        return ApiErrors[JSConsumerPullWithRateLimitErr]
1✔
1808
}
1809

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

1817
        return ApiErrors[JSConsumerPushMaxWaitingErr]
3✔
1818
}
1819

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

1827
        return ApiErrors[JSConsumerPushWithPriorityGroupErr]
1✔
1828
}
1829

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

1837
        return ApiErrors[JSConsumerReplacementWithDifferentNameErr]
×
1838
}
1839

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

1847
        return ApiErrors[JSConsumerReplayPolicyInvalidErr]
2✔
1848
}
1849

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

1857
        return ApiErrors[JSConsumerReplicasExceedsStream]
1✔
1858
}
1859

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

1867
        return ApiErrors[JSConsumerReplicasShouldMatchStream]
2✔
1868
}
1869

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

1877
        return ApiErrors[JSConsumerSmallHeartbeatErr]
1✔
1878
}
1879

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

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

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

1903
        return ApiErrors[JSConsumerWQConsumerNotDeliverAllErr]
×
1904
}
1905

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

1913
        return ApiErrors[JSConsumerWQConsumerNotUniqueErr]
11✔
1914
}
1915

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

1923
        return ApiErrors[JSConsumerWQMultipleUnfilteredErr]
2✔
1924
}
1925

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

1933
        return ApiErrors[JSConsumerWQRequiresExplicitAckErr]
×
1934
}
1935

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

1943
        return ApiErrors[JSConsumerWithFlowControlNeedsHeartbeats]
4✔
1944
}
1945

1946
// NewJSInsufficientResourcesError creates a new JSInsufficientResourcesErr error: "insufficient resources"
1947
func NewJSInsufficientResourcesError(opts ...ErrorOption) *ApiError {
13✔
1948
        eopts := parseOpts(opts)
13✔
1949
        if ae, ok := eopts.err.(*ApiError); ok {
13✔
1950
                return ae
×
1951
        }
×
1952

1953
        return ApiErrors[JSInsufficientResourcesErr]
13✔
1954
}
1955

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

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

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

1979
        return ApiErrors[JSMaximumConsumersLimitErr]
43✔
1980
}
1981

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

1989
        return ApiErrors[JSMaximumStreamsLimitErr]
16✔
1990
}
1991

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

1999
        return ApiErrors[JSMemoryResourcesExceededErr]
11✔
2000
}
2001

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

2009
        return ApiErrors[JSMessageCounterBrokenErr]
4✔
2010
}
2011

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

2019
        return ApiErrors[JSMessageIncrDisabledErr]
4✔
2020
}
2021

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

2029
        return ApiErrors[JSMessageIncrInvalidErr]
24✔
2030
}
2031

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

2039
        return ApiErrors[JSMessageIncrMissingErr]
8✔
2040
}
2041

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

2049
        return ApiErrors[JSMessageIncrPayloadErr]
4✔
2050
}
2051

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

2059
        return ApiErrors[JSMessageSchedulesDisabledErr]
20✔
2060
}
2061

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

2069
        return ApiErrors[JSMessageSchedulesPatternInvalidErr]
15✔
2070
}
2071

2072
// NewJSMessageSchedulesRollupInvalidError creates a new JSMessageSchedulesRollupInvalidErr error: "message schedules invalid rollup"
2073
func NewJSMessageSchedulesRollupInvalidError(opts ...ErrorOption) *ApiError {
8✔
2074
        eopts := parseOpts(opts)
8✔
2075
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
2076
                return ae
×
2077
        }
×
2078

2079
        return ApiErrors[JSMessageSchedulesRollupInvalidErr]
8✔
2080
}
2081

2082
// NewJSMessageSchedulesSourceInvalidError creates a new JSMessageSchedulesSourceInvalidErr error: "message schedules source is invalid"
2083
func NewJSMessageSchedulesSourceInvalidError(opts ...ErrorOption) *ApiError {
32✔
2084
        eopts := parseOpts(opts)
32✔
2085
        if ae, ok := eopts.err.(*ApiError); ok {
32✔
2086
                return ae
×
2087
        }
×
2088

2089
        return ApiErrors[JSMessageSchedulesSourceInvalidErr]
32✔
2090
}
2091

2092
// NewJSMessageSchedulesTTLInvalidError creates a new JSMessageSchedulesTTLInvalidErr error: "message schedules invalid per-message TTL"
2093
func NewJSMessageSchedulesTTLInvalidError(opts ...ErrorOption) *ApiError {
10✔
2094
        eopts := parseOpts(opts)
10✔
2095
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2096
                return ae
×
2097
        }
×
2098

2099
        return ApiErrors[JSMessageSchedulesTTLInvalidErr]
10✔
2100
}
2101

2102
// NewJSMessageSchedulesTargetInvalidError creates a new JSMessageSchedulesTargetInvalidErr error: "message schedules target is invalid"
2103
func NewJSMessageSchedulesTargetInvalidError(opts ...ErrorOption) *ApiError {
30✔
2104
        eopts := parseOpts(opts)
30✔
2105
        if ae, ok := eopts.err.(*ApiError); ok {
30✔
2106
                return ae
×
2107
        }
×
2108

2109
        return ApiErrors[JSMessageSchedulesTargetInvalidErr]
30✔
2110
}
2111

2112
// NewJSMessageTTLDisabledError creates a new JSMessageTTLDisabledErr error: "per-message TTL is disabled"
2113
func NewJSMessageTTLDisabledError(opts ...ErrorOption) *ApiError {
16✔
2114
        eopts := parseOpts(opts)
16✔
2115
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2116
                return ae
×
2117
        }
×
2118

2119
        return ApiErrors[JSMessageTTLDisabledErr]
16✔
2120
}
2121

2122
// NewJSMessageTTLInvalidError creates a new JSMessageTTLInvalidErr error: "invalid per-message TTL"
2123
func NewJSMessageTTLInvalidError(opts ...ErrorOption) *ApiError {
23✔
2124
        eopts := parseOpts(opts)
23✔
2125
        if ae, ok := eopts.err.(*ApiError); ok {
23✔
2126
                return ae
×
2127
        }
×
2128

2129
        return ApiErrors[JSMessageTTLInvalidErr]
23✔
2130
}
2131

2132
// NewJSMirrorConsumerSetupFailedError creates a new JSMirrorConsumerSetupFailedErrF error: "{err}"
2133
func NewJSMirrorConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
2134
        eopts := parseOpts(opts)
×
2135
        if ae, ok := eopts.err.(*ApiError); ok {
×
2136
                return ae
×
2137
        }
×
2138

2139
        e := ApiErrors[JSMirrorConsumerSetupFailedErrF]
×
2140
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2141
        return &ApiError{
×
2142
                Code:        e.Code,
×
2143
                ErrCode:     e.ErrCode,
×
2144
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2145
        }
×
2146
}
2147

2148
// NewJSMirrorInvalidStreamNameError creates a new JSMirrorInvalidStreamName error: "mirrored stream name is invalid"
2149
func NewJSMirrorInvalidStreamNameError(opts ...ErrorOption) *ApiError {
×
2150
        eopts := parseOpts(opts)
×
2151
        if ae, ok := eopts.err.(*ApiError); ok {
×
2152
                return ae
×
2153
        }
×
2154

2155
        return ApiErrors[JSMirrorInvalidStreamName]
×
2156
}
2157

2158
// NewJSMirrorInvalidSubjectFilterError creates a new JSMirrorInvalidSubjectFilter error: "mirror transform source: {err}"
2159
func NewJSMirrorInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
2✔
2160
        eopts := parseOpts(opts)
2✔
2161
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2162
                return ae
×
2163
        }
×
2164

2165
        e := ApiErrors[JSMirrorInvalidSubjectFilter]
2✔
2166
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2✔
2167
        return &ApiError{
2✔
2168
                Code:        e.Code,
2✔
2169
                ErrCode:     e.ErrCode,
2✔
2170
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2171
        }
2✔
2172
}
2173

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

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

2190
// NewJSMirrorMaxMessageSizeTooBigError creates a new JSMirrorMaxMessageSizeTooBigErr error: "stream mirror must have max message size >= source"
2191
func NewJSMirrorMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
2192
        eopts := parseOpts(opts)
×
2193
        if ae, ok := eopts.err.(*ApiError); ok {
×
2194
                return ae
×
2195
        }
×
2196

2197
        return ApiErrors[JSMirrorMaxMessageSizeTooBigErr]
×
2198
}
2199

2200
// NewJSMirrorMultipleFiltersNotAllowedError creates a new JSMirrorMultipleFiltersNotAllowed error: "mirror with multiple subject transforms cannot also have a single subject filter"
2201
func NewJSMirrorMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
2202
        eopts := parseOpts(opts)
1✔
2203
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2204
                return ae
×
2205
        }
×
2206

2207
        return ApiErrors[JSMirrorMultipleFiltersNotAllowed]
1✔
2208
}
2209

2210
// NewJSMirrorOverlappingSubjectFiltersError creates a new JSMirrorOverlappingSubjectFilters error: "mirror subject filters can not overlap"
2211
func NewJSMirrorOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
2✔
2212
        eopts := parseOpts(opts)
2✔
2213
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2214
                return ae
×
2215
        }
×
2216

2217
        return ApiErrors[JSMirrorOverlappingSubjectFilters]
2✔
2218
}
2219

2220
// NewJSMirrorWithAtomicPublishError creates a new JSMirrorWithAtomicPublishErr error: "stream mirrors can not also use atomic publishing"
2221
func NewJSMirrorWithAtomicPublishError(opts ...ErrorOption) *ApiError {
4✔
2222
        eopts := parseOpts(opts)
4✔
2223
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2224
                return ae
×
2225
        }
×
2226

2227
        return ApiErrors[JSMirrorWithAtomicPublishErr]
4✔
2228
}
2229

2230
// NewJSMirrorWithBatchPublishError creates a new JSMirrorWithBatchPublishErr error: "stream mirrors can not also use batch publishing"
2231
func NewJSMirrorWithBatchPublishError(opts ...ErrorOption) *ApiError {
4✔
2232
        eopts := parseOpts(opts)
4✔
2233
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2234
                return ae
×
2235
        }
×
2236

2237
        return ApiErrors[JSMirrorWithBatchPublishErr]
4✔
2238
}
2239

2240
// NewJSMirrorWithCountersError creates a new JSMirrorWithCountersErr error: "stream mirrors can not also calculate counters"
2241
func NewJSMirrorWithCountersError(opts ...ErrorOption) *ApiError {
4✔
2242
        eopts := parseOpts(opts)
4✔
2243
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2244
                return ae
×
2245
        }
×
2246

2247
        return ApiErrors[JSMirrorWithCountersErr]
4✔
2248
}
2249

2250
// NewJSMirrorWithFirstSeqError creates a new JSMirrorWithFirstSeqErr error: "stream mirrors can not have first sequence configured"
2251
func NewJSMirrorWithFirstSeqError(opts ...ErrorOption) *ApiError {
2✔
2252
        eopts := parseOpts(opts)
2✔
2253
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2254
                return ae
×
2255
        }
×
2256

2257
        return ApiErrors[JSMirrorWithFirstSeqErr]
2✔
2258
}
2259

2260
// NewJSMirrorWithMsgSchedulesError creates a new JSMirrorWithMsgSchedulesErr error: "stream mirrors can not also schedule messages"
2261
func NewJSMirrorWithMsgSchedulesError(opts ...ErrorOption) *ApiError {
2✔
2262
        eopts := parseOpts(opts)
2✔
2263
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2264
                return ae
×
2265
        }
×
2266

2267
        return ApiErrors[JSMirrorWithMsgSchedulesErr]
2✔
2268
}
2269

2270
// NewJSMirrorWithSourcesError creates a new JSMirrorWithSourcesErr error: "stream mirrors can not also contain other sources"
2271
func NewJSMirrorWithSourcesError(opts ...ErrorOption) *ApiError {
×
2272
        eopts := parseOpts(opts)
×
2273
        if ae, ok := eopts.err.(*ApiError); ok {
×
2274
                return ae
×
2275
        }
×
2276

2277
        return ApiErrors[JSMirrorWithSourcesErr]
×
2278
}
2279

2280
// NewJSMirrorWithStartSeqAndTimeError creates a new JSMirrorWithStartSeqAndTimeErr error: "stream mirrors can not have both start seq and start time configured"
2281
func NewJSMirrorWithStartSeqAndTimeError(opts ...ErrorOption) *ApiError {
×
2282
        eopts := parseOpts(opts)
×
2283
        if ae, ok := eopts.err.(*ApiError); ok {
×
2284
                return ae
×
2285
        }
×
2286

2287
        return ApiErrors[JSMirrorWithStartSeqAndTimeErr]
×
2288
}
2289

2290
// NewJSMirrorWithSubjectFiltersError creates a new JSMirrorWithSubjectFiltersErr error: "stream mirrors can not contain filtered subjects"
2291
func NewJSMirrorWithSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
2292
        eopts := parseOpts(opts)
×
2293
        if ae, ok := eopts.err.(*ApiError); ok {
×
2294
                return ae
×
2295
        }
×
2296

2297
        return ApiErrors[JSMirrorWithSubjectFiltersErr]
×
2298
}
2299

2300
// NewJSMirrorWithSubjectsError creates a new JSMirrorWithSubjectsErr error: "stream mirrors can not contain subjects"
2301
func NewJSMirrorWithSubjectsError(opts ...ErrorOption) *ApiError {
2✔
2302
        eopts := parseOpts(opts)
2✔
2303
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2304
                return ae
×
2305
        }
×
2306

2307
        return ApiErrors[JSMirrorWithSubjectsErr]
2✔
2308
}
2309

2310
// NewJSNoAccountError creates a new JSNoAccountErr error: "account not found"
2311
func NewJSNoAccountError(opts ...ErrorOption) *ApiError {
1✔
2312
        eopts := parseOpts(opts)
1✔
2313
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2314
                return ae
×
2315
        }
×
2316

2317
        return ApiErrors[JSNoAccountErr]
1✔
2318
}
2319

2320
// NewJSNoLimitsError creates a new JSNoLimitsErr error: "no JetStream default or applicable tiered limit present"
2321
func NewJSNoLimitsError(opts ...ErrorOption) *ApiError {
4✔
2322
        eopts := parseOpts(opts)
4✔
2323
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2324
                return ae
×
2325
        }
×
2326

2327
        return ApiErrors[JSNoLimitsErr]
4✔
2328
}
2329

2330
// NewJSNoMessageFoundError creates a new JSNoMessageFoundErr error: "no message found"
2331
func NewJSNoMessageFoundError(opts ...ErrorOption) *ApiError {
859✔
2332
        eopts := parseOpts(opts)
859✔
2333
        if ae, ok := eopts.err.(*ApiError); ok {
859✔
2334
                return ae
×
2335
        }
×
2336

2337
        return ApiErrors[JSNoMessageFoundErr]
859✔
2338
}
2339

2340
// NewJSNotEmptyRequestError creates a new JSNotEmptyRequestErr error: "expected an empty request payload"
2341
func NewJSNotEmptyRequestError(opts ...ErrorOption) *ApiError {
3✔
2342
        eopts := parseOpts(opts)
3✔
2343
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2344
                return ae
×
2345
        }
×
2346

2347
        return ApiErrors[JSNotEmptyRequestErr]
3✔
2348
}
2349

2350
// NewJSNotEnabledError creates a new JSNotEnabledErr error: "JetStream not enabled"
2351
func NewJSNotEnabledError(opts ...ErrorOption) *ApiError {
11✔
2352
        eopts := parseOpts(opts)
11✔
2353
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
2354
                return ae
×
2355
        }
×
2356

2357
        return ApiErrors[JSNotEnabledErr]
11✔
2358
}
2359

2360
// NewJSNotEnabledForAccountError creates a new JSNotEnabledForAccountErr error: "JetStream not enabled for account"
2361
func NewJSNotEnabledForAccountError(opts ...ErrorOption) *ApiError {
319✔
2362
        eopts := parseOpts(opts)
319✔
2363
        if ae, ok := eopts.err.(*ApiError); ok {
319✔
2364
                return ae
×
2365
        }
×
2366

2367
        return ApiErrors[JSNotEnabledForAccountErr]
319✔
2368
}
2369

2370
// NewJSPedanticError creates a new JSPedanticErrF error: "pedantic mode: {err}"
2371
func NewJSPedanticError(err error, opts ...ErrorOption) *ApiError {
36✔
2372
        eopts := parseOpts(opts)
36✔
2373
        if ae, ok := eopts.err.(*ApiError); ok {
36✔
2374
                return ae
×
2375
        }
×
2376

2377
        e := ApiErrors[JSPedanticErrF]
36✔
2378
        args := e.toReplacerArgs([]interface{}{"{err}", err})
36✔
2379
        return &ApiError{
36✔
2380
                Code:        e.Code,
36✔
2381
                ErrCode:     e.ErrCode,
36✔
2382
                Description: strings.NewReplacer(args...).Replace(e.Description),
36✔
2383
        }
36✔
2384
}
2385

2386
// NewJSPeerRemapError creates a new JSPeerRemapErr error: "peer remap failed"
2387
func NewJSPeerRemapError(opts ...ErrorOption) *ApiError {
5✔
2388
        eopts := parseOpts(opts)
5✔
2389
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2390
                return ae
1✔
2391
        }
1✔
2392

2393
        return ApiErrors[JSPeerRemapErr]
4✔
2394
}
2395

2396
// NewJSRaftGeneralError creates a new JSRaftGeneralErrF error: "{err}"
2397
func NewJSRaftGeneralError(err error, opts ...ErrorOption) *ApiError {
×
2398
        eopts := parseOpts(opts)
×
2399
        if ae, ok := eopts.err.(*ApiError); ok {
×
2400
                return ae
×
2401
        }
×
2402

2403
        e := ApiErrors[JSRaftGeneralErrF]
×
2404
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2405
        return &ApiError{
×
2406
                Code:        e.Code,
×
2407
                ErrCode:     e.ErrCode,
×
2408
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2409
        }
×
2410
}
2411

2412
// NewJSReplicasCountCannotBeNegativeError creates a new JSReplicasCountCannotBeNegative error: "replicas count cannot be negative"
2413
func NewJSReplicasCountCannotBeNegativeError(opts ...ErrorOption) *ApiError {
16✔
2414
        eopts := parseOpts(opts)
16✔
2415
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2416
                return ae
×
2417
        }
×
2418

2419
        return ApiErrors[JSReplicasCountCannotBeNegative]
16✔
2420
}
2421

2422
// NewJSRequiredApiLevelError creates a new JSRequiredApiLevelErr error: "JetStream minimum api level required"
2423
func NewJSRequiredApiLevelError(opts ...ErrorOption) *ApiError {
44✔
2424
        eopts := parseOpts(opts)
44✔
2425
        if ae, ok := eopts.err.(*ApiError); ok {
44✔
2426
                return ae
×
2427
        }
×
2428

2429
        return ApiErrors[JSRequiredApiLevelErr]
44✔
2430
}
2431

2432
// NewJSRestoreSubscribeFailedError creates a new JSRestoreSubscribeFailedErrF error: "JetStream unable to subscribe to restore snapshot {subject}: {err}"
2433
func NewJSRestoreSubscribeFailedError(err error, subject interface{}, opts ...ErrorOption) *ApiError {
1✔
2434
        eopts := parseOpts(opts)
1✔
2435
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2436
                return ae
×
2437
        }
×
2438

2439
        e := ApiErrors[JSRestoreSubscribeFailedErrF]
1✔
2440
        args := e.toReplacerArgs([]interface{}{"{err}", err, "{subject}", subject})
1✔
2441
        return &ApiError{
1✔
2442
                Code:        e.Code,
1✔
2443
                ErrCode:     e.ErrCode,
1✔
2444
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2445
        }
1✔
2446
}
2447

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

2455
        e := ApiErrors[JSSequenceNotFoundErrF]
1,049✔
2456
        args := e.toReplacerArgs([]interface{}{"{seq}", seq})
1,049✔
2457
        return &ApiError{
1,049✔
2458
                Code:        e.Code,
1,049✔
2459
                ErrCode:     e.ErrCode,
1,049✔
2460
                Description: strings.NewReplacer(args...).Replace(e.Description),
1,049✔
2461
        }
1,049✔
2462
}
2463

2464
// NewJSSnapshotDeliverSubjectInvalidError creates a new JSSnapshotDeliverSubjectInvalidErr error: "deliver subject not valid"
2465
func NewJSSnapshotDeliverSubjectInvalidError(opts ...ErrorOption) *ApiError {
1✔
2466
        eopts := parseOpts(opts)
1✔
2467
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2468
                return ae
×
2469
        }
×
2470

2471
        return ApiErrors[JSSnapshotDeliverSubjectInvalidErr]
1✔
2472
}
2473

2474
// NewJSSourceConsumerSetupFailedError creates a new JSSourceConsumerSetupFailedErrF error: "{err}"
2475
func NewJSSourceConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
2476
        eopts := parseOpts(opts)
×
2477
        if ae, ok := eopts.err.(*ApiError); ok {
×
2478
                return ae
×
2479
        }
×
2480

2481
        e := ApiErrors[JSSourceConsumerSetupFailedErrF]
×
2482
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2483
        return &ApiError{
×
2484
                Code:        e.Code,
×
2485
                ErrCode:     e.ErrCode,
×
2486
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2487
        }
×
2488
}
2489

2490
// NewJSSourceDuplicateDetectedError creates a new JSSourceDuplicateDetected error: "duplicate source configuration detected"
2491
func NewJSSourceDuplicateDetectedError(opts ...ErrorOption) *ApiError {
×
2492
        eopts := parseOpts(opts)
×
2493
        if ae, ok := eopts.err.(*ApiError); ok {
×
2494
                return ae
×
2495
        }
×
2496

2497
        return ApiErrors[JSSourceDuplicateDetected]
×
2498
}
2499

2500
// NewJSSourceInvalidStreamNameError creates a new JSSourceInvalidStreamName error: "sourced stream name is invalid"
2501
func NewJSSourceInvalidStreamNameError(opts ...ErrorOption) *ApiError {
2✔
2502
        eopts := parseOpts(opts)
2✔
2503
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2504
                return ae
×
2505
        }
×
2506

2507
        return ApiErrors[JSSourceInvalidStreamName]
2✔
2508
}
2509

2510
// NewJSSourceInvalidSubjectFilterError creates a new JSSourceInvalidSubjectFilter error: "source transform source: {err}"
2511
func NewJSSourceInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
5✔
2512
        eopts := parseOpts(opts)
5✔
2513
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2514
                return ae
×
2515
        }
×
2516

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

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

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

2542
// NewJSSourceMaxMessageSizeTooBigError creates a new JSSourceMaxMessageSizeTooBigErr error: "stream source must have max message size >= target"
2543
func NewJSSourceMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
2544
        eopts := parseOpts(opts)
×
2545
        if ae, ok := eopts.err.(*ApiError); ok {
×
2546
                return ae
×
2547
        }
×
2548

2549
        return ApiErrors[JSSourceMaxMessageSizeTooBigErr]
×
2550
}
2551

2552
// NewJSSourceMultipleFiltersNotAllowedError creates a new JSSourceMultipleFiltersNotAllowed error: "source with multiple subject transforms cannot also have a single subject filter"
2553
func NewJSSourceMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
4✔
2554
        eopts := parseOpts(opts)
4✔
2555
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2556
                return ae
×
2557
        }
×
2558

2559
        return ApiErrors[JSSourceMultipleFiltersNotAllowed]
4✔
2560
}
2561

2562
// NewJSSourceOverlappingSubjectFiltersError creates a new JSSourceOverlappingSubjectFilters error: "source filters can not overlap"
2563
func NewJSSourceOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
4✔
2564
        eopts := parseOpts(opts)
4✔
2565
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2566
                return ae
×
2567
        }
×
2568

2569
        return ApiErrors[JSSourceOverlappingSubjectFilters]
4✔
2570
}
2571

2572
// NewJSSourceWithMsgSchedulesError creates a new JSSourceWithMsgSchedulesErr error: "stream source can not also schedule messages"
2573
func NewJSSourceWithMsgSchedulesError(opts ...ErrorOption) *ApiError {
2✔
2574
        eopts := parseOpts(opts)
2✔
2575
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2576
                return ae
×
2577
        }
×
2578

2579
        return ApiErrors[JSSourceWithMsgSchedulesErr]
2✔
2580
}
2581

2582
// NewJSStorageResourcesExceededError creates a new JSStorageResourcesExceededErr error: "insufficient storage resources available"
2583
func NewJSStorageResourcesExceededError(opts ...ErrorOption) *ApiError {
37✔
2584
        eopts := parseOpts(opts)
37✔
2585
        if ae, ok := eopts.err.(*ApiError); ok {
37✔
2586
                return ae
×
2587
        }
×
2588

2589
        return ApiErrors[JSStorageResourcesExceededErr]
37✔
2590
}
2591

2592
// NewJSStreamAssignmentError creates a new JSStreamAssignmentErrF error: "{err}"
2593
func NewJSStreamAssignmentError(err error, opts ...ErrorOption) *ApiError {
×
2594
        eopts := parseOpts(opts)
×
2595
        if ae, ok := eopts.err.(*ApiError); ok {
×
2596
                return ae
×
2597
        }
×
2598

2599
        e := ApiErrors[JSStreamAssignmentErrF]
×
2600
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2601
        return &ApiError{
×
2602
                Code:        e.Code,
×
2603
                ErrCode:     e.ErrCode,
×
2604
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2605
        }
×
2606
}
2607

2608
// NewJSStreamCreateError creates a new JSStreamCreateErrF error: "{err}"
2609
func NewJSStreamCreateError(err error, opts ...ErrorOption) *ApiError {
68✔
2610
        eopts := parseOpts(opts)
68✔
2611
        if ae, ok := eopts.err.(*ApiError); ok {
133✔
2612
                return ae
65✔
2613
        }
65✔
2614

2615
        e := ApiErrors[JSStreamCreateErrF]
3✔
2616
        args := e.toReplacerArgs([]interface{}{"{err}", err})
3✔
2617
        return &ApiError{
3✔
2618
                Code:        e.Code,
3✔
2619
                ErrCode:     e.ErrCode,
3✔
2620
                Description: strings.NewReplacer(args...).Replace(e.Description),
3✔
2621
        }
3✔
2622
}
2623

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

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

2640
// NewJSStreamDuplicateMessageConflictError creates a new JSStreamDuplicateMessageConflict error: "duplicate message id is in process"
2641
func NewJSStreamDuplicateMessageConflictError(opts ...ErrorOption) *ApiError {
181✔
2642
        eopts := parseOpts(opts)
181✔
2643
        if ae, ok := eopts.err.(*ApiError); ok {
181✔
2644
                return ae
×
2645
        }
×
2646

2647
        return ApiErrors[JSStreamDuplicateMessageConflict]
181✔
2648
}
2649

2650
// NewJSStreamExpectedLastSeqPerSubjectInvalidError creates a new JSStreamExpectedLastSeqPerSubjectInvalid error: "missing sequence for expected last sequence per subject"
2651
func NewJSStreamExpectedLastSeqPerSubjectInvalidError(opts ...ErrorOption) *ApiError {
8✔
2652
        eopts := parseOpts(opts)
8✔
2653
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
2654
                return ae
×
2655
        }
×
2656

2657
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectInvalid]
8✔
2658
}
2659

2660
// NewJSStreamExpectedLastSeqPerSubjectNotReadyError creates a new JSStreamExpectedLastSeqPerSubjectNotReady error: "expected last sequence per subject temporarily unavailable"
2661
func NewJSStreamExpectedLastSeqPerSubjectNotReadyError(opts ...ErrorOption) *ApiError {
×
2662
        eopts := parseOpts(opts)
×
2663
        if ae, ok := eopts.err.(*ApiError); ok {
×
2664
                return ae
×
2665
        }
×
2666

2667
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectNotReady]
×
2668
}
2669

2670
// NewJSStreamExternalApiOverlapError creates a new JSStreamExternalApiOverlapErrF error: "stream external api prefix {prefix} must not overlap with {subject}"
2671
func NewJSStreamExternalApiOverlapError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
2✔
2672
        eopts := parseOpts(opts)
2✔
2673
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2674
                return ae
×
2675
        }
×
2676

2677
        e := ApiErrors[JSStreamExternalApiOverlapErrF]
2✔
2678
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
2✔
2679
        return &ApiError{
2✔
2680
                Code:        e.Code,
2✔
2681
                ErrCode:     e.ErrCode,
2✔
2682
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2683
        }
2✔
2684
}
2685

2686
// NewJSStreamExternalDelPrefixOverlapsError creates a new JSStreamExternalDelPrefixOverlapsErrF error: "stream external delivery prefix {prefix} overlaps with stream subject {subject}"
2687
func NewJSStreamExternalDelPrefixOverlapsError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
×
2688
        eopts := parseOpts(opts)
×
2689
        if ae, ok := eopts.err.(*ApiError); ok {
×
2690
                return ae
×
2691
        }
×
2692

2693
        e := ApiErrors[JSStreamExternalDelPrefixOverlapsErrF]
×
2694
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
×
2695
        return &ApiError{
×
2696
                Code:        e.Code,
×
2697
                ErrCode:     e.ErrCode,
×
2698
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2699
        }
×
2700
}
2701

2702
// NewJSStreamGeneralError creates a new JSStreamGeneralErrorF error: "{err}"
2703
func NewJSStreamGeneralError(err error, opts ...ErrorOption) *ApiError {
5✔
2704
        eopts := parseOpts(opts)
5✔
2705
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2706
                return ae
×
2707
        }
×
2708

2709
        e := ApiErrors[JSStreamGeneralErrorF]
5✔
2710
        args := e.toReplacerArgs([]interface{}{"{err}", err})
5✔
2711
        return &ApiError{
5✔
2712
                Code:        e.Code,
5✔
2713
                ErrCode:     e.ErrCode,
5✔
2714
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
2715
        }
5✔
2716
}
2717

2718
// NewJSStreamHeaderExceedsMaximumError creates a new JSStreamHeaderExceedsMaximumErr error: "header size exceeds maximum allowed of 64k"
2719
func NewJSStreamHeaderExceedsMaximumError(opts ...ErrorOption) *ApiError {
1✔
2720
        eopts := parseOpts(opts)
1✔
2721
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2722
                return ae
×
2723
        }
×
2724

2725
        return ApiErrors[JSStreamHeaderExceedsMaximumErr]
1✔
2726
}
2727

2728
// NewJSStreamInfoMaxSubjectsError creates a new JSStreamInfoMaxSubjectsErr error: "subject details would exceed maximum allowed"
2729
func NewJSStreamInfoMaxSubjectsError(opts ...ErrorOption) *ApiError {
×
2730
        eopts := parseOpts(opts)
×
2731
        if ae, ok := eopts.err.(*ApiError); ok {
×
2732
                return ae
×
2733
        }
×
2734

2735
        return ApiErrors[JSStreamInfoMaxSubjectsErr]
×
2736
}
2737

2738
// NewJSStreamInvalidConfigError creates a new JSStreamInvalidConfigF error: "{err}"
2739
func NewJSStreamInvalidConfigError(err error, opts ...ErrorOption) *ApiError {
163✔
2740
        eopts := parseOpts(opts)
163✔
2741
        if ae, ok := eopts.err.(*ApiError); ok {
182✔
2742
                return ae
19✔
2743
        }
19✔
2744

2745
        e := ApiErrors[JSStreamInvalidConfigF]
144✔
2746
        args := e.toReplacerArgs([]interface{}{"{err}", err})
144✔
2747
        return &ApiError{
144✔
2748
                Code:        e.Code,
144✔
2749
                ErrCode:     e.ErrCode,
144✔
2750
                Description: strings.NewReplacer(args...).Replace(e.Description),
144✔
2751
        }
144✔
2752
}
2753

2754
// NewJSStreamInvalidError creates a new JSStreamInvalidErr error: "stream not valid"
2755
func NewJSStreamInvalidError(opts ...ErrorOption) *ApiError {
×
2756
        eopts := parseOpts(opts)
×
2757
        if ae, ok := eopts.err.(*ApiError); ok {
×
2758
                return ae
×
2759
        }
×
2760

2761
        return ApiErrors[JSStreamInvalidErr]
×
2762
}
2763

2764
// NewJSStreamInvalidExternalDeliverySubjError creates a new JSStreamInvalidExternalDeliverySubjErrF error: "stream external delivery prefix {prefix} must not contain wildcards"
2765
func NewJSStreamInvalidExternalDeliverySubjError(prefix interface{}, opts ...ErrorOption) *ApiError {
×
2766
        eopts := parseOpts(opts)
×
2767
        if ae, ok := eopts.err.(*ApiError); ok {
×
2768
                return ae
×
2769
        }
×
2770

2771
        e := ApiErrors[JSStreamInvalidExternalDeliverySubjErrF]
×
2772
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix})
×
2773
        return &ApiError{
×
2774
                Code:        e.Code,
×
2775
                ErrCode:     e.ErrCode,
×
2776
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2777
        }
×
2778
}
2779

2780
// NewJSStreamLimitsError creates a new JSStreamLimitsErrF error: "{err}"
2781
func NewJSStreamLimitsError(err error, opts ...ErrorOption) *ApiError {
18✔
2782
        eopts := parseOpts(opts)
18✔
2783
        if ae, ok := eopts.err.(*ApiError); ok {
36✔
2784
                return ae
18✔
2785
        }
18✔
2786

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

2796
// NewJSStreamMaxBytesRequiredError creates a new JSStreamMaxBytesRequired error: "account requires a stream config to have max bytes set"
2797
func NewJSStreamMaxBytesRequiredError(opts ...ErrorOption) *ApiError {
11✔
2798
        eopts := parseOpts(opts)
11✔
2799
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
2800
                return ae
×
2801
        }
×
2802

2803
        return ApiErrors[JSStreamMaxBytesRequired]
11✔
2804
}
2805

2806
// NewJSStreamMaxStreamBytesExceededError creates a new JSStreamMaxStreamBytesExceeded error: "stream max bytes exceeds account limit max stream bytes"
2807
func NewJSStreamMaxStreamBytesExceededError(opts ...ErrorOption) *ApiError {
12✔
2808
        eopts := parseOpts(opts)
12✔
2809
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
2810
                return ae
×
2811
        }
×
2812

2813
        return ApiErrors[JSStreamMaxStreamBytesExceeded]
12✔
2814
}
2815

2816
// NewJSStreamMessageExceedsMaximumError creates a new JSStreamMessageExceedsMaximumErr error: "message size exceeds maximum allowed"
2817
func NewJSStreamMessageExceedsMaximumError(opts ...ErrorOption) *ApiError {
19✔
2818
        eopts := parseOpts(opts)
19✔
2819
        if ae, ok := eopts.err.(*ApiError); ok {
19✔
2820
                return ae
×
2821
        }
×
2822

2823
        return ApiErrors[JSStreamMessageExceedsMaximumErr]
19✔
2824
}
2825

2826
// NewJSStreamMinLastSeqError creates a new JSStreamMinLastSeqErr error: "min last sequence"
2827
func NewJSStreamMinLastSeqError(opts ...ErrorOption) *ApiError {
×
2828
        eopts := parseOpts(opts)
×
2829
        if ae, ok := eopts.err.(*ApiError); ok {
×
2830
                return ae
×
2831
        }
×
2832

2833
        return ApiErrors[JSStreamMinLastSeqErr]
×
2834
}
2835

2836
// NewJSStreamMirrorNotUpdatableError creates a new JSStreamMirrorNotUpdatableErr error: "stream mirror configuration can not be updated"
2837
func NewJSStreamMirrorNotUpdatableError(opts ...ErrorOption) *ApiError {
2✔
2838
        eopts := parseOpts(opts)
2✔
2839
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2840
                return ae
×
2841
        }
×
2842

2843
        return ApiErrors[JSStreamMirrorNotUpdatableErr]
2✔
2844
}
2845

2846
// NewJSStreamMismatchError creates a new JSStreamMismatchErr error: "stream name in subject does not match request"
2847
func NewJSStreamMismatchError(opts ...ErrorOption) *ApiError {
7✔
2848
        eopts := parseOpts(opts)
7✔
2849
        if ae, ok := eopts.err.(*ApiError); ok {
7✔
2850
                return ae
×
2851
        }
×
2852

2853
        return ApiErrors[JSStreamMismatchErr]
7✔
2854
}
2855

2856
// NewJSStreamMoveAndScaleError creates a new JSStreamMoveAndScaleErr error: "can not move and scale a stream in a single update"
2857
func NewJSStreamMoveAndScaleError(opts ...ErrorOption) *ApiError {
4✔
2858
        eopts := parseOpts(opts)
4✔
2859
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2860
                return ae
×
2861
        }
×
2862

2863
        return ApiErrors[JSStreamMoveAndScaleErr]
4✔
2864
}
2865

2866
// NewJSStreamMoveInProgressError creates a new JSStreamMoveInProgressF error: "stream move already in progress: {msg}"
2867
func NewJSStreamMoveInProgressError(msg interface{}, opts ...ErrorOption) *ApiError {
2✔
2868
        eopts := parseOpts(opts)
2✔
2869
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2870
                return ae
×
2871
        }
×
2872

2873
        e := ApiErrors[JSStreamMoveInProgressF]
2✔
2874
        args := e.toReplacerArgs([]interface{}{"{msg}", msg})
2✔
2875
        return &ApiError{
2✔
2876
                Code:        e.Code,
2✔
2877
                ErrCode:     e.ErrCode,
2✔
2878
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2879
        }
2✔
2880
}
2881

2882
// NewJSStreamMoveNotInProgressError creates a new JSStreamMoveNotInProgress error: "stream move not in progress"
2883
func NewJSStreamMoveNotInProgressError(opts ...ErrorOption) *ApiError {
×
2884
        eopts := parseOpts(opts)
×
2885
        if ae, ok := eopts.err.(*ApiError); ok {
×
2886
                return ae
×
2887
        }
×
2888

2889
        return ApiErrors[JSStreamMoveNotInProgress]
×
2890
}
2891

2892
// NewJSStreamMsgDeleteFailedError creates a new JSStreamMsgDeleteFailedF error: "{err}"
2893
func NewJSStreamMsgDeleteFailedError(err error, opts ...ErrorOption) *ApiError {
1,756✔
2894
        eopts := parseOpts(opts)
1,756✔
2895
        if ae, ok := eopts.err.(*ApiError); ok {
1,756✔
2896
                return ae
×
2897
        }
×
2898

2899
        e := ApiErrors[JSStreamMsgDeleteFailedF]
1,756✔
2900
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1,756✔
2901
        return &ApiError{
1,756✔
2902
                Code:        e.Code,
1,756✔
2903
                ErrCode:     e.ErrCode,
1,756✔
2904
                Description: strings.NewReplacer(args...).Replace(e.Description),
1,756✔
2905
        }
1,756✔
2906
}
2907

2908
// NewJSStreamNameContainsPathSeparatorsError creates a new JSStreamNameContainsPathSeparatorsErr error: "Stream name can not contain path separators"
2909
func NewJSStreamNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
6✔
2910
        eopts := parseOpts(opts)
6✔
2911
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2912
                return ae
×
2913
        }
×
2914

2915
        return ApiErrors[JSStreamNameContainsPathSeparatorsErr]
6✔
2916
}
2917

2918
// NewJSStreamNameExistError creates a new JSStreamNameExistErr error: "stream name already in use with a different configuration"
2919
func NewJSStreamNameExistError(opts ...ErrorOption) *ApiError {
10✔
2920
        eopts := parseOpts(opts)
10✔
2921
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2922
                return ae
×
2923
        }
×
2924

2925
        return ApiErrors[JSStreamNameExistErr]
10✔
2926
}
2927

2928
// NewJSStreamNameExistRestoreFailedError creates a new JSStreamNameExistRestoreFailedErr error: "stream name already in use, cannot restore"
2929
func NewJSStreamNameExistRestoreFailedError(opts ...ErrorOption) *ApiError {
7✔
2930
        eopts := parseOpts(opts)
7✔
2931
        if ae, ok := eopts.err.(*ApiError); ok {
7✔
2932
                return ae
×
2933
        }
×
2934

2935
        return ApiErrors[JSStreamNameExistRestoreFailedErr]
7✔
2936
}
2937

2938
// NewJSStreamNotFoundError creates a new JSStreamNotFoundErr error: "stream not found"
2939
func NewJSStreamNotFoundError(opts ...ErrorOption) *ApiError {
30,455✔
2940
        eopts := parseOpts(opts)
30,455✔
2941
        if ae, ok := eopts.err.(*ApiError); ok {
31,230✔
2942
                return ae
775✔
2943
        }
775✔
2944

2945
        return ApiErrors[JSStreamNotFoundErr]
29,680✔
2946
}
2947

2948
// NewJSStreamNotMatchError creates a new JSStreamNotMatchErr error: "expected stream does not match"
2949
func NewJSStreamNotMatchError(opts ...ErrorOption) *ApiError {
5✔
2950
        eopts := parseOpts(opts)
5✔
2951
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2952
                return ae
×
2953
        }
×
2954

2955
        return ApiErrors[JSStreamNotMatchErr]
5✔
2956
}
2957

2958
// NewJSStreamOfflineError creates a new JSStreamOfflineErr error: "stream is offline"
2959
func NewJSStreamOfflineError(opts ...ErrorOption) *ApiError {
6✔
2960
        eopts := parseOpts(opts)
6✔
2961
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2962
                return ae
×
2963
        }
×
2964

2965
        return ApiErrors[JSStreamOfflineErr]
6✔
2966
}
2967

2968
// NewJSStreamOfflineReasonError creates a new JSStreamOfflineReasonErrF error: "stream is offline: {err}"
2969
func NewJSStreamOfflineReasonError(err error, opts ...ErrorOption) *ApiError {
40✔
2970
        eopts := parseOpts(opts)
40✔
2971
        if ae, ok := eopts.err.(*ApiError); ok {
40✔
2972
                return ae
×
2973
        }
×
2974

2975
        e := ApiErrors[JSStreamOfflineReasonErrF]
40✔
2976
        args := e.toReplacerArgs([]interface{}{"{err}", err})
40✔
2977
        return &ApiError{
40✔
2978
                Code:        e.Code,
40✔
2979
                ErrCode:     e.ErrCode,
40✔
2980
                Description: strings.NewReplacer(args...).Replace(e.Description),
40✔
2981
        }
40✔
2982
}
2983

2984
// NewJSStreamPurgeFailedError creates a new JSStreamPurgeFailedF error: "{err}"
2985
func NewJSStreamPurgeFailedError(err error, opts ...ErrorOption) *ApiError {
1✔
2986
        eopts := parseOpts(opts)
1✔
2987
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2988
                return ae
×
2989
        }
×
2990

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

3000
// NewJSStreamReplicasNotSupportedError creates a new JSStreamReplicasNotSupportedErr error: "replicas > 1 not supported in non-clustered mode"
3001
func NewJSStreamReplicasNotSupportedError(opts ...ErrorOption) *ApiError {
1✔
3002
        eopts := parseOpts(opts)
1✔
3003
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3004
                return ae
×
3005
        }
×
3006

3007
        return ApiErrors[JSStreamReplicasNotSupportedErr]
1✔
3008
}
3009

3010
// NewJSStreamReplicasNotUpdatableError creates a new JSStreamReplicasNotUpdatableErr error: "Replicas configuration can not be updated"
3011
func NewJSStreamReplicasNotUpdatableError(opts ...ErrorOption) *ApiError {
×
3012
        eopts := parseOpts(opts)
×
3013
        if ae, ok := eopts.err.(*ApiError); ok {
×
3014
                return ae
×
3015
        }
×
3016

3017
        return ApiErrors[JSStreamReplicasNotUpdatableErr]
×
3018
}
3019

3020
// NewJSStreamRestoreError creates a new JSStreamRestoreErrF error: "restore failed: {err}"
3021
func NewJSStreamRestoreError(err error, opts ...ErrorOption) *ApiError {
7✔
3022
        eopts := parseOpts(opts)
7✔
3023
        if ae, ok := eopts.err.(*ApiError); ok {
9✔
3024
                return ae
2✔
3025
        }
2✔
3026

3027
        e := ApiErrors[JSStreamRestoreErrF]
5✔
3028
        args := e.toReplacerArgs([]interface{}{"{err}", err})
5✔
3029
        return &ApiError{
5✔
3030
                Code:        e.Code,
5✔
3031
                ErrCode:     e.ErrCode,
5✔
3032
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
3033
        }
5✔
3034
}
3035

3036
// NewJSStreamRollupFailedError creates a new JSStreamRollupFailedF error: "{err}"
3037
func NewJSStreamRollupFailedError(err error, opts ...ErrorOption) *ApiError {
13✔
3038
        eopts := parseOpts(opts)
13✔
3039
        if ae, ok := eopts.err.(*ApiError); ok {
13✔
3040
                return ae
×
3041
        }
×
3042

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

3052
// NewJSStreamSealedError creates a new JSStreamSealedErr error: "invalid operation on sealed stream"
3053
func NewJSStreamSealedError(opts ...ErrorOption) *ApiError {
10✔
3054
        eopts := parseOpts(opts)
10✔
3055
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
3056
                return ae
×
3057
        }
×
3058

3059
        return ApiErrors[JSStreamSealedErr]
10✔
3060
}
3061

3062
// NewJSStreamSequenceNotMatchError creates a new JSStreamSequenceNotMatchErr error: "expected stream sequence does not match"
3063
func NewJSStreamSequenceNotMatchError(opts ...ErrorOption) *ApiError {
×
3064
        eopts := parseOpts(opts)
×
3065
        if ae, ok := eopts.err.(*ApiError); ok {
×
3066
                return ae
×
3067
        }
×
3068

3069
        return ApiErrors[JSStreamSequenceNotMatchErr]
×
3070
}
3071

3072
// NewJSStreamSnapshotError creates a new JSStreamSnapshotErrF error: "snapshot failed: {err}"
3073
func NewJSStreamSnapshotError(err error, opts ...ErrorOption) *ApiError {
×
3074
        eopts := parseOpts(opts)
×
3075
        if ae, ok := eopts.err.(*ApiError); ok {
×
3076
                return ae
×
3077
        }
×
3078

3079
        e := ApiErrors[JSStreamSnapshotErrF]
×
3080
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
3081
        return &ApiError{
×
3082
                Code:        e.Code,
×
3083
                ErrCode:     e.ErrCode,
×
3084
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
3085
        }
×
3086
}
3087

3088
// NewJSStreamStoreFailedError creates a new JSStreamStoreFailedF error: "{err}"
3089
func NewJSStreamStoreFailedError(err error, opts ...ErrorOption) *ApiError {
2,977✔
3090
        eopts := parseOpts(opts)
2,977✔
3091
        if ae, ok := eopts.err.(*ApiError); ok {
2,977✔
3092
                return ae
×
3093
        }
×
3094

3095
        e := ApiErrors[JSStreamStoreFailedF]
2,977✔
3096
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2,977✔
3097
        return &ApiError{
2,977✔
3098
                Code:        e.Code,
2,977✔
3099
                ErrCode:     e.ErrCode,
2,977✔
3100
                Description: strings.NewReplacer(args...).Replace(e.Description),
2,977✔
3101
        }
2,977✔
3102
}
3103

3104
// NewJSStreamSubjectOverlapError creates a new JSStreamSubjectOverlapErr error: "subjects overlap with an existing stream"
3105
func NewJSStreamSubjectOverlapError(opts ...ErrorOption) *ApiError {
25✔
3106
        eopts := parseOpts(opts)
25✔
3107
        if ae, ok := eopts.err.(*ApiError); ok {
25✔
3108
                return ae
×
3109
        }
×
3110

3111
        return ApiErrors[JSStreamSubjectOverlapErr]
25✔
3112
}
3113

3114
// NewJSStreamTemplateCreateError creates a new JSStreamTemplateCreateErrF error: "{err}"
3115
func NewJSStreamTemplateCreateError(err error, opts ...ErrorOption) *ApiError {
×
3116
        eopts := parseOpts(opts)
×
3117
        if ae, ok := eopts.err.(*ApiError); ok {
×
3118
                return ae
×
3119
        }
×
3120

3121
        e := ApiErrors[JSStreamTemplateCreateErrF]
×
3122
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
3123
        return &ApiError{
×
3124
                Code:        e.Code,
×
3125
                ErrCode:     e.ErrCode,
×
3126
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
3127
        }
×
3128
}
3129

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

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

3146
// NewJSStreamTemplateNotFoundError creates a new JSStreamTemplateNotFoundErr error: "template not found"
3147
func NewJSStreamTemplateNotFoundError(opts ...ErrorOption) *ApiError {
×
3148
        eopts := parseOpts(opts)
×
3149
        if ae, ok := eopts.err.(*ApiError); ok {
×
3150
                return ae
×
3151
        }
×
3152

3153
        return ApiErrors[JSStreamTemplateNotFoundErr]
×
3154
}
3155

3156
// NewJSStreamTooManyRequestsError creates a new JSStreamTooManyRequests error: "too many requests"
3157
func NewJSStreamTooManyRequestsError(opts ...ErrorOption) *ApiError {
143✔
3158
        eopts := parseOpts(opts)
143✔
3159
        if ae, ok := eopts.err.(*ApiError); ok {
143✔
3160
                return ae
×
3161
        }
×
3162

3163
        return ApiErrors[JSStreamTooManyRequests]
143✔
3164
}
3165

3166
// NewJSStreamTransformInvalidDestinationError creates a new JSStreamTransformInvalidDestination error: "stream transform: {err}"
3167
func NewJSStreamTransformInvalidDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
3168
        eopts := parseOpts(opts)
1✔
3169
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3170
                return ae
×
3171
        }
×
3172

3173
        e := ApiErrors[JSStreamTransformInvalidDestination]
1✔
3174
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
3175
        return &ApiError{
1✔
3176
                Code:        e.Code,
1✔
3177
                ErrCode:     e.ErrCode,
1✔
3178
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
3179
        }
1✔
3180
}
3181

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

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

3198
// NewJSStreamUpdateError creates a new JSStreamUpdateErrF error: "{err}"
3199
func NewJSStreamUpdateError(err error, opts ...ErrorOption) *ApiError {
30✔
3200
        eopts := parseOpts(opts)
30✔
3201
        if ae, ok := eopts.err.(*ApiError); ok {
54✔
3202
                return ae
24✔
3203
        }
24✔
3204

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

3214
// NewJSStreamWrongLastMsgIDError creates a new JSStreamWrongLastMsgIDErrF error: "wrong last msg ID: {id}"
3215
func NewJSStreamWrongLastMsgIDError(id interface{}, opts ...ErrorOption) *ApiError {
5✔
3216
        eopts := parseOpts(opts)
5✔
3217
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
3218
                return ae
×
3219
        }
×
3220

3221
        e := ApiErrors[JSStreamWrongLastMsgIDErrF]
5✔
3222
        args := e.toReplacerArgs([]interface{}{"{id}", id})
5✔
3223
        return &ApiError{
5✔
3224
                Code:        e.Code,
5✔
3225
                ErrCode:     e.ErrCode,
5✔
3226
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
3227
        }
5✔
3228
}
3229

3230
// NewJSStreamWrongLastSequenceConstantError creates a new JSStreamWrongLastSequenceConstantErr error: "wrong last sequence"
3231
func NewJSStreamWrongLastSequenceConstantError(opts ...ErrorOption) *ApiError {
23✔
3232
        eopts := parseOpts(opts)
23✔
3233
        if ae, ok := eopts.err.(*ApiError); ok {
23✔
3234
                return ae
×
3235
        }
×
3236

3237
        return ApiErrors[JSStreamWrongLastSequenceConstantErr]
23✔
3238
}
3239

3240
// NewJSStreamWrongLastSequenceError creates a new JSStreamWrongLastSequenceErrF error: "wrong last sequence: {seq}"
3241
func NewJSStreamWrongLastSequenceError(seq uint64, opts ...ErrorOption) *ApiError {
106✔
3242
        eopts := parseOpts(opts)
106✔
3243
        if ae, ok := eopts.err.(*ApiError); ok {
106✔
3244
                return ae
×
3245
        }
×
3246

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

3256
// NewJSTempStorageFailedError creates a new JSTempStorageFailedErr error: "JetStream unable to open temp storage for restore"
3257
func NewJSTempStorageFailedError(opts ...ErrorOption) *ApiError {
×
3258
        eopts := parseOpts(opts)
×
3259
        if ae, ok := eopts.err.(*ApiError); ok {
×
3260
                return ae
×
3261
        }
×
3262

3263
        return ApiErrors[JSTempStorageFailedErr]
×
3264
}
3265

3266
// NewJSTemplateNameNotMatchSubjectError creates a new JSTemplateNameNotMatchSubjectErr error: "template name in subject does not match request"
3267
func NewJSTemplateNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
×
3268
        eopts := parseOpts(opts)
×
3269
        if ae, ok := eopts.err.(*ApiError); ok {
×
3270
                return ae
×
3271
        }
×
3272

3273
        return ApiErrors[JSTemplateNameNotMatchSubjectErr]
×
3274
}
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