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

nats-io / nats-server / 17257532711

26 Aug 2025 04:09PM UTC coverage: 85.883% (-0.03%) from 85.914%
17257532711

push

github

web-flow
[FIXED] Consumer MaxDeliver underflow (#7216)

A `MaxDeliver` of `-1`/infinite would result in an underflow when doing
`uint64(cfg.MaxDeliver)`. This didn't result in any issues per se, only
the `o.hasMaxDeliveries` code path couldn't short-circuit if `o.maxdc ==
0`.

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

73544 of 85633 relevant lines covered (85.88%)

312067.38 hits per line

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

55.51
/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
        // JSAtomicPublishDisabledErr atomic publish is disabled
12
        JSAtomicPublishDisabledErr ErrorIdentifier = 10174
13

14
        // JSAtomicPublishIncompleteBatchErr atomic publish batch is incomplete
15
        JSAtomicPublishIncompleteBatchErr ErrorIdentifier = 10176
16

17
        // JSAtomicPublishInvalidBatchIDErr atomic publish batch ID is invalid
18
        JSAtomicPublishInvalidBatchIDErr ErrorIdentifier = 10179
19

20
        // JSAtomicPublishMissingSeqErr atomic publish sequence is missing
21
        JSAtomicPublishMissingSeqErr ErrorIdentifier = 10175
22

23
        // JSAtomicPublishUnsupportedHeaderBatchErr atomic publish unsupported header used: {header}
24
        JSAtomicPublishUnsupportedHeaderBatchErr ErrorIdentifier = 10177
25

26
        // JSBadRequestErr bad request
27
        JSBadRequestErr ErrorIdentifier = 10003
28

29
        // JSClusterIncompleteErr incomplete results
30
        JSClusterIncompleteErr ErrorIdentifier = 10004
31

32
        // JSClusterNoPeersErrF Error causing no peers to be available ({err})
33
        JSClusterNoPeersErrF ErrorIdentifier = 10005
34

35
        // JSClusterNotActiveErr JetStream not in clustered mode
36
        JSClusterNotActiveErr ErrorIdentifier = 10006
37

38
        // JSClusterNotAssignedErr JetStream cluster not assigned to this server
39
        JSClusterNotAssignedErr ErrorIdentifier = 10007
40

41
        // JSClusterNotAvailErr JetStream system temporarily unavailable
42
        JSClusterNotAvailErr ErrorIdentifier = 10008
43

44
        // JSClusterNotLeaderErr JetStream cluster can not handle request
45
        JSClusterNotLeaderErr ErrorIdentifier = 10009
46

47
        // JSClusterPeerNotMemberErr peer not a member
48
        JSClusterPeerNotMemberErr ErrorIdentifier = 10040
49

50
        // JSClusterRequiredErr JetStream clustering support required
51
        JSClusterRequiredErr ErrorIdentifier = 10010
52

53
        // JSClusterServerNotMemberErr server is not a member of the cluster
54
        JSClusterServerNotMemberErr ErrorIdentifier = 10044
55

56
        // JSClusterTagsErr tags placement not supported for operation
57
        JSClusterTagsErr ErrorIdentifier = 10011
58

59
        // JSClusterUnSupportFeatureErr not currently supported in clustered mode
60
        JSClusterUnSupportFeatureErr ErrorIdentifier = 10036
61

62
        // JSConsumerAckPolicyInvalidErr consumer ack policy invalid
63
        JSConsumerAckPolicyInvalidErr ErrorIdentifier = 10181
64

65
        // JSConsumerAckWaitNegativeErr consumer ack wait needs to be positive
66
        JSConsumerAckWaitNegativeErr ErrorIdentifier = 10183
67

68
        // JSConsumerAlreadyExists action CREATE is used for a existing consumer with a different config (consumer already exists)
69
        JSConsumerAlreadyExists ErrorIdentifier = 10148
70

71
        // JSConsumerBackOffNegativeErr consumer backoff needs to be positive
72
        JSConsumerBackOffNegativeErr ErrorIdentifier = 10184
73

74
        // JSConsumerBadDurableNameErr durable name can not contain '.', '*', '>'
75
        JSConsumerBadDurableNameErr ErrorIdentifier = 10103
76

77
        // JSConsumerConfigRequiredErr consumer config required
78
        JSConsumerConfigRequiredErr ErrorIdentifier = 10078
79

80
        // JSConsumerCreateDurableAndNameMismatch Consumer Durable and Name have to be equal if both are provided
81
        JSConsumerCreateDurableAndNameMismatch ErrorIdentifier = 10132
82

83
        // JSConsumerCreateErrF General consumer creation failure string ({err})
84
        JSConsumerCreateErrF ErrorIdentifier = 10012
85

86
        // JSConsumerCreateFilterSubjectMismatchErr Consumer create request did not match filtered subject from create subject
87
        JSConsumerCreateFilterSubjectMismatchErr ErrorIdentifier = 10131
88

89
        // JSConsumerDeliverCycleErr consumer deliver subject forms a cycle
90
        JSConsumerDeliverCycleErr ErrorIdentifier = 10081
91

92
        // JSConsumerDeliverToWildcardsErr consumer deliver subject has wildcards
93
        JSConsumerDeliverToWildcardsErr ErrorIdentifier = 10079
94

95
        // JSConsumerDescriptionTooLongErrF consumer description is too long, maximum allowed is {max}
96
        JSConsumerDescriptionTooLongErrF ErrorIdentifier = 10107
97

98
        // JSConsumerDirectRequiresEphemeralErr consumer direct requires an ephemeral consumer
99
        JSConsumerDirectRequiresEphemeralErr ErrorIdentifier = 10091
100

101
        // JSConsumerDirectRequiresPushErr consumer direct requires a push based consumer
102
        JSConsumerDirectRequiresPushErr ErrorIdentifier = 10090
103

104
        // JSConsumerDoesNotExist action UPDATE is used for a nonexisting consumer (consumer does not exist)
105
        JSConsumerDoesNotExist ErrorIdentifier = 10149
106

107
        // JSConsumerDuplicateFilterSubjects consumer cannot have both FilterSubject and FilterSubjects specified
108
        JSConsumerDuplicateFilterSubjects ErrorIdentifier = 10136
109

110
        // JSConsumerDurableNameNotInSubjectErr consumer expected to be durable but no durable name set in subject
111
        JSConsumerDurableNameNotInSubjectErr ErrorIdentifier = 10016
112

113
        // JSConsumerDurableNameNotMatchSubjectErr consumer name in subject does not match durable name in request
114
        JSConsumerDurableNameNotMatchSubjectErr ErrorIdentifier = 10017
115

116
        // JSConsumerDurableNameNotSetErr consumer expected to be durable but a durable name was not set
117
        JSConsumerDurableNameNotSetErr ErrorIdentifier = 10018
118

119
        // JSConsumerEmptyFilter consumer filter in FilterSubjects cannot be empty
120
        JSConsumerEmptyFilter ErrorIdentifier = 10139
121

122
        // JSConsumerEmptyGroupName Group name cannot be an empty string
123
        JSConsumerEmptyGroupName ErrorIdentifier = 10161
124

125
        // JSConsumerEphemeralWithDurableInSubjectErr consumer expected to be ephemeral but detected a durable name set in subject
126
        JSConsumerEphemeralWithDurableInSubjectErr ErrorIdentifier = 10019
127

128
        // JSConsumerEphemeralWithDurableNameErr consumer expected to be ephemeral but a durable name was set in request
129
        JSConsumerEphemeralWithDurableNameErr ErrorIdentifier = 10020
130

131
        // JSConsumerExistingActiveErr consumer already exists and is still active
132
        JSConsumerExistingActiveErr ErrorIdentifier = 10105
133

134
        // JSConsumerFCRequiresPushErr consumer flow control requires a push based consumer
135
        JSConsumerFCRequiresPushErr ErrorIdentifier = 10089
136

137
        // JSConsumerFilterNotSubsetErr consumer filter subject is not a valid subset of the interest subjects
138
        JSConsumerFilterNotSubsetErr ErrorIdentifier = 10093
139

140
        // JSConsumerHBRequiresPushErr consumer idle heartbeat requires a push based consumer
141
        JSConsumerHBRequiresPushErr ErrorIdentifier = 10088
142

143
        // JSConsumerInactiveThresholdExcess consumer inactive threshold exceeds system limit of {limit}
144
        JSConsumerInactiveThresholdExcess ErrorIdentifier = 10153
145

146
        // JSConsumerInvalidDeliverSubject invalid push consumer deliver subject
147
        JSConsumerInvalidDeliverSubject ErrorIdentifier = 10112
148

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

152
        // JSConsumerInvalidPolicyErrF Generic delivery policy error ({err})
153
        JSConsumerInvalidPolicyErrF ErrorIdentifier = 10094
154

155
        // JSConsumerInvalidPriorityGroupErr Provided priority group does not exist for this consumer
156
        JSConsumerInvalidPriorityGroupErr ErrorIdentifier = 10160
157

158
        // JSConsumerInvalidSamplingErrF failed to parse consumer sampling configuration: {err}
159
        JSConsumerInvalidSamplingErrF ErrorIdentifier = 10095
160

161
        // JSConsumerMaxDeliverBackoffErr max deliver is required to be > length of backoff values
162
        JSConsumerMaxDeliverBackoffErr ErrorIdentifier = 10116
163

164
        // JSConsumerMaxPendingAckExcessErrF consumer max ack pending exceeds system limit of {limit}
165
        JSConsumerMaxPendingAckExcessErrF ErrorIdentifier = 10121
166

167
        // JSConsumerMaxPendingAckPolicyRequiredErr consumer requires ack policy for max ack pending
168
        JSConsumerMaxPendingAckPolicyRequiredErr ErrorIdentifier = 10082
169

170
        // JSConsumerMaxRequestBatchExceededF consumer max request batch exceeds server limit of {limit}
171
        JSConsumerMaxRequestBatchExceededF ErrorIdentifier = 10125
172

173
        // JSConsumerMaxRequestBatchNegativeErr consumer max request batch needs to be > 0
174
        JSConsumerMaxRequestBatchNegativeErr ErrorIdentifier = 10114
175

176
        // JSConsumerMaxRequestExpiresTooSmall consumer max request expires needs to be >= 1ms
177
        JSConsumerMaxRequestExpiresTooSmall ErrorIdentifier = 10115
178

179
        // JSConsumerMaxWaitingNegativeErr consumer max waiting needs to be positive
180
        JSConsumerMaxWaitingNegativeErr ErrorIdentifier = 10087
181

182
        // JSConsumerMetadataLengthErrF consumer metadata exceeds maximum size of {limit}
183
        JSConsumerMetadataLengthErrF ErrorIdentifier = 10135
184

185
        // JSConsumerMultipleFiltersNotAllowed consumer with multiple subject filters cannot use subject based API
186
        JSConsumerMultipleFiltersNotAllowed ErrorIdentifier = 10137
187

188
        // JSConsumerNameContainsPathSeparatorsErr Consumer name can not contain path separators
189
        JSConsumerNameContainsPathSeparatorsErr ErrorIdentifier = 10127
190

191
        // JSConsumerNameExistErr consumer name already in use
192
        JSConsumerNameExistErr ErrorIdentifier = 10013
193

194
        // JSConsumerNameTooLongErrF consumer name is too long, maximum allowed is {max}
195
        JSConsumerNameTooLongErrF ErrorIdentifier = 10102
196

197
        // JSConsumerNotFoundErr consumer not found
198
        JSConsumerNotFoundErr ErrorIdentifier = 10014
199

200
        // JSConsumerOfflineErr consumer is offline
201
        JSConsumerOfflineErr ErrorIdentifier = 10119
202

203
        // JSConsumerOfflineReasonErrF consumer is offline: {err}
204
        JSConsumerOfflineReasonErrF ErrorIdentifier = 10195
205

206
        // JSConsumerOnMappedErr consumer direct on a mapped consumer
207
        JSConsumerOnMappedErr ErrorIdentifier = 10092
208

209
        // JSConsumerOverlappingSubjectFilters consumer subject filters cannot overlap
210
        JSConsumerOverlappingSubjectFilters ErrorIdentifier = 10138
211

212
        // JSConsumerPriorityPolicyWithoutGroup Setting PriorityPolicy requires at least one PriorityGroup to be set
213
        JSConsumerPriorityPolicyWithoutGroup ErrorIdentifier = 10159
214

215
        // JSConsumerPullNotDurableErr consumer in pull mode requires a durable name
216
        JSConsumerPullNotDurableErr ErrorIdentifier = 10085
217

218
        // JSConsumerPullRequiresAckErr consumer in pull mode requires explicit ack policy on workqueue stream
219
        JSConsumerPullRequiresAckErr ErrorIdentifier = 10084
220

221
        // JSConsumerPullWithRateLimitErr consumer in pull mode can not have rate limit set
222
        JSConsumerPullWithRateLimitErr ErrorIdentifier = 10086
223

224
        // JSConsumerPushMaxWaitingErr consumer in push mode can not set max waiting
225
        JSConsumerPushMaxWaitingErr ErrorIdentifier = 10080
226

227
        // JSConsumerPushWithPriorityGroupErr priority groups can not be used with push consumers
228
        JSConsumerPushWithPriorityGroupErr ErrorIdentifier = 10178
229

230
        // JSConsumerReplacementWithDifferentNameErr consumer replacement durable config not the same
231
        JSConsumerReplacementWithDifferentNameErr ErrorIdentifier = 10106
232

233
        // JSConsumerReplayPolicyInvalidErr consumer replay policy invalid
234
        JSConsumerReplayPolicyInvalidErr ErrorIdentifier = 10182
235

236
        // JSConsumerReplicasExceedsStream consumer config replica count exceeds parent stream
237
        JSConsumerReplicasExceedsStream ErrorIdentifier = 10126
238

239
        // JSConsumerReplicasShouldMatchStream consumer config replicas must match interest retention stream's replicas
240
        JSConsumerReplicasShouldMatchStream ErrorIdentifier = 10134
241

242
        // JSConsumerSmallHeartbeatErr consumer idle heartbeat needs to be >= 100ms
243
        JSConsumerSmallHeartbeatErr ErrorIdentifier = 10083
244

245
        // JSConsumerStoreFailedErrF error creating store for consumer: {err}
246
        JSConsumerStoreFailedErrF ErrorIdentifier = 10104
247

248
        // JSConsumerWQConsumerNotDeliverAllErr consumer must be deliver all on workqueue stream
249
        JSConsumerWQConsumerNotDeliverAllErr ErrorIdentifier = 10101
250

251
        // JSConsumerWQConsumerNotUniqueErr filtered consumer not unique on workqueue stream
252
        JSConsumerWQConsumerNotUniqueErr ErrorIdentifier = 10100
253

254
        // JSConsumerWQMultipleUnfilteredErr multiple non-filtered consumers not allowed on workqueue stream
255
        JSConsumerWQMultipleUnfilteredErr ErrorIdentifier = 10099
256

257
        // JSConsumerWQRequiresExplicitAckErr workqueue stream requires explicit ack
258
        JSConsumerWQRequiresExplicitAckErr ErrorIdentifier = 10098
259

260
        // JSConsumerWithFlowControlNeedsHeartbeats consumer with flow control also needs heartbeats
261
        JSConsumerWithFlowControlNeedsHeartbeats ErrorIdentifier = 10108
262

263
        // JSInsufficientResourcesErr insufficient resources
264
        JSInsufficientResourcesErr ErrorIdentifier = 10023
265

266
        // JSInvalidJSONErr invalid JSON: {err}
267
        JSInvalidJSONErr ErrorIdentifier = 10025
268

269
        // JSMaximumConsumersLimitErr maximum consumers limit reached
270
        JSMaximumConsumersLimitErr ErrorIdentifier = 10026
271

272
        // JSMaximumStreamsLimitErr maximum number of streams reached
273
        JSMaximumStreamsLimitErr ErrorIdentifier = 10027
274

275
        // JSMemoryResourcesExceededErr insufficient memory resources available
276
        JSMemoryResourcesExceededErr ErrorIdentifier = 10028
277

278
        // JSMessageCounterBrokenErr message counter is broken
279
        JSMessageCounterBrokenErr ErrorIdentifier = 10172
280

281
        // JSMessageIncrDisabledErr message counters is disabled
282
        JSMessageIncrDisabledErr ErrorIdentifier = 10168
283

284
        // JSMessageIncrInvalidErr message counter increment is invalid
285
        JSMessageIncrInvalidErr ErrorIdentifier = 10171
286

287
        // JSMessageIncrMissingErr message counter increment is missing
288
        JSMessageIncrMissingErr ErrorIdentifier = 10169
289

290
        // JSMessageIncrPayloadErr message counter has payload
291
        JSMessageIncrPayloadErr ErrorIdentifier = 10170
292

293
        // JSMessageSchedulesDisabledErr message schedules is disabled
294
        JSMessageSchedulesDisabledErr ErrorIdentifier = 10188
295

296
        // JSMessageSchedulesPatternInvalidErr message schedules pattern is invalid
297
        JSMessageSchedulesPatternInvalidErr ErrorIdentifier = 10189
298

299
        // JSMessageSchedulesRollupInvalidErr message schedules invalid rollup
300
        JSMessageSchedulesRollupInvalidErr ErrorIdentifier = 10192
301

302
        // JSMessageSchedulesTTLInvalidErr message schedules invalid per-message TTL
303
        JSMessageSchedulesTTLInvalidErr ErrorIdentifier = 10191
304

305
        // JSMessageSchedulesTargetInvalidErr message schedules target is invalid
306
        JSMessageSchedulesTargetInvalidErr ErrorIdentifier = 10190
307

308
        // JSMessageTTLDisabledErr per-message TTL is disabled
309
        JSMessageTTLDisabledErr ErrorIdentifier = 10166
310

311
        // JSMessageTTLInvalidErr invalid per-message TTL
312
        JSMessageTTLInvalidErr ErrorIdentifier = 10165
313

314
        // JSMirrorConsumerSetupFailedErrF generic mirror consumer setup failure string ({err})
315
        JSMirrorConsumerSetupFailedErrF ErrorIdentifier = 10029
316

317
        // JSMirrorInvalidStreamName mirrored stream name is invalid
318
        JSMirrorInvalidStreamName ErrorIdentifier = 10142
319

320
        // JSMirrorInvalidSubjectFilter mirror transform source: {err}
321
        JSMirrorInvalidSubjectFilter ErrorIdentifier = 10151
322

323
        // JSMirrorInvalidTransformDestination mirror transform: {err}
324
        JSMirrorInvalidTransformDestination ErrorIdentifier = 10154
325

326
        // JSMirrorMaxMessageSizeTooBigErr stream mirror must have max message size >= source
327
        JSMirrorMaxMessageSizeTooBigErr ErrorIdentifier = 10030
328

329
        // JSMirrorMultipleFiltersNotAllowed mirror with multiple subject transforms cannot also have a single subject filter
330
        JSMirrorMultipleFiltersNotAllowed ErrorIdentifier = 10150
331

332
        // JSMirrorOverlappingSubjectFilters mirror subject filters can not overlap
333
        JSMirrorOverlappingSubjectFilters ErrorIdentifier = 10152
334

335
        // JSMirrorWithCountersErr stream mirrors can not also calculate counters
336
        JSMirrorWithCountersErr ErrorIdentifier = 10173
337

338
        // JSMirrorWithFirstSeqErr stream mirrors can not have first sequence configured
339
        JSMirrorWithFirstSeqErr ErrorIdentifier = 10143
340

341
        // JSMirrorWithMsgSchedulesErr stream mirrors can not also schedule messages
342
        JSMirrorWithMsgSchedulesErr ErrorIdentifier = 10186
343

344
        // JSMirrorWithSourcesErr stream mirrors can not also contain other sources
345
        JSMirrorWithSourcesErr ErrorIdentifier = 10031
346

347
        // JSMirrorWithStartSeqAndTimeErr stream mirrors can not have both start seq and start time configured
348
        JSMirrorWithStartSeqAndTimeErr ErrorIdentifier = 10032
349

350
        // JSMirrorWithSubjectFiltersErr stream mirrors can not contain filtered subjects
351
        JSMirrorWithSubjectFiltersErr ErrorIdentifier = 10033
352

353
        // JSMirrorWithSubjectsErr stream mirrors can not contain subjects
354
        JSMirrorWithSubjectsErr ErrorIdentifier = 10034
355

356
        // JSNoAccountErr account not found
357
        JSNoAccountErr ErrorIdentifier = 10035
358

359
        // JSNoLimitsErr no JetStream default or applicable tiered limit present
360
        JSNoLimitsErr ErrorIdentifier = 10120
361

362
        // JSNoMessageFoundErr no message found
363
        JSNoMessageFoundErr ErrorIdentifier = 10037
364

365
        // JSNotEmptyRequestErr expected an empty request payload
366
        JSNotEmptyRequestErr ErrorIdentifier = 10038
367

368
        // JSNotEnabledErr JetStream not enabled
369
        JSNotEnabledErr ErrorIdentifier = 10076
370

371
        // JSNotEnabledForAccountErr JetStream not enabled for account
372
        JSNotEnabledForAccountErr ErrorIdentifier = 10039
373

374
        // JSPedanticErrF pedantic mode: {err}
375
        JSPedanticErrF ErrorIdentifier = 10157
376

377
        // JSPeerRemapErr peer remap failed
378
        JSPeerRemapErr ErrorIdentifier = 10075
379

380
        // JSRaftGeneralErrF General RAFT error string ({err})
381
        JSRaftGeneralErrF ErrorIdentifier = 10041
382

383
        // JSReplicasCountCannotBeNegative replicas count cannot be negative
384
        JSReplicasCountCannotBeNegative ErrorIdentifier = 10133
385

386
        // JSRequiredApiLevelErr JetStream minimum api level required
387
        JSRequiredApiLevelErr ErrorIdentifier = 10185
388

389
        // JSRestoreSubscribeFailedErrF JetStream unable to subscribe to restore snapshot {subject}: {err}
390
        JSRestoreSubscribeFailedErrF ErrorIdentifier = 10042
391

392
        // JSSequenceNotFoundErrF sequence {seq} not found
393
        JSSequenceNotFoundErrF ErrorIdentifier = 10043
394

395
        // JSSnapshotDeliverSubjectInvalidErr deliver subject not valid
396
        JSSnapshotDeliverSubjectInvalidErr ErrorIdentifier = 10015
397

398
        // JSSourceConsumerSetupFailedErrF General source consumer setup failure string ({err})
399
        JSSourceConsumerSetupFailedErrF ErrorIdentifier = 10045
400

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

404
        // JSSourceInvalidStreamName sourced stream name is invalid
405
        JSSourceInvalidStreamName ErrorIdentifier = 10141
406

407
        // JSSourceInvalidSubjectFilter source transform source: {err}
408
        JSSourceInvalidSubjectFilter ErrorIdentifier = 10145
409

410
        // JSSourceInvalidTransformDestination source transform: {err}
411
        JSSourceInvalidTransformDestination ErrorIdentifier = 10146
412

413
        // JSSourceMaxMessageSizeTooBigErr stream source must have max message size >= target
414
        JSSourceMaxMessageSizeTooBigErr ErrorIdentifier = 10046
415

416
        // JSSourceMultipleFiltersNotAllowed source with multiple subject transforms cannot also have a single subject filter
417
        JSSourceMultipleFiltersNotAllowed ErrorIdentifier = 10144
418

419
        // JSSourceOverlappingSubjectFilters source filters can not overlap
420
        JSSourceOverlappingSubjectFilters ErrorIdentifier = 10147
421

422
        // JSSourceWithMsgSchedulesErr stream source can not also schedule messages
423
        JSSourceWithMsgSchedulesErr ErrorIdentifier = 10187
424

425
        // JSStorageResourcesExceededErr insufficient storage resources available
426
        JSStorageResourcesExceededErr ErrorIdentifier = 10047
427

428
        // JSStreamAssignmentErrF Generic stream assignment error string ({err})
429
        JSStreamAssignmentErrF ErrorIdentifier = 10048
430

431
        // JSStreamCreateErrF Generic stream creation error string ({err})
432
        JSStreamCreateErrF ErrorIdentifier = 10049
433

434
        // JSStreamDeleteErrF General stream deletion error string ({err})
435
        JSStreamDeleteErrF ErrorIdentifier = 10050
436

437
        // JSStreamDuplicateMessageConflict duplicate message id is in process
438
        JSStreamDuplicateMessageConflict ErrorIdentifier = 10158
439

440
        // JSStreamExpectedLastSeqPerSubjectInvalid missing sequence for expected last sequence per subject
441
        JSStreamExpectedLastSeqPerSubjectInvalid ErrorIdentifier = 10193
442

443
        // JSStreamExpectedLastSeqPerSubjectNotReady expected last sequence per subject temporarily unavailable
444
        JSStreamExpectedLastSeqPerSubjectNotReady ErrorIdentifier = 10163
445

446
        // JSStreamExternalApiOverlapErrF stream external api prefix {prefix} must not overlap with {subject}
447
        JSStreamExternalApiOverlapErrF ErrorIdentifier = 10021
448

449
        // JSStreamExternalDelPrefixOverlapsErrF stream external delivery prefix {prefix} overlaps with stream subject {subject}
450
        JSStreamExternalDelPrefixOverlapsErrF ErrorIdentifier = 10022
451

452
        // JSStreamGeneralErrorF General stream failure string ({err})
453
        JSStreamGeneralErrorF ErrorIdentifier = 10051
454

455
        // JSStreamHeaderExceedsMaximumErr header size exceeds maximum allowed of 64k
456
        JSStreamHeaderExceedsMaximumErr ErrorIdentifier = 10097
457

458
        // JSStreamInfoMaxSubjectsErr subject details would exceed maximum allowed
459
        JSStreamInfoMaxSubjectsErr ErrorIdentifier = 10117
460

461
        // JSStreamInvalidConfigF Stream configuration validation error string ({err})
462
        JSStreamInvalidConfigF ErrorIdentifier = 10052
463

464
        // JSStreamInvalidErr stream not valid
465
        JSStreamInvalidErr ErrorIdentifier = 10096
466

467
        // JSStreamInvalidExternalDeliverySubjErrF stream external delivery prefix {prefix} must not contain wildcards
468
        JSStreamInvalidExternalDeliverySubjErrF ErrorIdentifier = 10024
469

470
        // JSStreamLimitsErrF General stream limits exceeded error string ({err})
471
        JSStreamLimitsErrF ErrorIdentifier = 10053
472

473
        // JSStreamMaxBytesRequired account requires a stream config to have max bytes set
474
        JSStreamMaxBytesRequired ErrorIdentifier = 10113
475

476
        // JSStreamMaxStreamBytesExceeded stream max bytes exceeds account limit max stream bytes
477
        JSStreamMaxStreamBytesExceeded ErrorIdentifier = 10122
478

479
        // JSStreamMessageExceedsMaximumErr message size exceeds maximum allowed
480
        JSStreamMessageExceedsMaximumErr ErrorIdentifier = 10054
481

482
        // JSStreamMinLastSeqErr min last sequence
483
        JSStreamMinLastSeqErr ErrorIdentifier = 10180
484

485
        // JSStreamMirrorNotUpdatableErr stream mirror configuration can not be updated
486
        JSStreamMirrorNotUpdatableErr ErrorIdentifier = 10055
487

488
        // JSStreamMismatchErr stream name in subject does not match request
489
        JSStreamMismatchErr ErrorIdentifier = 10056
490

491
        // JSStreamMoveAndScaleErr can not move and scale a stream in a single update
492
        JSStreamMoveAndScaleErr ErrorIdentifier = 10123
493

494
        // JSStreamMoveInProgressF stream move already in progress: {msg}
495
        JSStreamMoveInProgressF ErrorIdentifier = 10124
496

497
        // JSStreamMoveNotInProgress stream move not in progress
498
        JSStreamMoveNotInProgress ErrorIdentifier = 10129
499

500
        // JSStreamMsgDeleteFailedF Generic message deletion failure error string ({err})
501
        JSStreamMsgDeleteFailedF ErrorIdentifier = 10057
502

503
        // JSStreamNameContainsPathSeparatorsErr Stream name can not contain path separators
504
        JSStreamNameContainsPathSeparatorsErr ErrorIdentifier = 10128
505

506
        // JSStreamNameExistErr stream name already in use with a different configuration
507
        JSStreamNameExistErr ErrorIdentifier = 10058
508

509
        // JSStreamNameExistRestoreFailedErr stream name already in use, cannot restore
510
        JSStreamNameExistRestoreFailedErr ErrorIdentifier = 10130
511

512
        // JSStreamNotFoundErr stream not found
513
        JSStreamNotFoundErr ErrorIdentifier = 10059
514

515
        // JSStreamNotMatchErr expected stream does not match
516
        JSStreamNotMatchErr ErrorIdentifier = 10060
517

518
        // JSStreamOfflineErr stream is offline
519
        JSStreamOfflineErr ErrorIdentifier = 10118
520

521
        // JSStreamOfflineReasonErrF stream is offline: {err}
522
        JSStreamOfflineReasonErrF ErrorIdentifier = 10194
523

524
        // JSStreamPurgeFailedF Generic stream purge failure error string ({err})
525
        JSStreamPurgeFailedF ErrorIdentifier = 10110
526

527
        // JSStreamReplicasNotSupportedErr replicas > 1 not supported in non-clustered mode
528
        JSStreamReplicasNotSupportedErr ErrorIdentifier = 10074
529

530
        // JSStreamReplicasNotUpdatableErr Replicas configuration can not be updated
531
        JSStreamReplicasNotUpdatableErr ErrorIdentifier = 10061
532

533
        // JSStreamRestoreErrF restore failed: {err}
534
        JSStreamRestoreErrF ErrorIdentifier = 10062
535

536
        // JSStreamRollupFailedF Generic stream rollup failure error string ({err})
537
        JSStreamRollupFailedF ErrorIdentifier = 10111
538

539
        // JSStreamSealedErr invalid operation on sealed stream
540
        JSStreamSealedErr ErrorIdentifier = 10109
541

542
        // JSStreamSequenceNotMatchErr expected stream sequence does not match
543
        JSStreamSequenceNotMatchErr ErrorIdentifier = 10063
544

545
        // JSStreamSnapshotErrF snapshot failed: {err}
546
        JSStreamSnapshotErrF ErrorIdentifier = 10064
547

548
        // JSStreamStoreFailedF Generic error when storing a message failed ({err})
549
        JSStreamStoreFailedF ErrorIdentifier = 10077
550

551
        // JSStreamSubjectOverlapErr subjects overlap with an existing stream
552
        JSStreamSubjectOverlapErr ErrorIdentifier = 10065
553

554
        // JSStreamTemplateCreateErrF Generic template creation failed string ({err})
555
        JSStreamTemplateCreateErrF ErrorIdentifier = 10066
556

557
        // JSStreamTemplateDeleteErrF Generic stream template deletion failed error string ({err})
558
        JSStreamTemplateDeleteErrF ErrorIdentifier = 10067
559

560
        // JSStreamTemplateNotFoundErr template not found
561
        JSStreamTemplateNotFoundErr ErrorIdentifier = 10068
562

563
        // JSStreamTooManyRequests too many requests
564
        JSStreamTooManyRequests ErrorIdentifier = 10167
565

566
        // JSStreamTransformInvalidDestination stream transform: {err}
567
        JSStreamTransformInvalidDestination ErrorIdentifier = 10156
568

569
        // JSStreamTransformInvalidSource stream transform source: {err}
570
        JSStreamTransformInvalidSource ErrorIdentifier = 10155
571

572
        // JSStreamUpdateErrF Generic stream update error string ({err})
573
        JSStreamUpdateErrF ErrorIdentifier = 10069
574

575
        // JSStreamWrongLastMsgIDErrF wrong last msg ID: {id}
576
        JSStreamWrongLastMsgIDErrF ErrorIdentifier = 10070
577

578
        // JSStreamWrongLastSequenceConstantErr wrong last sequence
579
        JSStreamWrongLastSequenceConstantErr ErrorIdentifier = 10164
580

581
        // JSStreamWrongLastSequenceErrF wrong last sequence: {seq}
582
        JSStreamWrongLastSequenceErrF ErrorIdentifier = 10071
583

584
        // JSTempStorageFailedErr JetStream unable to open temp storage for restore
585
        JSTempStorageFailedErr ErrorIdentifier = 10072
586

587
        // JSTemplateNameNotMatchSubjectErr template name in subject does not match request
588
        JSTemplateNameNotMatchSubjectErr ErrorIdentifier = 10073
589
)
590

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

812
// NewJSAccountResourcesExceededError creates a new JSAccountResourcesExceededErr error: "resource limits exceeded for account"
813
func NewJSAccountResourcesExceededError(opts ...ErrorOption) *ApiError {
20,061✔
814
        eopts := parseOpts(opts)
20,061✔
815
        if ae, ok := eopts.err.(*ApiError); ok {
20,061✔
816
                return ae
×
817
        }
×
818

819
        return ApiErrors[JSAccountResourcesExceededErr]
20,061✔
820
}
821

822
// NewJSAtomicPublishDisabledError creates a new JSAtomicPublishDisabledErr error: "atomic publish is disabled"
823
func NewJSAtomicPublishDisabledError(opts ...ErrorOption) *ApiError {
24✔
824
        eopts := parseOpts(opts)
24✔
825
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
826
                return ae
×
827
        }
×
828

829
        return ApiErrors[JSAtomicPublishDisabledErr]
24✔
830
}
831

832
// NewJSAtomicPublishIncompleteBatchError creates a new JSAtomicPublishIncompleteBatchErr error: "atomic publish batch is incomplete"
833
func NewJSAtomicPublishIncompleteBatchError(opts ...ErrorOption) *ApiError {
64✔
834
        eopts := parseOpts(opts)
64✔
835
        if ae, ok := eopts.err.(*ApiError); ok {
64✔
836
                return ae
×
837
        }
×
838

839
        return ApiErrors[JSAtomicPublishIncompleteBatchErr]
64✔
840
}
841

842
// NewJSAtomicPublishInvalidBatchIDError creates a new JSAtomicPublishInvalidBatchIDErr error: "atomic publish batch ID is invalid"
843
func NewJSAtomicPublishInvalidBatchIDError(opts ...ErrorOption) *ApiError {
4✔
844
        eopts := parseOpts(opts)
4✔
845
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
846
                return ae
×
847
        }
×
848

849
        return ApiErrors[JSAtomicPublishInvalidBatchIDErr]
4✔
850
}
851

852
// NewJSAtomicPublishMissingSeqError creates a new JSAtomicPublishMissingSeqErr error: "atomic publish sequence is missing"
853
func NewJSAtomicPublishMissingSeqError(opts ...ErrorOption) *ApiError {
24✔
854
        eopts := parseOpts(opts)
24✔
855
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
856
                return ae
×
857
        }
×
858

859
        return ApiErrors[JSAtomicPublishMissingSeqErr]
24✔
860
}
861

862
// NewJSAtomicPublishUnsupportedHeaderBatchError creates a new JSAtomicPublishUnsupportedHeaderBatchErr error: "atomic publish unsupported header used: {header}"
863
func NewJSAtomicPublishUnsupportedHeaderBatchError(header interface{}, opts ...ErrorOption) *ApiError {
32✔
864
        eopts := parseOpts(opts)
32✔
865
        if ae, ok := eopts.err.(*ApiError); ok {
32✔
866
                return ae
×
867
        }
×
868

869
        e := ApiErrors[JSAtomicPublishUnsupportedHeaderBatchErr]
32✔
870
        args := e.toReplacerArgs([]interface{}{"{header}", header})
32✔
871
        return &ApiError{
32✔
872
                Code:        e.Code,
32✔
873
                ErrCode:     e.ErrCode,
32✔
874
                Description: strings.NewReplacer(args...).Replace(e.Description),
32✔
875
        }
32✔
876
}
877

878
// NewJSBadRequestError creates a new JSBadRequestErr error: "bad request"
879
func NewJSBadRequestError(opts ...ErrorOption) *ApiError {
10✔
880
        eopts := parseOpts(opts)
10✔
881
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
882
                return ae
×
883
        }
×
884

885
        return ApiErrors[JSBadRequestErr]
10✔
886
}
887

888
// NewJSClusterIncompleteError creates a new JSClusterIncompleteErr error: "incomplete results"
889
func NewJSClusterIncompleteError(opts ...ErrorOption) *ApiError {
×
890
        eopts := parseOpts(opts)
×
891
        if ae, ok := eopts.err.(*ApiError); ok {
×
892
                return ae
×
893
        }
×
894

895
        return ApiErrors[JSClusterIncompleteErr]
×
896
}
897

898
// NewJSClusterNoPeersError creates a new JSClusterNoPeersErrF error: "{err}"
899
func NewJSClusterNoPeersError(err error, opts ...ErrorOption) *ApiError {
58✔
900
        eopts := parseOpts(opts)
58✔
901
        if ae, ok := eopts.err.(*ApiError); ok {
58✔
902
                return ae
×
903
        }
×
904

905
        e := ApiErrors[JSClusterNoPeersErrF]
58✔
906
        args := e.toReplacerArgs([]interface{}{"{err}", err})
58✔
907
        return &ApiError{
58✔
908
                Code:        e.Code,
58✔
909
                ErrCode:     e.ErrCode,
58✔
910
                Description: strings.NewReplacer(args...).Replace(e.Description),
58✔
911
        }
58✔
912
}
913

914
// NewJSClusterNotActiveError creates a new JSClusterNotActiveErr error: "JetStream not in clustered mode"
915
func NewJSClusterNotActiveError(opts ...ErrorOption) *ApiError {
1✔
916
        eopts := parseOpts(opts)
1✔
917
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
918
                return ae
×
919
        }
×
920

921
        return ApiErrors[JSClusterNotActiveErr]
1✔
922
}
923

924
// NewJSClusterNotAssignedError creates a new JSClusterNotAssignedErr error: "JetStream cluster not assigned to this server"
925
func NewJSClusterNotAssignedError(opts ...ErrorOption) *ApiError {
34✔
926
        eopts := parseOpts(opts)
34✔
927
        if ae, ok := eopts.err.(*ApiError); ok {
34✔
928
                return ae
×
929
        }
×
930

931
        return ApiErrors[JSClusterNotAssignedErr]
34✔
932
}
933

934
// NewJSClusterNotAvailError creates a new JSClusterNotAvailErr error: "JetStream system temporarily unavailable"
935
func NewJSClusterNotAvailError(opts ...ErrorOption) *ApiError {
12✔
936
        eopts := parseOpts(opts)
12✔
937
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
938
                return ae
×
939
        }
×
940

941
        return ApiErrors[JSClusterNotAvailErr]
12✔
942
}
943

944
// NewJSClusterNotLeaderError creates a new JSClusterNotLeaderErr error: "JetStream cluster can not handle request"
945
func NewJSClusterNotLeaderError(opts ...ErrorOption) *ApiError {
7✔
946
        eopts := parseOpts(opts)
7✔
947
        if ae, ok := eopts.err.(*ApiError); ok {
7✔
948
                return ae
×
949
        }
×
950

951
        return ApiErrors[JSClusterNotLeaderErr]
7✔
952
}
953

954
// NewJSClusterPeerNotMemberError creates a new JSClusterPeerNotMemberErr error: "peer not a member"
955
func NewJSClusterPeerNotMemberError(opts ...ErrorOption) *ApiError {
1✔
956
        eopts := parseOpts(opts)
1✔
957
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
958
                return ae
×
959
        }
×
960

961
        return ApiErrors[JSClusterPeerNotMemberErr]
1✔
962
}
963

964
// NewJSClusterRequiredError creates a new JSClusterRequiredErr error: "JetStream clustering support required"
965
func NewJSClusterRequiredError(opts ...ErrorOption) *ApiError {
×
966
        eopts := parseOpts(opts)
×
967
        if ae, ok := eopts.err.(*ApiError); ok {
×
968
                return ae
×
969
        }
×
970

971
        return ApiErrors[JSClusterRequiredErr]
×
972
}
973

974
// NewJSClusterServerNotMemberError creates a new JSClusterServerNotMemberErr error: "server is not a member of the cluster"
975
func NewJSClusterServerNotMemberError(opts ...ErrorOption) *ApiError {
3✔
976
        eopts := parseOpts(opts)
3✔
977
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
978
                return ae
×
979
        }
×
980

981
        return ApiErrors[JSClusterServerNotMemberErr]
3✔
982
}
983

984
// NewJSClusterTagsError creates a new JSClusterTagsErr error: "tags placement not supported for operation"
985
func NewJSClusterTagsError(opts ...ErrorOption) *ApiError {
×
986
        eopts := parseOpts(opts)
×
987
        if ae, ok := eopts.err.(*ApiError); ok {
×
988
                return ae
×
989
        }
×
990

991
        return ApiErrors[JSClusterTagsErr]
×
992
}
993

994
// NewJSClusterUnSupportFeatureError creates a new JSClusterUnSupportFeatureErr error: "not currently supported in clustered mode"
995
func NewJSClusterUnSupportFeatureError(opts ...ErrorOption) *ApiError {
6✔
996
        eopts := parseOpts(opts)
6✔
997
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
998
                return ae
×
999
        }
×
1000

1001
        return ApiErrors[JSClusterUnSupportFeatureErr]
6✔
1002
}
1003

1004
// NewJSConsumerAckPolicyInvalidError creates a new JSConsumerAckPolicyInvalidErr error: "consumer ack policy invalid"
1005
func NewJSConsumerAckPolicyInvalidError(opts ...ErrorOption) *ApiError {
2✔
1006
        eopts := parseOpts(opts)
2✔
1007
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1008
                return ae
×
1009
        }
×
1010

1011
        return ApiErrors[JSConsumerAckPolicyInvalidErr]
2✔
1012
}
1013

1014
// NewJSConsumerAckWaitNegativeError creates a new JSConsumerAckWaitNegativeErr error: "consumer ack wait needs to be positive"
1015
func NewJSConsumerAckWaitNegativeError(opts ...ErrorOption) *ApiError {
2✔
1016
        eopts := parseOpts(opts)
2✔
1017
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1018
                return ae
×
1019
        }
×
1020

1021
        return ApiErrors[JSConsumerAckWaitNegativeErr]
2✔
1022
}
1023

1024
// NewJSConsumerAlreadyExistsError creates a new JSConsumerAlreadyExists error: "consumer already exists"
1025
func NewJSConsumerAlreadyExistsError(opts ...ErrorOption) *ApiError {
5✔
1026
        eopts := parseOpts(opts)
5✔
1027
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
1028
                return ae
×
1029
        }
×
1030

1031
        return ApiErrors[JSConsumerAlreadyExists]
5✔
1032
}
1033

1034
// NewJSConsumerBackOffNegativeError creates a new JSConsumerBackOffNegativeErr error: "consumer backoff needs to be positive"
1035
func NewJSConsumerBackOffNegativeError(opts ...ErrorOption) *ApiError {
2✔
1036
        eopts := parseOpts(opts)
2✔
1037
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1038
                return ae
×
1039
        }
×
1040

1041
        return ApiErrors[JSConsumerBackOffNegativeErr]
2✔
1042
}
1043

1044
// NewJSConsumerBadDurableNameError creates a new JSConsumerBadDurableNameErr error: "durable name can not contain '.', '*', '>'"
1045
func NewJSConsumerBadDurableNameError(opts ...ErrorOption) *ApiError {
×
1046
        eopts := parseOpts(opts)
×
1047
        if ae, ok := eopts.err.(*ApiError); ok {
×
1048
                return ae
×
1049
        }
×
1050

1051
        return ApiErrors[JSConsumerBadDurableNameErr]
×
1052
}
1053

1054
// NewJSConsumerConfigRequiredError creates a new JSConsumerConfigRequiredErr error: "consumer config required"
1055
func NewJSConsumerConfigRequiredError(opts ...ErrorOption) *ApiError {
2✔
1056
        eopts := parseOpts(opts)
2✔
1057
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1058
                return ae
×
1059
        }
×
1060

1061
        return ApiErrors[JSConsumerConfigRequiredErr]
2✔
1062
}
1063

1064
// NewJSConsumerCreateDurableAndNameMismatchError creates a new JSConsumerCreateDurableAndNameMismatch error: "Consumer Durable and Name have to be equal if both are provided"
1065
func NewJSConsumerCreateDurableAndNameMismatchError(opts ...ErrorOption) *ApiError {
1✔
1066
        eopts := parseOpts(opts)
1✔
1067
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1068
                return ae
×
1069
        }
×
1070

1071
        return ApiErrors[JSConsumerCreateDurableAndNameMismatch]
1✔
1072
}
1073

1074
// NewJSConsumerCreateError creates a new JSConsumerCreateErrF error: "{err}"
1075
func NewJSConsumerCreateError(err error, opts ...ErrorOption) *ApiError {
69✔
1076
        eopts := parseOpts(opts)
69✔
1077
        if ae, ok := eopts.err.(*ApiError); ok {
120✔
1078
                return ae
51✔
1079
        }
51✔
1080

1081
        e := ApiErrors[JSConsumerCreateErrF]
18✔
1082
        args := e.toReplacerArgs([]interface{}{"{err}", err})
18✔
1083
        return &ApiError{
18✔
1084
                Code:        e.Code,
18✔
1085
                ErrCode:     e.ErrCode,
18✔
1086
                Description: strings.NewReplacer(args...).Replace(e.Description),
18✔
1087
        }
18✔
1088
}
1089

1090
// NewJSConsumerCreateFilterSubjectMismatchError creates a new JSConsumerCreateFilterSubjectMismatchErr error: "Consumer create request did not match filtered subject from create subject"
1091
func NewJSConsumerCreateFilterSubjectMismatchError(opts ...ErrorOption) *ApiError {
2✔
1092
        eopts := parseOpts(opts)
2✔
1093
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1094
                return ae
×
1095
        }
×
1096

1097
        return ApiErrors[JSConsumerCreateFilterSubjectMismatchErr]
2✔
1098
}
1099

1100
// NewJSConsumerDeliverCycleError creates a new JSConsumerDeliverCycleErr error: "consumer deliver subject forms a cycle"
1101
func NewJSConsumerDeliverCycleError(opts ...ErrorOption) *ApiError {
4✔
1102
        eopts := parseOpts(opts)
4✔
1103
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1104
                return ae
×
1105
        }
×
1106

1107
        return ApiErrors[JSConsumerDeliverCycleErr]
4✔
1108
}
1109

1110
// NewJSConsumerDeliverToWildcardsError creates a new JSConsumerDeliverToWildcardsErr error: "consumer deliver subject has wildcards"
1111
func NewJSConsumerDeliverToWildcardsError(opts ...ErrorOption) *ApiError {
4✔
1112
        eopts := parseOpts(opts)
4✔
1113
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1114
                return ae
×
1115
        }
×
1116

1117
        return ApiErrors[JSConsumerDeliverToWildcardsErr]
4✔
1118
}
1119

1120
// NewJSConsumerDescriptionTooLongError creates a new JSConsumerDescriptionTooLongErrF error: "consumer description is too long, maximum allowed is {max}"
1121
func NewJSConsumerDescriptionTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
1✔
1122
        eopts := parseOpts(opts)
1✔
1123
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1124
                return ae
×
1125
        }
×
1126

1127
        e := ApiErrors[JSConsumerDescriptionTooLongErrF]
1✔
1128
        args := e.toReplacerArgs([]interface{}{"{max}", max})
1✔
1129
        return &ApiError{
1✔
1130
                Code:        e.Code,
1✔
1131
                ErrCode:     e.ErrCode,
1✔
1132
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1133
        }
1✔
1134
}
1135

1136
// NewJSConsumerDirectRequiresEphemeralError creates a new JSConsumerDirectRequiresEphemeralErr error: "consumer direct requires an ephemeral consumer"
1137
func NewJSConsumerDirectRequiresEphemeralError(opts ...ErrorOption) *ApiError {
×
1138
        eopts := parseOpts(opts)
×
1139
        if ae, ok := eopts.err.(*ApiError); ok {
×
1140
                return ae
×
1141
        }
×
1142

1143
        return ApiErrors[JSConsumerDirectRequiresEphemeralErr]
×
1144
}
1145

1146
// NewJSConsumerDirectRequiresPushError creates a new JSConsumerDirectRequiresPushErr error: "consumer direct requires a push based consumer"
1147
func NewJSConsumerDirectRequiresPushError(opts ...ErrorOption) *ApiError {
×
1148
        eopts := parseOpts(opts)
×
1149
        if ae, ok := eopts.err.(*ApiError); ok {
×
1150
                return ae
×
1151
        }
×
1152

1153
        return ApiErrors[JSConsumerDirectRequiresPushErr]
×
1154
}
1155

1156
// NewJSConsumerDoesNotExistError creates a new JSConsumerDoesNotExist error: "consumer does not exist"
1157
func NewJSConsumerDoesNotExistError(opts ...ErrorOption) *ApiError {
3✔
1158
        eopts := parseOpts(opts)
3✔
1159
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1160
                return ae
×
1161
        }
×
1162

1163
        return ApiErrors[JSConsumerDoesNotExist]
3✔
1164
}
1165

1166
// NewJSConsumerDuplicateFilterSubjectsError creates a new JSConsumerDuplicateFilterSubjects error: "consumer cannot have both FilterSubject and FilterSubjects specified"
1167
func NewJSConsumerDuplicateFilterSubjectsError(opts ...ErrorOption) *ApiError {
1✔
1168
        eopts := parseOpts(opts)
1✔
1169
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1170
                return ae
×
1171
        }
×
1172

1173
        return ApiErrors[JSConsumerDuplicateFilterSubjects]
1✔
1174
}
1175

1176
// NewJSConsumerDurableNameNotInSubjectError creates a new JSConsumerDurableNameNotInSubjectErr error: "consumer expected to be durable but no durable name set in subject"
1177
func NewJSConsumerDurableNameNotInSubjectError(opts ...ErrorOption) *ApiError {
×
1178
        eopts := parseOpts(opts)
×
1179
        if ae, ok := eopts.err.(*ApiError); ok {
×
1180
                return ae
×
1181
        }
×
1182

1183
        return ApiErrors[JSConsumerDurableNameNotInSubjectErr]
×
1184
}
1185

1186
// NewJSConsumerDurableNameNotMatchSubjectError creates a new JSConsumerDurableNameNotMatchSubjectErr error: "consumer name in subject does not match durable name in request"
1187
func NewJSConsumerDurableNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
×
1188
        eopts := parseOpts(opts)
×
1189
        if ae, ok := eopts.err.(*ApiError); ok {
×
1190
                return ae
×
1191
        }
×
1192

1193
        return ApiErrors[JSConsumerDurableNameNotMatchSubjectErr]
×
1194
}
1195

1196
// NewJSConsumerDurableNameNotSetError creates a new JSConsumerDurableNameNotSetErr error: "consumer expected to be durable but a durable name was not set"
1197
func NewJSConsumerDurableNameNotSetError(opts ...ErrorOption) *ApiError {
1✔
1198
        eopts := parseOpts(opts)
1✔
1199
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1200
                return ae
×
1201
        }
×
1202

1203
        return ApiErrors[JSConsumerDurableNameNotSetErr]
1✔
1204
}
1205

1206
// NewJSConsumerEmptyFilterError creates a new JSConsumerEmptyFilter error: "consumer filter in FilterSubjects cannot be empty"
1207
func NewJSConsumerEmptyFilterError(opts ...ErrorOption) *ApiError {
1✔
1208
        eopts := parseOpts(opts)
1✔
1209
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1210
                return ae
×
1211
        }
×
1212

1213
        return ApiErrors[JSConsumerEmptyFilter]
1✔
1214
}
1215

1216
// NewJSConsumerEmptyGroupNameError creates a new JSConsumerEmptyGroupName error: "Group name cannot be an empty string"
1217
func NewJSConsumerEmptyGroupNameError(opts ...ErrorOption) *ApiError {
4✔
1218
        eopts := parseOpts(opts)
4✔
1219
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1220
                return ae
×
1221
        }
×
1222

1223
        return ApiErrors[JSConsumerEmptyGroupName]
4✔
1224
}
1225

1226
// NewJSConsumerEphemeralWithDurableInSubjectError creates a new JSConsumerEphemeralWithDurableInSubjectErr error: "consumer expected to be ephemeral but detected a durable name set in subject"
1227
func NewJSConsumerEphemeralWithDurableInSubjectError(opts ...ErrorOption) *ApiError {
×
1228
        eopts := parseOpts(opts)
×
1229
        if ae, ok := eopts.err.(*ApiError); ok {
×
1230
                return ae
×
1231
        }
×
1232

1233
        return ApiErrors[JSConsumerEphemeralWithDurableInSubjectErr]
×
1234
}
1235

1236
// NewJSConsumerEphemeralWithDurableNameError creates a new JSConsumerEphemeralWithDurableNameErr error: "consumer expected to be ephemeral but a durable name was set in request"
1237
func NewJSConsumerEphemeralWithDurableNameError(opts ...ErrorOption) *ApiError {
3✔
1238
        eopts := parseOpts(opts)
3✔
1239
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1240
                return ae
×
1241
        }
×
1242

1243
        return ApiErrors[JSConsumerEphemeralWithDurableNameErr]
3✔
1244
}
1245

1246
// NewJSConsumerExistingActiveError creates a new JSConsumerExistingActiveErr error: "consumer already exists and is still active"
1247
func NewJSConsumerExistingActiveError(opts ...ErrorOption) *ApiError {
×
1248
        eopts := parseOpts(opts)
×
1249
        if ae, ok := eopts.err.(*ApiError); ok {
×
1250
                return ae
×
1251
        }
×
1252

1253
        return ApiErrors[JSConsumerExistingActiveErr]
×
1254
}
1255

1256
// NewJSConsumerFCRequiresPushError creates a new JSConsumerFCRequiresPushErr error: "consumer flow control requires a push based consumer"
1257
func NewJSConsumerFCRequiresPushError(opts ...ErrorOption) *ApiError {
×
1258
        eopts := parseOpts(opts)
×
1259
        if ae, ok := eopts.err.(*ApiError); ok {
×
1260
                return ae
×
1261
        }
×
1262

1263
        return ApiErrors[JSConsumerFCRequiresPushErr]
×
1264
}
1265

1266
// NewJSConsumerFilterNotSubsetError creates a new JSConsumerFilterNotSubsetErr error: "consumer filter subject is not a valid subset of the interest subjects"
1267
func NewJSConsumerFilterNotSubsetError(opts ...ErrorOption) *ApiError {
×
1268
        eopts := parseOpts(opts)
×
1269
        if ae, ok := eopts.err.(*ApiError); ok {
×
1270
                return ae
×
1271
        }
×
1272

1273
        return ApiErrors[JSConsumerFilterNotSubsetErr]
×
1274
}
1275

1276
// NewJSConsumerHBRequiresPushError creates a new JSConsumerHBRequiresPushErr error: "consumer idle heartbeat requires a push based consumer"
1277
func NewJSConsumerHBRequiresPushError(opts ...ErrorOption) *ApiError {
×
1278
        eopts := parseOpts(opts)
×
1279
        if ae, ok := eopts.err.(*ApiError); ok {
×
1280
                return ae
×
1281
        }
×
1282

1283
        return ApiErrors[JSConsumerHBRequiresPushErr]
×
1284
}
1285

1286
// NewJSConsumerInactiveThresholdExcessError creates a new JSConsumerInactiveThresholdExcess error: "consumer inactive threshold exceeds system limit of {limit}"
1287
func NewJSConsumerInactiveThresholdExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
2✔
1288
        eopts := parseOpts(opts)
2✔
1289
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1290
                return ae
×
1291
        }
×
1292

1293
        e := ApiErrors[JSConsumerInactiveThresholdExcess]
2✔
1294
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
2✔
1295
        return &ApiError{
2✔
1296
                Code:        e.Code,
2✔
1297
                ErrCode:     e.ErrCode,
2✔
1298
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1299
        }
2✔
1300
}
1301

1302
// NewJSConsumerInvalidDeliverSubjectError creates a new JSConsumerInvalidDeliverSubject error: "invalid push consumer deliver subject"
1303
func NewJSConsumerInvalidDeliverSubjectError(opts ...ErrorOption) *ApiError {
2✔
1304
        eopts := parseOpts(opts)
2✔
1305
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1306
                return ae
×
1307
        }
×
1308

1309
        return ApiErrors[JSConsumerInvalidDeliverSubject]
2✔
1310
}
1311

1312
// NewJSConsumerInvalidGroupNameError creates a new JSConsumerInvalidGroupNameErr error: "Valid priority group name must match A-Z, a-z, 0-9, -_/=)+ and may not exceed 16 characters"
1313
func NewJSConsumerInvalidGroupNameError(opts ...ErrorOption) *ApiError {
4✔
1314
        eopts := parseOpts(opts)
4✔
1315
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1316
                return ae
×
1317
        }
×
1318

1319
        return ApiErrors[JSConsumerInvalidGroupNameErr]
4✔
1320
}
1321

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

1329
        e := ApiErrors[JSConsumerInvalidPolicyErrF]
10✔
1330
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1331
        return &ApiError{
10✔
1332
                Code:        e.Code,
10✔
1333
                ErrCode:     e.ErrCode,
10✔
1334
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1335
        }
10✔
1336
}
1337

1338
// NewJSConsumerInvalidPriorityGroupError creates a new JSConsumerInvalidPriorityGroupErr error: "Provided priority group does not exist for this consumer"
1339
func NewJSConsumerInvalidPriorityGroupError(opts ...ErrorOption) *ApiError {
2✔
1340
        eopts := parseOpts(opts)
2✔
1341
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1342
                return ae
×
1343
        }
×
1344

1345
        return ApiErrors[JSConsumerInvalidPriorityGroupErr]
2✔
1346
}
1347

1348
// NewJSConsumerInvalidSamplingError creates a new JSConsumerInvalidSamplingErrF error: "failed to parse consumer sampling configuration: {err}"
1349
func NewJSConsumerInvalidSamplingError(err error, opts ...ErrorOption) *ApiError {
×
1350
        eopts := parseOpts(opts)
×
1351
        if ae, ok := eopts.err.(*ApiError); ok {
×
1352
                return ae
×
1353
        }
×
1354

1355
        e := ApiErrors[JSConsumerInvalidSamplingErrF]
×
1356
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1357
        return &ApiError{
×
1358
                Code:        e.Code,
×
1359
                ErrCode:     e.ErrCode,
×
1360
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1361
        }
×
1362
}
1363

1364
// NewJSConsumerMaxDeliverBackoffError creates a new JSConsumerMaxDeliverBackoffErr error: "max deliver is required to be > length of backoff values"
1365
func NewJSConsumerMaxDeliverBackoffError(opts ...ErrorOption) *ApiError {
3✔
1366
        eopts := parseOpts(opts)
3✔
1367
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1368
                return ae
×
1369
        }
×
1370

1371
        return ApiErrors[JSConsumerMaxDeliverBackoffErr]
3✔
1372
}
1373

1374
// NewJSConsumerMaxPendingAckExcessError creates a new JSConsumerMaxPendingAckExcessErrF error: "consumer max ack pending exceeds system limit of {limit}"
1375
func NewJSConsumerMaxPendingAckExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
12✔
1376
        eopts := parseOpts(opts)
12✔
1377
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
1378
                return ae
×
1379
        }
×
1380

1381
        e := ApiErrors[JSConsumerMaxPendingAckExcessErrF]
12✔
1382
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
12✔
1383
        return &ApiError{
12✔
1384
                Code:        e.Code,
12✔
1385
                ErrCode:     e.ErrCode,
12✔
1386
                Description: strings.NewReplacer(args...).Replace(e.Description),
12✔
1387
        }
12✔
1388
}
1389

1390
// NewJSConsumerMaxPendingAckPolicyRequiredError creates a new JSConsumerMaxPendingAckPolicyRequiredErr error: "consumer requires ack policy for max ack pending"
1391
func NewJSConsumerMaxPendingAckPolicyRequiredError(opts ...ErrorOption) *ApiError {
2✔
1392
        eopts := parseOpts(opts)
2✔
1393
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1394
                return ae
×
1395
        }
×
1396

1397
        return ApiErrors[JSConsumerMaxPendingAckPolicyRequiredErr]
2✔
1398
}
1399

1400
// NewJSConsumerMaxRequestBatchExceededError creates a new JSConsumerMaxRequestBatchExceededF error: "consumer max request batch exceeds server limit of {limit}"
1401
func NewJSConsumerMaxRequestBatchExceededError(limit interface{}, opts ...ErrorOption) *ApiError {
4✔
1402
        eopts := parseOpts(opts)
4✔
1403
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1404
                return ae
×
1405
        }
×
1406

1407
        e := ApiErrors[JSConsumerMaxRequestBatchExceededF]
4✔
1408
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
4✔
1409
        return &ApiError{
4✔
1410
                Code:        e.Code,
4✔
1411
                ErrCode:     e.ErrCode,
4✔
1412
                Description: strings.NewReplacer(args...).Replace(e.Description),
4✔
1413
        }
4✔
1414
}
1415

1416
// NewJSConsumerMaxRequestBatchNegativeError creates a new JSConsumerMaxRequestBatchNegativeErr error: "consumer max request batch needs to be > 0"
1417
func NewJSConsumerMaxRequestBatchNegativeError(opts ...ErrorOption) *ApiError {
×
1418
        eopts := parseOpts(opts)
×
1419
        if ae, ok := eopts.err.(*ApiError); ok {
×
1420
                return ae
×
1421
        }
×
1422

1423
        return ApiErrors[JSConsumerMaxRequestBatchNegativeErr]
×
1424
}
1425

1426
// NewJSConsumerMaxRequestExpiresTooSmallError creates a new JSConsumerMaxRequestExpiresTooSmall error: "consumer max request expires needs to be >= 1ms"
1427
func NewJSConsumerMaxRequestExpiresTooSmallError(opts ...ErrorOption) *ApiError {
×
1428
        eopts := parseOpts(opts)
×
1429
        if ae, ok := eopts.err.(*ApiError); ok {
×
1430
                return ae
×
1431
        }
×
1432

1433
        return ApiErrors[JSConsumerMaxRequestExpiresTooSmall]
×
1434
}
1435

1436
// NewJSConsumerMaxWaitingNegativeError creates a new JSConsumerMaxWaitingNegativeErr error: "consumer max waiting needs to be positive"
1437
func NewJSConsumerMaxWaitingNegativeError(opts ...ErrorOption) *ApiError {
×
1438
        eopts := parseOpts(opts)
×
1439
        if ae, ok := eopts.err.(*ApiError); ok {
×
1440
                return ae
×
1441
        }
×
1442

1443
        return ApiErrors[JSConsumerMaxWaitingNegativeErr]
×
1444
}
1445

1446
// NewJSConsumerMetadataLengthError creates a new JSConsumerMetadataLengthErrF error: "consumer metadata exceeds maximum size of {limit}"
1447
func NewJSConsumerMetadataLengthError(limit interface{}, opts ...ErrorOption) *ApiError {
1✔
1448
        eopts := parseOpts(opts)
1✔
1449
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1450
                return ae
×
1451
        }
×
1452

1453
        e := ApiErrors[JSConsumerMetadataLengthErrF]
1✔
1454
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
1✔
1455
        return &ApiError{
1✔
1456
                Code:        e.Code,
1✔
1457
                ErrCode:     e.ErrCode,
1✔
1458
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1459
        }
1✔
1460
}
1461

1462
// NewJSConsumerMultipleFiltersNotAllowedError creates a new JSConsumerMultipleFiltersNotAllowed error: "consumer with multiple subject filters cannot use subject based API"
1463
func NewJSConsumerMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
1464
        eopts := parseOpts(opts)
1✔
1465
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1466
                return ae
×
1467
        }
×
1468

1469
        return ApiErrors[JSConsumerMultipleFiltersNotAllowed]
1✔
1470
}
1471

1472
// NewJSConsumerNameContainsPathSeparatorsError creates a new JSConsumerNameContainsPathSeparatorsErr error: "Consumer name can not contain path separators"
1473
func NewJSConsumerNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
8✔
1474
        eopts := parseOpts(opts)
8✔
1475
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1476
                return ae
×
1477
        }
×
1478

1479
        return ApiErrors[JSConsumerNameContainsPathSeparatorsErr]
8✔
1480
}
1481

1482
// NewJSConsumerNameExistError creates a new JSConsumerNameExistErr error: "consumer name already in use"
1483
func NewJSConsumerNameExistError(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[JSConsumerNameExistErr]
2✔
1490
}
1491

1492
// NewJSConsumerNameTooLongError creates a new JSConsumerNameTooLongErrF error: "consumer name is too long, maximum allowed is {max}"
1493
func NewJSConsumerNameTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
×
1494
        eopts := parseOpts(opts)
×
1495
        if ae, ok := eopts.err.(*ApiError); ok {
×
1496
                return ae
×
1497
        }
×
1498

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

1508
// NewJSConsumerNotFoundError creates a new JSConsumerNotFoundErr error: "consumer not found"
1509
func NewJSConsumerNotFoundError(opts ...ErrorOption) *ApiError {
2,769✔
1510
        eopts := parseOpts(opts)
2,769✔
1511
        if ae, ok := eopts.err.(*ApiError); ok {
2,769✔
1512
                return ae
×
1513
        }
×
1514

1515
        return ApiErrors[JSConsumerNotFoundErr]
2,769✔
1516
}
1517

1518
// NewJSConsumerOfflineError creates a new JSConsumerOfflineErr error: "consumer is offline"
1519
func NewJSConsumerOfflineError(opts ...ErrorOption) *ApiError {
6✔
1520
        eopts := parseOpts(opts)
6✔
1521
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1522
                return ae
×
1523
        }
×
1524

1525
        return ApiErrors[JSConsumerOfflineErr]
6✔
1526
}
1527

1528
// NewJSConsumerOfflineReasonError creates a new JSConsumerOfflineReasonErrF error: "consumer is offline: {err}"
1529
func NewJSConsumerOfflineReasonError(err error, opts ...ErrorOption) *ApiError {
24✔
1530
        eopts := parseOpts(opts)
24✔
1531
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
1532
                return ae
×
1533
        }
×
1534

1535
        e := ApiErrors[JSConsumerOfflineReasonErrF]
24✔
1536
        args := e.toReplacerArgs([]interface{}{"{err}", err})
24✔
1537
        return &ApiError{
24✔
1538
                Code:        e.Code,
24✔
1539
                ErrCode:     e.ErrCode,
24✔
1540
                Description: strings.NewReplacer(args...).Replace(e.Description),
24✔
1541
        }
24✔
1542
}
1543

1544
// NewJSConsumerOnMappedError creates a new JSConsumerOnMappedErr error: "consumer direct on a mapped consumer"
1545
func NewJSConsumerOnMappedError(opts ...ErrorOption) *ApiError {
×
1546
        eopts := parseOpts(opts)
×
1547
        if ae, ok := eopts.err.(*ApiError); ok {
×
1548
                return ae
×
1549
        }
×
1550

1551
        return ApiErrors[JSConsumerOnMappedErr]
×
1552
}
1553

1554
// NewJSConsumerOverlappingSubjectFiltersError creates a new JSConsumerOverlappingSubjectFilters error: "consumer subject filters cannot overlap"
1555
func NewJSConsumerOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
1✔
1556
        eopts := parseOpts(opts)
1✔
1557
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1558
                return ae
×
1559
        }
×
1560

1561
        return ApiErrors[JSConsumerOverlappingSubjectFilters]
1✔
1562
}
1563

1564
// NewJSConsumerPriorityPolicyWithoutGroupError creates a new JSConsumerPriorityPolicyWithoutGroup error: "Setting PriorityPolicy requires at least one PriorityGroup to be set"
1565
func NewJSConsumerPriorityPolicyWithoutGroupError(opts ...ErrorOption) *ApiError {
4✔
1566
        eopts := parseOpts(opts)
4✔
1567
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1568
                return ae
×
1569
        }
×
1570

1571
        return ApiErrors[JSConsumerPriorityPolicyWithoutGroup]
4✔
1572
}
1573

1574
// NewJSConsumerPullNotDurableError creates a new JSConsumerPullNotDurableErr error: "consumer in pull mode requires a durable name"
1575
func NewJSConsumerPullNotDurableError(opts ...ErrorOption) *ApiError {
×
1576
        eopts := parseOpts(opts)
×
1577
        if ae, ok := eopts.err.(*ApiError); ok {
×
1578
                return ae
×
1579
        }
×
1580

1581
        return ApiErrors[JSConsumerPullNotDurableErr]
×
1582
}
1583

1584
// NewJSConsumerPullRequiresAckError creates a new JSConsumerPullRequiresAckErr error: "consumer in pull mode requires explicit ack policy on workqueue stream"
1585
func NewJSConsumerPullRequiresAckError(opts ...ErrorOption) *ApiError {
6✔
1586
        eopts := parseOpts(opts)
6✔
1587
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1588
                return ae
×
1589
        }
×
1590

1591
        return ApiErrors[JSConsumerPullRequiresAckErr]
6✔
1592
}
1593

1594
// NewJSConsumerPullWithRateLimitError creates a new JSConsumerPullWithRateLimitErr error: "consumer in pull mode can not have rate limit set"
1595
func NewJSConsumerPullWithRateLimitError(opts ...ErrorOption) *ApiError {
1✔
1596
        eopts := parseOpts(opts)
1✔
1597
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1598
                return ae
×
1599
        }
×
1600

1601
        return ApiErrors[JSConsumerPullWithRateLimitErr]
1✔
1602
}
1603

1604
// NewJSConsumerPushMaxWaitingError creates a new JSConsumerPushMaxWaitingErr error: "consumer in push mode can not set max waiting"
1605
func NewJSConsumerPushMaxWaitingError(opts ...ErrorOption) *ApiError {
3✔
1606
        eopts := parseOpts(opts)
3✔
1607
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1608
                return ae
×
1609
        }
×
1610

1611
        return ApiErrors[JSConsumerPushMaxWaitingErr]
3✔
1612
}
1613

1614
// NewJSConsumerPushWithPriorityGroupError creates a new JSConsumerPushWithPriorityGroupErr error: "priority groups can not be used with push consumers"
1615
func NewJSConsumerPushWithPriorityGroupError(opts ...ErrorOption) *ApiError {
1✔
1616
        eopts := parseOpts(opts)
1✔
1617
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1618
                return ae
×
1619
        }
×
1620

1621
        return ApiErrors[JSConsumerPushWithPriorityGroupErr]
1✔
1622
}
1623

1624
// NewJSConsumerReplacementWithDifferentNameError creates a new JSConsumerReplacementWithDifferentNameErr error: "consumer replacement durable config not the same"
1625
func NewJSConsumerReplacementWithDifferentNameError(opts ...ErrorOption) *ApiError {
×
1626
        eopts := parseOpts(opts)
×
1627
        if ae, ok := eopts.err.(*ApiError); ok {
×
1628
                return ae
×
1629
        }
×
1630

1631
        return ApiErrors[JSConsumerReplacementWithDifferentNameErr]
×
1632
}
1633

1634
// NewJSConsumerReplayPolicyInvalidError creates a new JSConsumerReplayPolicyInvalidErr error: "consumer replay policy invalid"
1635
func NewJSConsumerReplayPolicyInvalidError(opts ...ErrorOption) *ApiError {
2✔
1636
        eopts := parseOpts(opts)
2✔
1637
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1638
                return ae
×
1639
        }
×
1640

1641
        return ApiErrors[JSConsumerReplayPolicyInvalidErr]
2✔
1642
}
1643

1644
// NewJSConsumerReplicasExceedsStreamError creates a new JSConsumerReplicasExceedsStream error: "consumer config replica count exceeds parent stream"
1645
func NewJSConsumerReplicasExceedsStreamError(opts ...ErrorOption) *ApiError {
1✔
1646
        eopts := parseOpts(opts)
1✔
1647
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1648
                return ae
×
1649
        }
×
1650

1651
        return ApiErrors[JSConsumerReplicasExceedsStream]
1✔
1652
}
1653

1654
// NewJSConsumerReplicasShouldMatchStreamError creates a new JSConsumerReplicasShouldMatchStream error: "consumer config replicas must match interest retention stream's replicas"
1655
func NewJSConsumerReplicasShouldMatchStreamError(opts ...ErrorOption) *ApiError {
2✔
1656
        eopts := parseOpts(opts)
2✔
1657
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1658
                return ae
×
1659
        }
×
1660

1661
        return ApiErrors[JSConsumerReplicasShouldMatchStream]
2✔
1662
}
1663

1664
// NewJSConsumerSmallHeartbeatError creates a new JSConsumerSmallHeartbeatErr error: "consumer idle heartbeat needs to be >= 100ms"
1665
func NewJSConsumerSmallHeartbeatError(opts ...ErrorOption) *ApiError {
1✔
1666
        eopts := parseOpts(opts)
1✔
1667
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1668
                return ae
×
1669
        }
×
1670

1671
        return ApiErrors[JSConsumerSmallHeartbeatErr]
1✔
1672
}
1673

1674
// NewJSConsumerStoreFailedError creates a new JSConsumerStoreFailedErrF error: "error creating store for consumer: {err}"
1675
func NewJSConsumerStoreFailedError(err error, opts ...ErrorOption) *ApiError {
8✔
1676
        eopts := parseOpts(opts)
8✔
1677
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1678
                return ae
×
1679
        }
×
1680

1681
        e := ApiErrors[JSConsumerStoreFailedErrF]
8✔
1682
        args := e.toReplacerArgs([]interface{}{"{err}", err})
8✔
1683
        return &ApiError{
8✔
1684
                Code:        e.Code,
8✔
1685
                ErrCode:     e.ErrCode,
8✔
1686
                Description: strings.NewReplacer(args...).Replace(e.Description),
8✔
1687
        }
8✔
1688
}
1689

1690
// NewJSConsumerWQConsumerNotDeliverAllError creates a new JSConsumerWQConsumerNotDeliverAllErr error: "consumer must be deliver all on workqueue stream"
1691
func NewJSConsumerWQConsumerNotDeliverAllError(opts ...ErrorOption) *ApiError {
×
1692
        eopts := parseOpts(opts)
×
1693
        if ae, ok := eopts.err.(*ApiError); ok {
×
1694
                return ae
×
1695
        }
×
1696

1697
        return ApiErrors[JSConsumerWQConsumerNotDeliverAllErr]
×
1698
}
1699

1700
// NewJSConsumerWQConsumerNotUniqueError creates a new JSConsumerWQConsumerNotUniqueErr error: "filtered consumer not unique on workqueue stream"
1701
func NewJSConsumerWQConsumerNotUniqueError(opts ...ErrorOption) *ApiError {
11✔
1702
        eopts := parseOpts(opts)
11✔
1703
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
1704
                return ae
×
1705
        }
×
1706

1707
        return ApiErrors[JSConsumerWQConsumerNotUniqueErr]
11✔
1708
}
1709

1710
// NewJSConsumerWQMultipleUnfilteredError creates a new JSConsumerWQMultipleUnfilteredErr error: "multiple non-filtered consumers not allowed on workqueue stream"
1711
func NewJSConsumerWQMultipleUnfilteredError(opts ...ErrorOption) *ApiError {
2✔
1712
        eopts := parseOpts(opts)
2✔
1713
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1714
                return ae
×
1715
        }
×
1716

1717
        return ApiErrors[JSConsumerWQMultipleUnfilteredErr]
2✔
1718
}
1719

1720
// NewJSConsumerWQRequiresExplicitAckError creates a new JSConsumerWQRequiresExplicitAckErr error: "workqueue stream requires explicit ack"
1721
func NewJSConsumerWQRequiresExplicitAckError(opts ...ErrorOption) *ApiError {
×
1722
        eopts := parseOpts(opts)
×
1723
        if ae, ok := eopts.err.(*ApiError); ok {
×
1724
                return ae
×
1725
        }
×
1726

1727
        return ApiErrors[JSConsumerWQRequiresExplicitAckErr]
×
1728
}
1729

1730
// NewJSConsumerWithFlowControlNeedsHeartbeatsError creates a new JSConsumerWithFlowControlNeedsHeartbeats error: "consumer with flow control also needs heartbeats"
1731
func NewJSConsumerWithFlowControlNeedsHeartbeatsError(opts ...ErrorOption) *ApiError {
4✔
1732
        eopts := parseOpts(opts)
4✔
1733
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1734
                return ae
×
1735
        }
×
1736

1737
        return ApiErrors[JSConsumerWithFlowControlNeedsHeartbeats]
4✔
1738
}
1739

1740
// NewJSInsufficientResourcesError creates a new JSInsufficientResourcesErr error: "insufficient resources"
1741
func NewJSInsufficientResourcesError(opts ...ErrorOption) *ApiError {
11✔
1742
        eopts := parseOpts(opts)
11✔
1743
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
1744
                return ae
×
1745
        }
×
1746

1747
        return ApiErrors[JSInsufficientResourcesErr]
11✔
1748
}
1749

1750
// NewJSInvalidJSONError creates a new JSInvalidJSONErr error: "invalid JSON: {err}"
1751
func NewJSInvalidJSONError(err error, opts ...ErrorOption) *ApiError {
10✔
1752
        eopts := parseOpts(opts)
10✔
1753
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1754
                return ae
×
1755
        }
×
1756

1757
        e := ApiErrors[JSInvalidJSONErr]
10✔
1758
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1759
        return &ApiError{
10✔
1760
                Code:        e.Code,
10✔
1761
                ErrCode:     e.ErrCode,
10✔
1762
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1763
        }
10✔
1764
}
1765

1766
// NewJSMaximumConsumersLimitError creates a new JSMaximumConsumersLimitErr error: "maximum consumers limit reached"
1767
func NewJSMaximumConsumersLimitError(opts ...ErrorOption) *ApiError {
29✔
1768
        eopts := parseOpts(opts)
29✔
1769
        if ae, ok := eopts.err.(*ApiError); ok {
29✔
1770
                return ae
×
1771
        }
×
1772

1773
        return ApiErrors[JSMaximumConsumersLimitErr]
29✔
1774
}
1775

1776
// NewJSMaximumStreamsLimitError creates a new JSMaximumStreamsLimitErr error: "maximum number of streams reached"
1777
func NewJSMaximumStreamsLimitError(opts ...ErrorOption) *ApiError {
16✔
1778
        eopts := parseOpts(opts)
16✔
1779
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
1780
                return ae
×
1781
        }
×
1782

1783
        return ApiErrors[JSMaximumStreamsLimitErr]
16✔
1784
}
1785

1786
// NewJSMemoryResourcesExceededError creates a new JSMemoryResourcesExceededErr error: "insufficient memory resources available"
1787
func NewJSMemoryResourcesExceededError(opts ...ErrorOption) *ApiError {
4✔
1788
        eopts := parseOpts(opts)
4✔
1789
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1790
                return ae
×
1791
        }
×
1792

1793
        return ApiErrors[JSMemoryResourcesExceededErr]
4✔
1794
}
1795

1796
// NewJSMessageCounterBrokenError creates a new JSMessageCounterBrokenErr error: "message counter is broken"
1797
func NewJSMessageCounterBrokenError(opts ...ErrorOption) *ApiError {
4✔
1798
        eopts := parseOpts(opts)
4✔
1799
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1800
                return ae
×
1801
        }
×
1802

1803
        return ApiErrors[JSMessageCounterBrokenErr]
4✔
1804
}
1805

1806
// NewJSMessageIncrDisabledError creates a new JSMessageIncrDisabledErr error: "message counters is disabled"
1807
func NewJSMessageIncrDisabledError(opts ...ErrorOption) *ApiError {
4✔
1808
        eopts := parseOpts(opts)
4✔
1809
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1810
                return ae
×
1811
        }
×
1812

1813
        return ApiErrors[JSMessageIncrDisabledErr]
4✔
1814
}
1815

1816
// NewJSMessageIncrInvalidError creates a new JSMessageIncrInvalidErr error: "message counter increment is invalid"
1817
func NewJSMessageIncrInvalidError(opts ...ErrorOption) *ApiError {
24✔
1818
        eopts := parseOpts(opts)
24✔
1819
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
1820
                return ae
×
1821
        }
×
1822

1823
        return ApiErrors[JSMessageIncrInvalidErr]
24✔
1824
}
1825

1826
// NewJSMessageIncrMissingError creates a new JSMessageIncrMissingErr error: "message counter increment is missing"
1827
func NewJSMessageIncrMissingError(opts ...ErrorOption) *ApiError {
8✔
1828
        eopts := parseOpts(opts)
8✔
1829
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1830
                return ae
×
1831
        }
×
1832

1833
        return ApiErrors[JSMessageIncrMissingErr]
8✔
1834
}
1835

1836
// NewJSMessageIncrPayloadError creates a new JSMessageIncrPayloadErr error: "message counter has payload"
1837
func NewJSMessageIncrPayloadError(opts ...ErrorOption) *ApiError {
4✔
1838
        eopts := parseOpts(opts)
4✔
1839
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1840
                return ae
×
1841
        }
×
1842

1843
        return ApiErrors[JSMessageIncrPayloadErr]
4✔
1844
}
1845

1846
// NewJSMessageSchedulesDisabledError creates a new JSMessageSchedulesDisabledErr error: "message schedules is disabled"
1847
func NewJSMessageSchedulesDisabledError(opts ...ErrorOption) *ApiError {
20✔
1848
        eopts := parseOpts(opts)
20✔
1849
        if ae, ok := eopts.err.(*ApiError); ok {
20✔
1850
                return ae
×
1851
        }
×
1852

1853
        return ApiErrors[JSMessageSchedulesDisabledErr]
20✔
1854
}
1855

1856
// NewJSMessageSchedulesPatternInvalidError creates a new JSMessageSchedulesPatternInvalidErr error: "message schedules pattern is invalid"
1857
func NewJSMessageSchedulesPatternInvalidError(opts ...ErrorOption) *ApiError {
15✔
1858
        eopts := parseOpts(opts)
15✔
1859
        if ae, ok := eopts.err.(*ApiError); ok {
15✔
1860
                return ae
×
1861
        }
×
1862

1863
        return ApiErrors[JSMessageSchedulesPatternInvalidErr]
15✔
1864
}
1865

1866
// NewJSMessageSchedulesRollupInvalidError creates a new JSMessageSchedulesRollupInvalidErr error: "message schedules invalid rollup"
1867
func NewJSMessageSchedulesRollupInvalidError(opts ...ErrorOption) *ApiError {
8✔
1868
        eopts := parseOpts(opts)
8✔
1869
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1870
                return ae
×
1871
        }
×
1872

1873
        return ApiErrors[JSMessageSchedulesRollupInvalidErr]
8✔
1874
}
1875

1876
// NewJSMessageSchedulesTTLInvalidError creates a new JSMessageSchedulesTTLInvalidErr error: "message schedules invalid per-message TTL"
1877
func NewJSMessageSchedulesTTLInvalidError(opts ...ErrorOption) *ApiError {
10✔
1878
        eopts := parseOpts(opts)
10✔
1879
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1880
                return ae
×
1881
        }
×
1882

1883
        return ApiErrors[JSMessageSchedulesTTLInvalidErr]
10✔
1884
}
1885

1886
// NewJSMessageSchedulesTargetInvalidError creates a new JSMessageSchedulesTargetInvalidErr error: "message schedules target is invalid"
1887
func NewJSMessageSchedulesTargetInvalidError(opts ...ErrorOption) *ApiError {
30✔
1888
        eopts := parseOpts(opts)
30✔
1889
        if ae, ok := eopts.err.(*ApiError); ok {
30✔
1890
                return ae
×
1891
        }
×
1892

1893
        return ApiErrors[JSMessageSchedulesTargetInvalidErr]
30✔
1894
}
1895

1896
// NewJSMessageTTLDisabledError creates a new JSMessageTTLDisabledErr error: "per-message TTL is disabled"
1897
func NewJSMessageTTLDisabledError(opts ...ErrorOption) *ApiError {
16✔
1898
        eopts := parseOpts(opts)
16✔
1899
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
1900
                return ae
×
1901
        }
×
1902

1903
        return ApiErrors[JSMessageTTLDisabledErr]
16✔
1904
}
1905

1906
// NewJSMessageTTLInvalidError creates a new JSMessageTTLInvalidErr error: "invalid per-message TTL"
1907
func NewJSMessageTTLInvalidError(opts ...ErrorOption) *ApiError {
23✔
1908
        eopts := parseOpts(opts)
23✔
1909
        if ae, ok := eopts.err.(*ApiError); ok {
23✔
1910
                return ae
×
1911
        }
×
1912

1913
        return ApiErrors[JSMessageTTLInvalidErr]
23✔
1914
}
1915

1916
// NewJSMirrorConsumerSetupFailedError creates a new JSMirrorConsumerSetupFailedErrF error: "{err}"
1917
func NewJSMirrorConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
1918
        eopts := parseOpts(opts)
×
1919
        if ae, ok := eopts.err.(*ApiError); ok {
×
1920
                return ae
×
1921
        }
×
1922

1923
        e := ApiErrors[JSMirrorConsumerSetupFailedErrF]
×
1924
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1925
        return &ApiError{
×
1926
                Code:        e.Code,
×
1927
                ErrCode:     e.ErrCode,
×
1928
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1929
        }
×
1930
}
1931

1932
// NewJSMirrorInvalidStreamNameError creates a new JSMirrorInvalidStreamName error: "mirrored stream name is invalid"
1933
func NewJSMirrorInvalidStreamNameError(opts ...ErrorOption) *ApiError {
×
1934
        eopts := parseOpts(opts)
×
1935
        if ae, ok := eopts.err.(*ApiError); ok {
×
1936
                return ae
×
1937
        }
×
1938

1939
        return ApiErrors[JSMirrorInvalidStreamName]
×
1940
}
1941

1942
// NewJSMirrorInvalidSubjectFilterError creates a new JSMirrorInvalidSubjectFilter error: "mirror transform source: {err}"
1943
func NewJSMirrorInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
2✔
1944
        eopts := parseOpts(opts)
2✔
1945
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1946
                return ae
×
1947
        }
×
1948

1949
        e := ApiErrors[JSMirrorInvalidSubjectFilter]
2✔
1950
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2✔
1951
        return &ApiError{
2✔
1952
                Code:        e.Code,
2✔
1953
                ErrCode:     e.ErrCode,
2✔
1954
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1955
        }
2✔
1956
}
1957

1958
// NewJSMirrorInvalidTransformDestinationError creates a new JSMirrorInvalidTransformDestination error: "mirror transform: {err}"
1959
func NewJSMirrorInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
2✔
1960
        eopts := parseOpts(opts)
2✔
1961
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1962
                return ae
×
1963
        }
×
1964

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

1974
// NewJSMirrorMaxMessageSizeTooBigError creates a new JSMirrorMaxMessageSizeTooBigErr error: "stream mirror must have max message size >= source"
1975
func NewJSMirrorMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
1976
        eopts := parseOpts(opts)
×
1977
        if ae, ok := eopts.err.(*ApiError); ok {
×
1978
                return ae
×
1979
        }
×
1980

1981
        return ApiErrors[JSMirrorMaxMessageSizeTooBigErr]
×
1982
}
1983

1984
// NewJSMirrorMultipleFiltersNotAllowedError creates a new JSMirrorMultipleFiltersNotAllowed error: "mirror with multiple subject transforms cannot also have a single subject filter"
1985
func NewJSMirrorMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
1986
        eopts := parseOpts(opts)
1✔
1987
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1988
                return ae
×
1989
        }
×
1990

1991
        return ApiErrors[JSMirrorMultipleFiltersNotAllowed]
1✔
1992
}
1993

1994
// NewJSMirrorOverlappingSubjectFiltersError creates a new JSMirrorOverlappingSubjectFilters error: "mirror subject filters can not overlap"
1995
func NewJSMirrorOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
2✔
1996
        eopts := parseOpts(opts)
2✔
1997
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1998
                return ae
×
1999
        }
×
2000

2001
        return ApiErrors[JSMirrorOverlappingSubjectFilters]
2✔
2002
}
2003

2004
// NewJSMirrorWithCountersError creates a new JSMirrorWithCountersErr error: "stream mirrors can not also calculate counters"
2005
func NewJSMirrorWithCountersError(opts ...ErrorOption) *ApiError {
4✔
2006
        eopts := parseOpts(opts)
4✔
2007
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2008
                return ae
×
2009
        }
×
2010

2011
        return ApiErrors[JSMirrorWithCountersErr]
4✔
2012
}
2013

2014
// NewJSMirrorWithFirstSeqError creates a new JSMirrorWithFirstSeqErr error: "stream mirrors can not have first sequence configured"
2015
func NewJSMirrorWithFirstSeqError(opts ...ErrorOption) *ApiError {
2✔
2016
        eopts := parseOpts(opts)
2✔
2017
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2018
                return ae
×
2019
        }
×
2020

2021
        return ApiErrors[JSMirrorWithFirstSeqErr]
2✔
2022
}
2023

2024
// NewJSMirrorWithMsgSchedulesError creates a new JSMirrorWithMsgSchedulesErr error: "stream mirrors can not also schedule messages"
2025
func NewJSMirrorWithMsgSchedulesError(opts ...ErrorOption) *ApiError {
2✔
2026
        eopts := parseOpts(opts)
2✔
2027
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2028
                return ae
×
2029
        }
×
2030

2031
        return ApiErrors[JSMirrorWithMsgSchedulesErr]
2✔
2032
}
2033

2034
// NewJSMirrorWithSourcesError creates a new JSMirrorWithSourcesErr error: "stream mirrors can not also contain other sources"
2035
func NewJSMirrorWithSourcesError(opts ...ErrorOption) *ApiError {
×
2036
        eopts := parseOpts(opts)
×
2037
        if ae, ok := eopts.err.(*ApiError); ok {
×
2038
                return ae
×
2039
        }
×
2040

2041
        return ApiErrors[JSMirrorWithSourcesErr]
×
2042
}
2043

2044
// NewJSMirrorWithStartSeqAndTimeError creates a new JSMirrorWithStartSeqAndTimeErr error: "stream mirrors can not have both start seq and start time configured"
2045
func NewJSMirrorWithStartSeqAndTimeError(opts ...ErrorOption) *ApiError {
×
2046
        eopts := parseOpts(opts)
×
2047
        if ae, ok := eopts.err.(*ApiError); ok {
×
2048
                return ae
×
2049
        }
×
2050

2051
        return ApiErrors[JSMirrorWithStartSeqAndTimeErr]
×
2052
}
2053

2054
// NewJSMirrorWithSubjectFiltersError creates a new JSMirrorWithSubjectFiltersErr error: "stream mirrors can not contain filtered subjects"
2055
func NewJSMirrorWithSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
2056
        eopts := parseOpts(opts)
×
2057
        if ae, ok := eopts.err.(*ApiError); ok {
×
2058
                return ae
×
2059
        }
×
2060

2061
        return ApiErrors[JSMirrorWithSubjectFiltersErr]
×
2062
}
2063

2064
// NewJSMirrorWithSubjectsError creates a new JSMirrorWithSubjectsErr error: "stream mirrors can not contain subjects"
2065
func NewJSMirrorWithSubjectsError(opts ...ErrorOption) *ApiError {
2✔
2066
        eopts := parseOpts(opts)
2✔
2067
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2068
                return ae
×
2069
        }
×
2070

2071
        return ApiErrors[JSMirrorWithSubjectsErr]
2✔
2072
}
2073

2074
// NewJSNoAccountError creates a new JSNoAccountErr error: "account not found"
2075
func NewJSNoAccountError(opts ...ErrorOption) *ApiError {
1✔
2076
        eopts := parseOpts(opts)
1✔
2077
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2078
                return ae
×
2079
        }
×
2080

2081
        return ApiErrors[JSNoAccountErr]
1✔
2082
}
2083

2084
// NewJSNoLimitsError creates a new JSNoLimitsErr error: "no JetStream default or applicable tiered limit present"
2085
func NewJSNoLimitsError(opts ...ErrorOption) *ApiError {
4✔
2086
        eopts := parseOpts(opts)
4✔
2087
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2088
                return ae
×
2089
        }
×
2090

2091
        return ApiErrors[JSNoLimitsErr]
4✔
2092
}
2093

2094
// NewJSNoMessageFoundError creates a new JSNoMessageFoundErr error: "no message found"
2095
func NewJSNoMessageFoundError(opts ...ErrorOption) *ApiError {
465✔
2096
        eopts := parseOpts(opts)
465✔
2097
        if ae, ok := eopts.err.(*ApiError); ok {
465✔
2098
                return ae
×
2099
        }
×
2100

2101
        return ApiErrors[JSNoMessageFoundErr]
465✔
2102
}
2103

2104
// NewJSNotEmptyRequestError creates a new JSNotEmptyRequestErr error: "expected an empty request payload"
2105
func NewJSNotEmptyRequestError(opts ...ErrorOption) *ApiError {
3✔
2106
        eopts := parseOpts(opts)
3✔
2107
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2108
                return ae
×
2109
        }
×
2110

2111
        return ApiErrors[JSNotEmptyRequestErr]
3✔
2112
}
2113

2114
// NewJSNotEnabledError creates a new JSNotEnabledErr error: "JetStream not enabled"
2115
func NewJSNotEnabledError(opts ...ErrorOption) *ApiError {
10✔
2116
        eopts := parseOpts(opts)
10✔
2117
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2118
                return ae
×
2119
        }
×
2120

2121
        return ApiErrors[JSNotEnabledErr]
10✔
2122
}
2123

2124
// NewJSNotEnabledForAccountError creates a new JSNotEnabledForAccountErr error: "JetStream not enabled for account"
2125
func NewJSNotEnabledForAccountError(opts ...ErrorOption) *ApiError {
309✔
2126
        eopts := parseOpts(opts)
309✔
2127
        if ae, ok := eopts.err.(*ApiError); ok {
309✔
2128
                return ae
×
2129
        }
×
2130

2131
        return ApiErrors[JSNotEnabledForAccountErr]
309✔
2132
}
2133

2134
// NewJSPedanticError creates a new JSPedanticErrF error: "pedantic mode: {err}"
2135
func NewJSPedanticError(err error, opts ...ErrorOption) *ApiError {
36✔
2136
        eopts := parseOpts(opts)
36✔
2137
        if ae, ok := eopts.err.(*ApiError); ok {
36✔
2138
                return ae
×
2139
        }
×
2140

2141
        e := ApiErrors[JSPedanticErrF]
36✔
2142
        args := e.toReplacerArgs([]interface{}{"{err}", err})
36✔
2143
        return &ApiError{
36✔
2144
                Code:        e.Code,
36✔
2145
                ErrCode:     e.ErrCode,
36✔
2146
                Description: strings.NewReplacer(args...).Replace(e.Description),
36✔
2147
        }
36✔
2148
}
2149

2150
// NewJSPeerRemapError creates a new JSPeerRemapErr error: "peer remap failed"
2151
func NewJSPeerRemapError(opts ...ErrorOption) *ApiError {
5✔
2152
        eopts := parseOpts(opts)
5✔
2153
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2154
                return ae
1✔
2155
        }
1✔
2156

2157
        return ApiErrors[JSPeerRemapErr]
4✔
2158
}
2159

2160
// NewJSRaftGeneralError creates a new JSRaftGeneralErrF error: "{err}"
2161
func NewJSRaftGeneralError(err error, opts ...ErrorOption) *ApiError {
×
2162
        eopts := parseOpts(opts)
×
2163
        if ae, ok := eopts.err.(*ApiError); ok {
×
2164
                return ae
×
2165
        }
×
2166

2167
        e := ApiErrors[JSRaftGeneralErrF]
×
2168
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2169
        return &ApiError{
×
2170
                Code:        e.Code,
×
2171
                ErrCode:     e.ErrCode,
×
2172
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2173
        }
×
2174
}
2175

2176
// NewJSReplicasCountCannotBeNegativeError creates a new JSReplicasCountCannotBeNegative error: "replicas count cannot be negative"
2177
func NewJSReplicasCountCannotBeNegativeError(opts ...ErrorOption) *ApiError {
16✔
2178
        eopts := parseOpts(opts)
16✔
2179
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2180
                return ae
×
2181
        }
×
2182

2183
        return ApiErrors[JSReplicasCountCannotBeNegative]
16✔
2184
}
2185

2186
// NewJSRequiredApiLevelError creates a new JSRequiredApiLevelErr error: "JetStream minimum api level required"
2187
func NewJSRequiredApiLevelError(opts ...ErrorOption) *ApiError {
56✔
2188
        eopts := parseOpts(opts)
56✔
2189
        if ae, ok := eopts.err.(*ApiError); ok {
56✔
2190
                return ae
×
2191
        }
×
2192

2193
        return ApiErrors[JSRequiredApiLevelErr]
56✔
2194
}
2195

2196
// NewJSRestoreSubscribeFailedError creates a new JSRestoreSubscribeFailedErrF error: "JetStream unable to subscribe to restore snapshot {subject}: {err}"
2197
func NewJSRestoreSubscribeFailedError(err error, subject interface{}, opts ...ErrorOption) *ApiError {
1✔
2198
        eopts := parseOpts(opts)
1✔
2199
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2200
                return ae
×
2201
        }
×
2202

2203
        e := ApiErrors[JSRestoreSubscribeFailedErrF]
1✔
2204
        args := e.toReplacerArgs([]interface{}{"{err}", err, "{subject}", subject})
1✔
2205
        return &ApiError{
1✔
2206
                Code:        e.Code,
1✔
2207
                ErrCode:     e.ErrCode,
1✔
2208
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2209
        }
1✔
2210
}
2211

2212
// NewJSSequenceNotFoundError creates a new JSSequenceNotFoundErrF error: "sequence {seq} not found"
2213
func NewJSSequenceNotFoundError(seq uint64, opts ...ErrorOption) *ApiError {
1✔
2214
        eopts := parseOpts(opts)
1✔
2215
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2216
                return ae
×
2217
        }
×
2218

2219
        e := ApiErrors[JSSequenceNotFoundErrF]
1✔
2220
        args := e.toReplacerArgs([]interface{}{"{seq}", seq})
1✔
2221
        return &ApiError{
1✔
2222
                Code:        e.Code,
1✔
2223
                ErrCode:     e.ErrCode,
1✔
2224
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2225
        }
1✔
2226
}
2227

2228
// NewJSSnapshotDeliverSubjectInvalidError creates a new JSSnapshotDeliverSubjectInvalidErr error: "deliver subject not valid"
2229
func NewJSSnapshotDeliverSubjectInvalidError(opts ...ErrorOption) *ApiError {
1✔
2230
        eopts := parseOpts(opts)
1✔
2231
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2232
                return ae
×
2233
        }
×
2234

2235
        return ApiErrors[JSSnapshotDeliverSubjectInvalidErr]
1✔
2236
}
2237

2238
// NewJSSourceConsumerSetupFailedError creates a new JSSourceConsumerSetupFailedErrF error: "{err}"
2239
func NewJSSourceConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
2240
        eopts := parseOpts(opts)
×
2241
        if ae, ok := eopts.err.(*ApiError); ok {
×
2242
                return ae
×
2243
        }
×
2244

2245
        e := ApiErrors[JSSourceConsumerSetupFailedErrF]
×
2246
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2247
        return &ApiError{
×
2248
                Code:        e.Code,
×
2249
                ErrCode:     e.ErrCode,
×
2250
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2251
        }
×
2252
}
2253

2254
// NewJSSourceDuplicateDetectedError creates a new JSSourceDuplicateDetected error: "duplicate source configuration detected"
2255
func NewJSSourceDuplicateDetectedError(opts ...ErrorOption) *ApiError {
×
2256
        eopts := parseOpts(opts)
×
2257
        if ae, ok := eopts.err.(*ApiError); ok {
×
2258
                return ae
×
2259
        }
×
2260

2261
        return ApiErrors[JSSourceDuplicateDetected]
×
2262
}
2263

2264
// NewJSSourceInvalidStreamNameError creates a new JSSourceInvalidStreamName error: "sourced stream name is invalid"
2265
func NewJSSourceInvalidStreamNameError(opts ...ErrorOption) *ApiError {
1✔
2266
        eopts := parseOpts(opts)
1✔
2267
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2268
                return ae
×
2269
        }
×
2270

2271
        return ApiErrors[JSSourceInvalidStreamName]
1✔
2272
}
2273

2274
// NewJSSourceInvalidSubjectFilterError creates a new JSSourceInvalidSubjectFilter error: "source transform source: {err}"
2275
func NewJSSourceInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
1✔
2276
        eopts := parseOpts(opts)
1✔
2277
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2278
                return ae
×
2279
        }
×
2280

2281
        e := ApiErrors[JSSourceInvalidSubjectFilter]
1✔
2282
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2283
        return &ApiError{
1✔
2284
                Code:        e.Code,
1✔
2285
                ErrCode:     e.ErrCode,
1✔
2286
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2287
        }
1✔
2288
}
2289

2290
// NewJSSourceInvalidTransformDestinationError creates a new JSSourceInvalidTransformDestination error: "source transform: {err}"
2291
func NewJSSourceInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
2292
        eopts := parseOpts(opts)
1✔
2293
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2294
                return ae
×
2295
        }
×
2296

2297
        e := ApiErrors[JSSourceInvalidTransformDestination]
1✔
2298
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2299
        return &ApiError{
1✔
2300
                Code:        e.Code,
1✔
2301
                ErrCode:     e.ErrCode,
1✔
2302
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2303
        }
1✔
2304
}
2305

2306
// NewJSSourceMaxMessageSizeTooBigError creates a new JSSourceMaxMessageSizeTooBigErr error: "stream source must have max message size >= target"
2307
func NewJSSourceMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
2308
        eopts := parseOpts(opts)
×
2309
        if ae, ok := eopts.err.(*ApiError); ok {
×
2310
                return ae
×
2311
        }
×
2312

2313
        return ApiErrors[JSSourceMaxMessageSizeTooBigErr]
×
2314
}
2315

2316
// NewJSSourceMultipleFiltersNotAllowedError creates a new JSSourceMultipleFiltersNotAllowed error: "source with multiple subject transforms cannot also have a single subject filter"
2317
func NewJSSourceMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
×
2318
        eopts := parseOpts(opts)
×
2319
        if ae, ok := eopts.err.(*ApiError); ok {
×
2320
                return ae
×
2321
        }
×
2322

2323
        return ApiErrors[JSSourceMultipleFiltersNotAllowed]
×
2324
}
2325

2326
// NewJSSourceOverlappingSubjectFiltersError creates a new JSSourceOverlappingSubjectFilters error: "source filters can not overlap"
2327
func NewJSSourceOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
2328
        eopts := parseOpts(opts)
×
2329
        if ae, ok := eopts.err.(*ApiError); ok {
×
2330
                return ae
×
2331
        }
×
2332

2333
        return ApiErrors[JSSourceOverlappingSubjectFilters]
×
2334
}
2335

2336
// NewJSSourceWithMsgSchedulesError creates a new JSSourceWithMsgSchedulesErr error: "stream source can not also schedule messages"
2337
func NewJSSourceWithMsgSchedulesError(opts ...ErrorOption) *ApiError {
2✔
2338
        eopts := parseOpts(opts)
2✔
2339
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2340
                return ae
×
2341
        }
×
2342

2343
        return ApiErrors[JSSourceWithMsgSchedulesErr]
2✔
2344
}
2345

2346
// NewJSStorageResourcesExceededError creates a new JSStorageResourcesExceededErr error: "insufficient storage resources available"
2347
func NewJSStorageResourcesExceededError(opts ...ErrorOption) *ApiError {
25✔
2348
        eopts := parseOpts(opts)
25✔
2349
        if ae, ok := eopts.err.(*ApiError); ok {
25✔
2350
                return ae
×
2351
        }
×
2352

2353
        return ApiErrors[JSStorageResourcesExceededErr]
25✔
2354
}
2355

2356
// NewJSStreamAssignmentError creates a new JSStreamAssignmentErrF error: "{err}"
2357
func NewJSStreamAssignmentError(err error, opts ...ErrorOption) *ApiError {
×
2358
        eopts := parseOpts(opts)
×
2359
        if ae, ok := eopts.err.(*ApiError); ok {
×
2360
                return ae
×
2361
        }
×
2362

2363
        e := ApiErrors[JSStreamAssignmentErrF]
×
2364
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2365
        return &ApiError{
×
2366
                Code:        e.Code,
×
2367
                ErrCode:     e.ErrCode,
×
2368
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2369
        }
×
2370
}
2371

2372
// NewJSStreamCreateError creates a new JSStreamCreateErrF error: "{err}"
2373
func NewJSStreamCreateError(err error, opts ...ErrorOption) *ApiError {
84✔
2374
        eopts := parseOpts(opts)
84✔
2375
        if ae, ok := eopts.err.(*ApiError); ok {
165✔
2376
                return ae
81✔
2377
        }
81✔
2378

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

2388
// NewJSStreamDeleteError creates a new JSStreamDeleteErrF error: "{err}"
2389
func NewJSStreamDeleteError(err error, opts ...ErrorOption) *ApiError {
×
2390
        eopts := parseOpts(opts)
×
2391
        if ae, ok := eopts.err.(*ApiError); ok {
×
2392
                return ae
×
2393
        }
×
2394

2395
        e := ApiErrors[JSStreamDeleteErrF]
×
2396
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2397
        return &ApiError{
×
2398
                Code:        e.Code,
×
2399
                ErrCode:     e.ErrCode,
×
2400
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2401
        }
×
2402
}
2403

2404
// NewJSStreamDuplicateMessageConflictError creates a new JSStreamDuplicateMessageConflict error: "duplicate message id is in process"
2405
func NewJSStreamDuplicateMessageConflictError(opts ...ErrorOption) *ApiError {
48✔
2406
        eopts := parseOpts(opts)
48✔
2407
        if ae, ok := eopts.err.(*ApiError); ok {
48✔
2408
                return ae
×
2409
        }
×
2410

2411
        return ApiErrors[JSStreamDuplicateMessageConflict]
48✔
2412
}
2413

2414
// NewJSStreamExpectedLastSeqPerSubjectInvalidError creates a new JSStreamExpectedLastSeqPerSubjectInvalid error: "missing sequence for expected last sequence per subject"
2415
func NewJSStreamExpectedLastSeqPerSubjectInvalidError(opts ...ErrorOption) *ApiError {
8✔
2416
        eopts := parseOpts(opts)
8✔
2417
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
2418
                return ae
×
2419
        }
×
2420

2421
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectInvalid]
8✔
2422
}
2423

2424
// NewJSStreamExpectedLastSeqPerSubjectNotReadyError creates a new JSStreamExpectedLastSeqPerSubjectNotReady error: "expected last sequence per subject temporarily unavailable"
2425
func NewJSStreamExpectedLastSeqPerSubjectNotReadyError(opts ...ErrorOption) *ApiError {
×
2426
        eopts := parseOpts(opts)
×
2427
        if ae, ok := eopts.err.(*ApiError); ok {
×
2428
                return ae
×
2429
        }
×
2430

2431
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectNotReady]
×
2432
}
2433

2434
// NewJSStreamExternalApiOverlapError creates a new JSStreamExternalApiOverlapErrF error: "stream external api prefix {prefix} must not overlap with {subject}"
2435
func NewJSStreamExternalApiOverlapError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
2✔
2436
        eopts := parseOpts(opts)
2✔
2437
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2438
                return ae
×
2439
        }
×
2440

2441
        e := ApiErrors[JSStreamExternalApiOverlapErrF]
2✔
2442
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
2✔
2443
        return &ApiError{
2✔
2444
                Code:        e.Code,
2✔
2445
                ErrCode:     e.ErrCode,
2✔
2446
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2447
        }
2✔
2448
}
2449

2450
// NewJSStreamExternalDelPrefixOverlapsError creates a new JSStreamExternalDelPrefixOverlapsErrF error: "stream external delivery prefix {prefix} overlaps with stream subject {subject}"
2451
func NewJSStreamExternalDelPrefixOverlapsError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
×
2452
        eopts := parseOpts(opts)
×
2453
        if ae, ok := eopts.err.(*ApiError); ok {
×
2454
                return ae
×
2455
        }
×
2456

2457
        e := ApiErrors[JSStreamExternalDelPrefixOverlapsErrF]
×
2458
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
×
2459
        return &ApiError{
×
2460
                Code:        e.Code,
×
2461
                ErrCode:     e.ErrCode,
×
2462
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2463
        }
×
2464
}
2465

2466
// NewJSStreamGeneralError creates a new JSStreamGeneralErrorF error: "{err}"
2467
func NewJSStreamGeneralError(err error, opts ...ErrorOption) *ApiError {
3✔
2468
        eopts := parseOpts(opts)
3✔
2469
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2470
                return ae
×
2471
        }
×
2472

2473
        e := ApiErrors[JSStreamGeneralErrorF]
3✔
2474
        args := e.toReplacerArgs([]interface{}{"{err}", err})
3✔
2475
        return &ApiError{
3✔
2476
                Code:        e.Code,
3✔
2477
                ErrCode:     e.ErrCode,
3✔
2478
                Description: strings.NewReplacer(args...).Replace(e.Description),
3✔
2479
        }
3✔
2480
}
2481

2482
// NewJSStreamHeaderExceedsMaximumError creates a new JSStreamHeaderExceedsMaximumErr error: "header size exceeds maximum allowed of 64k"
2483
func NewJSStreamHeaderExceedsMaximumError(opts ...ErrorOption) *ApiError {
1✔
2484
        eopts := parseOpts(opts)
1✔
2485
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2486
                return ae
×
2487
        }
×
2488

2489
        return ApiErrors[JSStreamHeaderExceedsMaximumErr]
1✔
2490
}
2491

2492
// NewJSStreamInfoMaxSubjectsError creates a new JSStreamInfoMaxSubjectsErr error: "subject details would exceed maximum allowed"
2493
func NewJSStreamInfoMaxSubjectsError(opts ...ErrorOption) *ApiError {
×
2494
        eopts := parseOpts(opts)
×
2495
        if ae, ok := eopts.err.(*ApiError); ok {
×
2496
                return ae
×
2497
        }
×
2498

2499
        return ApiErrors[JSStreamInfoMaxSubjectsErr]
×
2500
}
2501

2502
// NewJSStreamInvalidConfigError creates a new JSStreamInvalidConfigF error: "{err}"
2503
func NewJSStreamInvalidConfigError(err error, opts ...ErrorOption) *ApiError {
148✔
2504
        eopts := parseOpts(opts)
148✔
2505
        if ae, ok := eopts.err.(*ApiError); ok {
170✔
2506
                return ae
22✔
2507
        }
22✔
2508

2509
        e := ApiErrors[JSStreamInvalidConfigF]
126✔
2510
        args := e.toReplacerArgs([]interface{}{"{err}", err})
126✔
2511
        return &ApiError{
126✔
2512
                Code:        e.Code,
126✔
2513
                ErrCode:     e.ErrCode,
126✔
2514
                Description: strings.NewReplacer(args...).Replace(e.Description),
126✔
2515
        }
126✔
2516
}
2517

2518
// NewJSStreamInvalidError creates a new JSStreamInvalidErr error: "stream not valid"
2519
func NewJSStreamInvalidError(opts ...ErrorOption) *ApiError {
×
2520
        eopts := parseOpts(opts)
×
2521
        if ae, ok := eopts.err.(*ApiError); ok {
×
2522
                return ae
×
2523
        }
×
2524

2525
        return ApiErrors[JSStreamInvalidErr]
×
2526
}
2527

2528
// NewJSStreamInvalidExternalDeliverySubjError creates a new JSStreamInvalidExternalDeliverySubjErrF error: "stream external delivery prefix {prefix} must not contain wildcards"
2529
func NewJSStreamInvalidExternalDeliverySubjError(prefix interface{}, opts ...ErrorOption) *ApiError {
×
2530
        eopts := parseOpts(opts)
×
2531
        if ae, ok := eopts.err.(*ApiError); ok {
×
2532
                return ae
×
2533
        }
×
2534

2535
        e := ApiErrors[JSStreamInvalidExternalDeliverySubjErrF]
×
2536
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix})
×
2537
        return &ApiError{
×
2538
                Code:        e.Code,
×
2539
                ErrCode:     e.ErrCode,
×
2540
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2541
        }
×
2542
}
2543

2544
// NewJSStreamLimitsError creates a new JSStreamLimitsErrF error: "{err}"
2545
func NewJSStreamLimitsError(err error, opts ...ErrorOption) *ApiError {
8✔
2546
        eopts := parseOpts(opts)
8✔
2547
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2548
                return ae
8✔
2549
        }
8✔
2550

2551
        e := ApiErrors[JSStreamLimitsErrF]
×
2552
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2553
        return &ApiError{
×
2554
                Code:        e.Code,
×
2555
                ErrCode:     e.ErrCode,
×
2556
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2557
        }
×
2558
}
2559

2560
// NewJSStreamMaxBytesRequiredError creates a new JSStreamMaxBytesRequired error: "account requires a stream config to have max bytes set"
2561
func NewJSStreamMaxBytesRequiredError(opts ...ErrorOption) *ApiError {
3✔
2562
        eopts := parseOpts(opts)
3✔
2563
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2564
                return ae
×
2565
        }
×
2566

2567
        return ApiErrors[JSStreamMaxBytesRequired]
3✔
2568
}
2569

2570
// NewJSStreamMaxStreamBytesExceededError creates a new JSStreamMaxStreamBytesExceeded error: "stream max bytes exceeds account limit max stream bytes"
2571
func NewJSStreamMaxStreamBytesExceededError(opts ...ErrorOption) *ApiError {
2✔
2572
        eopts := parseOpts(opts)
2✔
2573
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2574
                return ae
×
2575
        }
×
2576

2577
        return ApiErrors[JSStreamMaxStreamBytesExceeded]
2✔
2578
}
2579

2580
// NewJSStreamMessageExceedsMaximumError creates a new JSStreamMessageExceedsMaximumErr error: "message size exceeds maximum allowed"
2581
func NewJSStreamMessageExceedsMaximumError(opts ...ErrorOption) *ApiError {
19✔
2582
        eopts := parseOpts(opts)
19✔
2583
        if ae, ok := eopts.err.(*ApiError); ok {
19✔
2584
                return ae
×
2585
        }
×
2586

2587
        return ApiErrors[JSStreamMessageExceedsMaximumErr]
19✔
2588
}
2589

2590
// NewJSStreamMinLastSeqError creates a new JSStreamMinLastSeqErr error: "min last sequence"
2591
func NewJSStreamMinLastSeqError(opts ...ErrorOption) *ApiError {
×
2592
        eopts := parseOpts(opts)
×
2593
        if ae, ok := eopts.err.(*ApiError); ok {
×
2594
                return ae
×
2595
        }
×
2596

2597
        return ApiErrors[JSStreamMinLastSeqErr]
×
2598
}
2599

2600
// NewJSStreamMirrorNotUpdatableError creates a new JSStreamMirrorNotUpdatableErr error: "stream mirror configuration can not be updated"
2601
func NewJSStreamMirrorNotUpdatableError(opts ...ErrorOption) *ApiError {
2✔
2602
        eopts := parseOpts(opts)
2✔
2603
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2604
                return ae
×
2605
        }
×
2606

2607
        return ApiErrors[JSStreamMirrorNotUpdatableErr]
2✔
2608
}
2609

2610
// NewJSStreamMismatchError creates a new JSStreamMismatchErr error: "stream name in subject does not match request"
2611
func NewJSStreamMismatchError(opts ...ErrorOption) *ApiError {
3✔
2612
        eopts := parseOpts(opts)
3✔
2613
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2614
                return ae
×
2615
        }
×
2616

2617
        return ApiErrors[JSStreamMismatchErr]
3✔
2618
}
2619

2620
// NewJSStreamMoveAndScaleError creates a new JSStreamMoveAndScaleErr error: "can not move and scale a stream in a single update"
2621
func NewJSStreamMoveAndScaleError(opts ...ErrorOption) *ApiError {
4✔
2622
        eopts := parseOpts(opts)
4✔
2623
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2624
                return ae
×
2625
        }
×
2626

2627
        return ApiErrors[JSStreamMoveAndScaleErr]
4✔
2628
}
2629

2630
// NewJSStreamMoveInProgressError creates a new JSStreamMoveInProgressF error: "stream move already in progress: {msg}"
2631
func NewJSStreamMoveInProgressError(msg interface{}, opts ...ErrorOption) *ApiError {
2✔
2632
        eopts := parseOpts(opts)
2✔
2633
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2634
                return ae
×
2635
        }
×
2636

2637
        e := ApiErrors[JSStreamMoveInProgressF]
2✔
2638
        args := e.toReplacerArgs([]interface{}{"{msg}", msg})
2✔
2639
        return &ApiError{
2✔
2640
                Code:        e.Code,
2✔
2641
                ErrCode:     e.ErrCode,
2✔
2642
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2643
        }
2✔
2644
}
2645

2646
// NewJSStreamMoveNotInProgressError creates a new JSStreamMoveNotInProgress error: "stream move not in progress"
2647
func NewJSStreamMoveNotInProgressError(opts ...ErrorOption) *ApiError {
×
2648
        eopts := parseOpts(opts)
×
2649
        if ae, ok := eopts.err.(*ApiError); ok {
×
2650
                return ae
×
2651
        }
×
2652

2653
        return ApiErrors[JSStreamMoveNotInProgress]
×
2654
}
2655

2656
// NewJSStreamMsgDeleteFailedError creates a new JSStreamMsgDeleteFailedF error: "{err}"
2657
func NewJSStreamMsgDeleteFailedError(err error, opts ...ErrorOption) *ApiError {
1✔
2658
        eopts := parseOpts(opts)
1✔
2659
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2660
                return ae
×
2661
        }
×
2662

2663
        e := ApiErrors[JSStreamMsgDeleteFailedF]
1✔
2664
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2665
        return &ApiError{
1✔
2666
                Code:        e.Code,
1✔
2667
                ErrCode:     e.ErrCode,
1✔
2668
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2669
        }
1✔
2670
}
2671

2672
// NewJSStreamNameContainsPathSeparatorsError creates a new JSStreamNameContainsPathSeparatorsErr error: "Stream name can not contain path separators"
2673
func NewJSStreamNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
6✔
2674
        eopts := parseOpts(opts)
6✔
2675
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2676
                return ae
×
2677
        }
×
2678

2679
        return ApiErrors[JSStreamNameContainsPathSeparatorsErr]
6✔
2680
}
2681

2682
// NewJSStreamNameExistError creates a new JSStreamNameExistErr error: "stream name already in use with a different configuration"
2683
func NewJSStreamNameExistError(opts ...ErrorOption) *ApiError {
10✔
2684
        eopts := parseOpts(opts)
10✔
2685
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2686
                return ae
×
2687
        }
×
2688

2689
        return ApiErrors[JSStreamNameExistErr]
10✔
2690
}
2691

2692
// NewJSStreamNameExistRestoreFailedError creates a new JSStreamNameExistRestoreFailedErr error: "stream name already in use, cannot restore"
2693
func NewJSStreamNameExistRestoreFailedError(opts ...ErrorOption) *ApiError {
3✔
2694
        eopts := parseOpts(opts)
3✔
2695
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2696
                return ae
×
2697
        }
×
2698

2699
        return ApiErrors[JSStreamNameExistRestoreFailedErr]
3✔
2700
}
2701

2702
// NewJSStreamNotFoundError creates a new JSStreamNotFoundErr error: "stream not found"
2703
func NewJSStreamNotFoundError(opts ...ErrorOption) *ApiError {
25,568✔
2704
        eopts := parseOpts(opts)
25,568✔
2705
        if ae, ok := eopts.err.(*ApiError); ok {
26,237✔
2706
                return ae
669✔
2707
        }
669✔
2708

2709
        return ApiErrors[JSStreamNotFoundErr]
24,899✔
2710
}
2711

2712
// NewJSStreamNotMatchError creates a new JSStreamNotMatchErr error: "expected stream does not match"
2713
func NewJSStreamNotMatchError(opts ...ErrorOption) *ApiError {
5✔
2714
        eopts := parseOpts(opts)
5✔
2715
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2716
                return ae
×
2717
        }
×
2718

2719
        return ApiErrors[JSStreamNotMatchErr]
5✔
2720
}
2721

2722
// NewJSStreamOfflineError creates a new JSStreamOfflineErr error: "stream is offline"
2723
func NewJSStreamOfflineError(opts ...ErrorOption) *ApiError {
6✔
2724
        eopts := parseOpts(opts)
6✔
2725
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2726
                return ae
×
2727
        }
×
2728

2729
        return ApiErrors[JSStreamOfflineErr]
6✔
2730
}
2731

2732
// NewJSStreamOfflineReasonError creates a new JSStreamOfflineReasonErrF error: "stream is offline: {err}"
2733
func NewJSStreamOfflineReasonError(err error, opts ...ErrorOption) *ApiError {
40✔
2734
        eopts := parseOpts(opts)
40✔
2735
        if ae, ok := eopts.err.(*ApiError); ok {
40✔
2736
                return ae
×
2737
        }
×
2738

2739
        e := ApiErrors[JSStreamOfflineReasonErrF]
40✔
2740
        args := e.toReplacerArgs([]interface{}{"{err}", err})
40✔
2741
        return &ApiError{
40✔
2742
                Code:        e.Code,
40✔
2743
                ErrCode:     e.ErrCode,
40✔
2744
                Description: strings.NewReplacer(args...).Replace(e.Description),
40✔
2745
        }
40✔
2746
}
2747

2748
// NewJSStreamPurgeFailedError creates a new JSStreamPurgeFailedF error: "{err}"
2749
func NewJSStreamPurgeFailedError(err error, opts ...ErrorOption) *ApiError {
1✔
2750
        eopts := parseOpts(opts)
1✔
2751
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2752
                return ae
×
2753
        }
×
2754

2755
        e := ApiErrors[JSStreamPurgeFailedF]
1✔
2756
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2757
        return &ApiError{
1✔
2758
                Code:        e.Code,
1✔
2759
                ErrCode:     e.ErrCode,
1✔
2760
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2761
        }
1✔
2762
}
2763

2764
// NewJSStreamReplicasNotSupportedError creates a new JSStreamReplicasNotSupportedErr error: "replicas > 1 not supported in non-clustered mode"
2765
func NewJSStreamReplicasNotSupportedError(opts ...ErrorOption) *ApiError {
1✔
2766
        eopts := parseOpts(opts)
1✔
2767
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2768
                return ae
×
2769
        }
×
2770

2771
        return ApiErrors[JSStreamReplicasNotSupportedErr]
1✔
2772
}
2773

2774
// NewJSStreamReplicasNotUpdatableError creates a new JSStreamReplicasNotUpdatableErr error: "Replicas configuration can not be updated"
2775
func NewJSStreamReplicasNotUpdatableError(opts ...ErrorOption) *ApiError {
×
2776
        eopts := parseOpts(opts)
×
2777
        if ae, ok := eopts.err.(*ApiError); ok {
×
2778
                return ae
×
2779
        }
×
2780

2781
        return ApiErrors[JSStreamReplicasNotUpdatableErr]
×
2782
}
2783

2784
// NewJSStreamRestoreError creates a new JSStreamRestoreErrF error: "restore failed: {err}"
2785
func NewJSStreamRestoreError(err error, opts ...ErrorOption) *ApiError {
7✔
2786
        eopts := parseOpts(opts)
7✔
2787
        if ae, ok := eopts.err.(*ApiError); ok {
9✔
2788
                return ae
2✔
2789
        }
2✔
2790

2791
        e := ApiErrors[JSStreamRestoreErrF]
5✔
2792
        args := e.toReplacerArgs([]interface{}{"{err}", err})
5✔
2793
        return &ApiError{
5✔
2794
                Code:        e.Code,
5✔
2795
                ErrCode:     e.ErrCode,
5✔
2796
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
2797
        }
5✔
2798
}
2799

2800
// NewJSStreamRollupFailedError creates a new JSStreamRollupFailedF error: "{err}"
2801
func NewJSStreamRollupFailedError(err error, opts ...ErrorOption) *ApiError {
13✔
2802
        eopts := parseOpts(opts)
13✔
2803
        if ae, ok := eopts.err.(*ApiError); ok {
13✔
2804
                return ae
×
2805
        }
×
2806

2807
        e := ApiErrors[JSStreamRollupFailedF]
13✔
2808
        args := e.toReplacerArgs([]interface{}{"{err}", err})
13✔
2809
        return &ApiError{
13✔
2810
                Code:        e.Code,
13✔
2811
                ErrCode:     e.ErrCode,
13✔
2812
                Description: strings.NewReplacer(args...).Replace(e.Description),
13✔
2813
        }
13✔
2814
}
2815

2816
// NewJSStreamSealedError creates a new JSStreamSealedErr error: "invalid operation on sealed stream"
2817
func NewJSStreamSealedError(opts ...ErrorOption) *ApiError {
10✔
2818
        eopts := parseOpts(opts)
10✔
2819
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2820
                return ae
×
2821
        }
×
2822

2823
        return ApiErrors[JSStreamSealedErr]
10✔
2824
}
2825

2826
// NewJSStreamSequenceNotMatchError creates a new JSStreamSequenceNotMatchErr error: "expected stream sequence does not match"
2827
func NewJSStreamSequenceNotMatchError(opts ...ErrorOption) *ApiError {
×
2828
        eopts := parseOpts(opts)
×
2829
        if ae, ok := eopts.err.(*ApiError); ok {
×
2830
                return ae
×
2831
        }
×
2832

2833
        return ApiErrors[JSStreamSequenceNotMatchErr]
×
2834
}
2835

2836
// NewJSStreamSnapshotError creates a new JSStreamSnapshotErrF error: "snapshot failed: {err}"
2837
func NewJSStreamSnapshotError(err error, opts ...ErrorOption) *ApiError {
×
2838
        eopts := parseOpts(opts)
×
2839
        if ae, ok := eopts.err.(*ApiError); ok {
×
2840
                return ae
×
2841
        }
×
2842

2843
        e := ApiErrors[JSStreamSnapshotErrF]
×
2844
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2845
        return &ApiError{
×
2846
                Code:        e.Code,
×
2847
                ErrCode:     e.ErrCode,
×
2848
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2849
        }
×
2850
}
2851

2852
// NewJSStreamStoreFailedError creates a new JSStreamStoreFailedF error: "{err}"
2853
func NewJSStreamStoreFailedError(err error, opts ...ErrorOption) *ApiError {
1,999✔
2854
        eopts := parseOpts(opts)
1,999✔
2855
        if ae, ok := eopts.err.(*ApiError); ok {
1,999✔
2856
                return ae
×
2857
        }
×
2858

2859
        e := ApiErrors[JSStreamStoreFailedF]
1,999✔
2860
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1,999✔
2861
        return &ApiError{
1,999✔
2862
                Code:        e.Code,
1,999✔
2863
                ErrCode:     e.ErrCode,
1,999✔
2864
                Description: strings.NewReplacer(args...).Replace(e.Description),
1,999✔
2865
        }
1,999✔
2866
}
2867

2868
// NewJSStreamSubjectOverlapError creates a new JSStreamSubjectOverlapErr error: "subjects overlap with an existing stream"
2869
func NewJSStreamSubjectOverlapError(opts ...ErrorOption) *ApiError {
43✔
2870
        eopts := parseOpts(opts)
43✔
2871
        if ae, ok := eopts.err.(*ApiError); ok {
43✔
2872
                return ae
×
2873
        }
×
2874

2875
        return ApiErrors[JSStreamSubjectOverlapErr]
43✔
2876
}
2877

2878
// NewJSStreamTemplateCreateError creates a new JSStreamTemplateCreateErrF error: "{err}"
2879
func NewJSStreamTemplateCreateError(err error, opts ...ErrorOption) *ApiError {
×
2880
        eopts := parseOpts(opts)
×
2881
        if ae, ok := eopts.err.(*ApiError); ok {
×
2882
                return ae
×
2883
        }
×
2884

2885
        e := ApiErrors[JSStreamTemplateCreateErrF]
×
2886
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2887
        return &ApiError{
×
2888
                Code:        e.Code,
×
2889
                ErrCode:     e.ErrCode,
×
2890
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2891
        }
×
2892
}
2893

2894
// NewJSStreamTemplateDeleteError creates a new JSStreamTemplateDeleteErrF error: "{err}"
2895
func NewJSStreamTemplateDeleteError(err error, opts ...ErrorOption) *ApiError {
1✔
2896
        eopts := parseOpts(opts)
1✔
2897
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2898
                return ae
1✔
2899
        }
1✔
2900

2901
        e := ApiErrors[JSStreamTemplateDeleteErrF]
×
2902
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2903
        return &ApiError{
×
2904
                Code:        e.Code,
×
2905
                ErrCode:     e.ErrCode,
×
2906
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2907
        }
×
2908
}
2909

2910
// NewJSStreamTemplateNotFoundError creates a new JSStreamTemplateNotFoundErr error: "template not found"
2911
func NewJSStreamTemplateNotFoundError(opts ...ErrorOption) *ApiError {
4✔
2912
        eopts := parseOpts(opts)
4✔
2913
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2914
                return ae
×
2915
        }
×
2916

2917
        return ApiErrors[JSStreamTemplateNotFoundErr]
4✔
2918
}
2919

2920
// NewJSStreamTooManyRequestsError creates a new JSStreamTooManyRequests error: "too many requests"
2921
func NewJSStreamTooManyRequestsError(opts ...ErrorOption) *ApiError {
188✔
2922
        eopts := parseOpts(opts)
188✔
2923
        if ae, ok := eopts.err.(*ApiError); ok {
188✔
2924
                return ae
×
2925
        }
×
2926

2927
        return ApiErrors[JSStreamTooManyRequests]
188✔
2928
}
2929

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

2937
        e := ApiErrors[JSStreamTransformInvalidDestination]
1✔
2938
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2939
        return &ApiError{
1✔
2940
                Code:        e.Code,
1✔
2941
                ErrCode:     e.ErrCode,
1✔
2942
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2943
        }
1✔
2944
}
2945

2946
// NewJSStreamTransformInvalidSourceError creates a new JSStreamTransformInvalidSource error: "stream transform source: {err}"
2947
func NewJSStreamTransformInvalidSourceError(err error, opts ...ErrorOption) *ApiError {
1✔
2948
        eopts := parseOpts(opts)
1✔
2949
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2950
                return ae
×
2951
        }
×
2952

2953
        e := ApiErrors[JSStreamTransformInvalidSource]
1✔
2954
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2955
        return &ApiError{
1✔
2956
                Code:        e.Code,
1✔
2957
                ErrCode:     e.ErrCode,
1✔
2958
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2959
        }
1✔
2960
}
2961

2962
// NewJSStreamUpdateError creates a new JSStreamUpdateErrF error: "{err}"
2963
func NewJSStreamUpdateError(err error, opts ...ErrorOption) *ApiError {
24✔
2964
        eopts := parseOpts(opts)
24✔
2965
        if ae, ok := eopts.err.(*ApiError); ok {
42✔
2966
                return ae
18✔
2967
        }
18✔
2968

2969
        e := ApiErrors[JSStreamUpdateErrF]
6✔
2970
        args := e.toReplacerArgs([]interface{}{"{err}", err})
6✔
2971
        return &ApiError{
6✔
2972
                Code:        e.Code,
6✔
2973
                ErrCode:     e.ErrCode,
6✔
2974
                Description: strings.NewReplacer(args...).Replace(e.Description),
6✔
2975
        }
6✔
2976
}
2977

2978
// NewJSStreamWrongLastMsgIDError creates a new JSStreamWrongLastMsgIDErrF error: "wrong last msg ID: {id}"
2979
func NewJSStreamWrongLastMsgIDError(id interface{}, opts ...ErrorOption) *ApiError {
5✔
2980
        eopts := parseOpts(opts)
5✔
2981
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2982
                return ae
×
2983
        }
×
2984

2985
        e := ApiErrors[JSStreamWrongLastMsgIDErrF]
5✔
2986
        args := e.toReplacerArgs([]interface{}{"{id}", id})
5✔
2987
        return &ApiError{
5✔
2988
                Code:        e.Code,
5✔
2989
                ErrCode:     e.ErrCode,
5✔
2990
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
2991
        }
5✔
2992
}
2993

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

3001
        return ApiErrors[JSStreamWrongLastSequenceConstantErr]
23✔
3002
}
3003

3004
// NewJSStreamWrongLastSequenceError creates a new JSStreamWrongLastSequenceErrF error: "wrong last sequence: {seq}"
3005
func NewJSStreamWrongLastSequenceError(seq uint64, opts ...ErrorOption) *ApiError {
95✔
3006
        eopts := parseOpts(opts)
95✔
3007
        if ae, ok := eopts.err.(*ApiError); ok {
95✔
3008
                return ae
×
3009
        }
×
3010

3011
        e := ApiErrors[JSStreamWrongLastSequenceErrF]
95✔
3012
        args := e.toReplacerArgs([]interface{}{"{seq}", seq})
95✔
3013
        return &ApiError{
95✔
3014
                Code:        e.Code,
95✔
3015
                ErrCode:     e.ErrCode,
95✔
3016
                Description: strings.NewReplacer(args...).Replace(e.Description),
95✔
3017
        }
95✔
3018
}
3019

3020
// NewJSTempStorageFailedError creates a new JSTempStorageFailedErr error: "JetStream unable to open temp storage for restore"
3021
func NewJSTempStorageFailedError(opts ...ErrorOption) *ApiError {
×
3022
        eopts := parseOpts(opts)
×
3023
        if ae, ok := eopts.err.(*ApiError); ok {
×
3024
                return ae
×
3025
        }
×
3026

3027
        return ApiErrors[JSTempStorageFailedErr]
×
3028
}
3029

3030
// NewJSTemplateNameNotMatchSubjectError creates a new JSTemplateNameNotMatchSubjectErr error: "template name in subject does not match request"
3031
func NewJSTemplateNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
1✔
3032
        eopts := parseOpts(opts)
1✔
3033
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3034
                return ae
×
3035
        }
×
3036

3037
        return ApiErrors[JSTemplateNameNotMatchSubjectErr]
1✔
3038
}
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