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

nats-io / nats-server / 20771013472

06 Jan 2026 10:29AM UTC coverage: 84.61% (+0.3%) from 84.295%
20771013472

push

github

web-flow
Reduce contention on `ConsumerStore` creation (#7700)

Previously creating a `ConsumerStore` required taking the stream lock to
determine whether the parent stream store was closed or not. Switch to
an atomic so that this no longer requires the lock.

This should speed up creating consumers in a system where the streams
are heavily loaded or contended.

Signed-off-by: Neil Twigg <neil@nats.io>

74103 of 87582 relevant lines covered (84.61%)

328263.11 hits per line

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

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

3
package server
4

5
import "strings"
6

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

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

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

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

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

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

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

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

32
        // JSAtomicPublishUnsupportedHeaderBatchErr atomic publish unsupported header used: {header}
33
        JSAtomicPublishUnsupportedHeaderBatchErr ErrorIdentifier = 10177
34

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

38
        // JSClusterIncompleteErr incomplete results
39
        JSClusterIncompleteErr ErrorIdentifier = 10004
40

41
        // JSClusterNoPeersErrF Error causing no peers to be available ({err})
42
        JSClusterNoPeersErrF ErrorIdentifier = 10005
43

44
        // JSClusterNotActiveErr JetStream not in clustered mode
45
        JSClusterNotActiveErr ErrorIdentifier = 10006
46

47
        // JSClusterNotAssignedErr JetStream cluster not assigned to this server
48
        JSClusterNotAssignedErr ErrorIdentifier = 10007
49

50
        // JSClusterNotAvailErr JetStream system temporarily unavailable
51
        JSClusterNotAvailErr ErrorIdentifier = 10008
52

53
        // JSClusterNotLeaderErr JetStream cluster can not handle request
54
        JSClusterNotLeaderErr ErrorIdentifier = 10009
55

56
        // JSClusterPeerNotMemberErr peer not a member
57
        JSClusterPeerNotMemberErr ErrorIdentifier = 10040
58

59
        // JSClusterRequiredErr JetStream clustering support required
60
        JSClusterRequiredErr ErrorIdentifier = 10010
61

62
        // JSClusterServerMemberChangeInflightErr cluster member change is in progress
63
        JSClusterServerMemberChangeInflightErr ErrorIdentifier = 10202
64

65
        // JSClusterServerNotMemberErr server is not a member of the cluster
66
        JSClusterServerNotMemberErr ErrorIdentifier = 10044
67

68
        // JSClusterTagsErr tags placement not supported for operation
69
        JSClusterTagsErr ErrorIdentifier = 10011
70

71
        // JSClusterUnSupportFeatureErr not currently supported in clustered mode
72
        JSClusterUnSupportFeatureErr ErrorIdentifier = 10036
73

74
        // JSConsumerAckPolicyInvalidErr consumer ack policy invalid
75
        JSConsumerAckPolicyInvalidErr ErrorIdentifier = 10181
76

77
        // JSConsumerAckWaitNegativeErr consumer ack wait needs to be positive
78
        JSConsumerAckWaitNegativeErr ErrorIdentifier = 10183
79

80
        // JSConsumerAlreadyExists action CREATE is used for a existing consumer with a different config (consumer already exists)
81
        JSConsumerAlreadyExists ErrorIdentifier = 10148
82

83
        // JSConsumerBackOffNegativeErr consumer backoff needs to be positive
84
        JSConsumerBackOffNegativeErr ErrorIdentifier = 10184
85

86
        // JSConsumerBadDurableNameErr durable name can not contain '.', '*', '>'
87
        JSConsumerBadDurableNameErr ErrorIdentifier = 10103
88

89
        // JSConsumerConfigRequiredErr consumer config required
90
        JSConsumerConfigRequiredErr ErrorIdentifier = 10078
91

92
        // JSConsumerCreateDurableAndNameMismatch Consumer Durable and Name have to be equal if both are provided
93
        JSConsumerCreateDurableAndNameMismatch ErrorIdentifier = 10132
94

95
        // JSConsumerCreateErrF General consumer creation failure string ({err})
96
        JSConsumerCreateErrF ErrorIdentifier = 10012
97

98
        // JSConsumerCreateFilterSubjectMismatchErr Consumer create request did not match filtered subject from create subject
99
        JSConsumerCreateFilterSubjectMismatchErr ErrorIdentifier = 10131
100

101
        // JSConsumerDeliverCycleErr consumer deliver subject forms a cycle
102
        JSConsumerDeliverCycleErr ErrorIdentifier = 10081
103

104
        // JSConsumerDeliverToWildcardsErr consumer deliver subject has wildcards
105
        JSConsumerDeliverToWildcardsErr ErrorIdentifier = 10079
106

107
        // JSConsumerDescriptionTooLongErrF consumer description is too long, maximum allowed is {max}
108
        JSConsumerDescriptionTooLongErrF ErrorIdentifier = 10107
109

110
        // JSConsumerDirectRequiresEphemeralErr consumer direct requires an ephemeral consumer
111
        JSConsumerDirectRequiresEphemeralErr ErrorIdentifier = 10091
112

113
        // JSConsumerDirectRequiresPushErr consumer direct requires a push based consumer
114
        JSConsumerDirectRequiresPushErr ErrorIdentifier = 10090
115

116
        // JSConsumerDoesNotExist action UPDATE is used for a nonexisting consumer (consumer does not exist)
117
        JSConsumerDoesNotExist ErrorIdentifier = 10149
118

119
        // JSConsumerDuplicateFilterSubjects consumer cannot have both FilterSubject and FilterSubjects specified
120
        JSConsumerDuplicateFilterSubjects ErrorIdentifier = 10136
121

122
        // JSConsumerDurableNameNotInSubjectErr consumer expected to be durable but no durable name set in subject
123
        JSConsumerDurableNameNotInSubjectErr ErrorIdentifier = 10016
124

125
        // JSConsumerDurableNameNotMatchSubjectErr consumer name in subject does not match durable name in request
126
        JSConsumerDurableNameNotMatchSubjectErr ErrorIdentifier = 10017
127

128
        // JSConsumerDurableNameNotSetErr consumer expected to be durable but a durable name was not set
129
        JSConsumerDurableNameNotSetErr ErrorIdentifier = 10018
130

131
        // JSConsumerEmptyFilter consumer filter in FilterSubjects cannot be empty
132
        JSConsumerEmptyFilter ErrorIdentifier = 10139
133

134
        // JSConsumerEmptyGroupName Group name cannot be an empty string
135
        JSConsumerEmptyGroupName ErrorIdentifier = 10161
136

137
        // JSConsumerEphemeralWithDurableInSubjectErr consumer expected to be ephemeral but detected a durable name set in subject
138
        JSConsumerEphemeralWithDurableInSubjectErr ErrorIdentifier = 10019
139

140
        // JSConsumerEphemeralWithDurableNameErr consumer expected to be ephemeral but a durable name was set in request
141
        JSConsumerEphemeralWithDurableNameErr ErrorIdentifier = 10020
142

143
        // JSConsumerExistingActiveErr consumer already exists and is still active
144
        JSConsumerExistingActiveErr ErrorIdentifier = 10105
145

146
        // JSConsumerFCRequiresPushErr consumer flow control requires a push based consumer
147
        JSConsumerFCRequiresPushErr ErrorIdentifier = 10089
148

149
        // JSConsumerFilterNotSubsetErr consumer filter subject is not a valid subset of the interest subjects
150
        JSConsumerFilterNotSubsetErr ErrorIdentifier = 10093
151

152
        // JSConsumerHBRequiresPushErr consumer idle heartbeat requires a push based consumer
153
        JSConsumerHBRequiresPushErr ErrorIdentifier = 10088
154

155
        // JSConsumerInactiveThresholdExcess consumer inactive threshold exceeds system limit of {limit}
156
        JSConsumerInactiveThresholdExcess ErrorIdentifier = 10153
157

158
        // JSConsumerInvalidDeliverSubject invalid push consumer deliver subject
159
        JSConsumerInvalidDeliverSubject ErrorIdentifier = 10112
160

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

164
        // JSConsumerInvalidPolicyErrF Generic delivery policy error ({err})
165
        JSConsumerInvalidPolicyErrF ErrorIdentifier = 10094
166

167
        // JSConsumerInvalidPriorityGroupErr Provided priority group does not exist for this consumer
168
        JSConsumerInvalidPriorityGroupErr ErrorIdentifier = 10160
169

170
        // JSConsumerInvalidSamplingErrF failed to parse consumer sampling configuration: {err}
171
        JSConsumerInvalidSamplingErrF ErrorIdentifier = 10095
172

173
        // JSConsumerMaxDeliverBackoffErr max deliver is required to be > length of backoff values
174
        JSConsumerMaxDeliverBackoffErr ErrorIdentifier = 10116
175

176
        // JSConsumerMaxPendingAckExcessErrF consumer max ack pending exceeds system limit of {limit}
177
        JSConsumerMaxPendingAckExcessErrF ErrorIdentifier = 10121
178

179
        // JSConsumerMaxPendingAckPolicyRequiredErr consumer requires ack policy for max ack pending
180
        JSConsumerMaxPendingAckPolicyRequiredErr ErrorIdentifier = 10082
181

182
        // JSConsumerMaxRequestBatchExceededF consumer max request batch exceeds server limit of {limit}
183
        JSConsumerMaxRequestBatchExceededF ErrorIdentifier = 10125
184

185
        // JSConsumerMaxRequestBatchNegativeErr consumer max request batch needs to be > 0
186
        JSConsumerMaxRequestBatchNegativeErr ErrorIdentifier = 10114
187

188
        // JSConsumerMaxRequestExpiresTooSmall consumer max request expires needs to be >= 1ms
189
        JSConsumerMaxRequestExpiresTooSmall ErrorIdentifier = 10115
190

191
        // JSConsumerMaxWaitingNegativeErr consumer max waiting needs to be positive
192
        JSConsumerMaxWaitingNegativeErr ErrorIdentifier = 10087
193

194
        // JSConsumerMetadataLengthErrF consumer metadata exceeds maximum size of {limit}
195
        JSConsumerMetadataLengthErrF ErrorIdentifier = 10135
196

197
        // JSConsumerMultipleFiltersNotAllowed consumer with multiple subject filters cannot use subject based API
198
        JSConsumerMultipleFiltersNotAllowed ErrorIdentifier = 10137
199

200
        // JSConsumerNameContainsPathSeparatorsErr Consumer name can not contain path separators
201
        JSConsumerNameContainsPathSeparatorsErr ErrorIdentifier = 10127
202

203
        // JSConsumerNameExistErr consumer name already in use
204
        JSConsumerNameExistErr ErrorIdentifier = 10013
205

206
        // JSConsumerNameTooLongErrF consumer name is too long, maximum allowed is {max}
207
        JSConsumerNameTooLongErrF ErrorIdentifier = 10102
208

209
        // JSConsumerNotFoundErr consumer not found
210
        JSConsumerNotFoundErr ErrorIdentifier = 10014
211

212
        // JSConsumerOfflineErr consumer is offline
213
        JSConsumerOfflineErr ErrorIdentifier = 10119
214

215
        // JSConsumerOfflineReasonErrF consumer is offline: {err}
216
        JSConsumerOfflineReasonErrF ErrorIdentifier = 10195
217

218
        // JSConsumerOnMappedErr consumer direct on a mapped consumer
219
        JSConsumerOnMappedErr ErrorIdentifier = 10092
220

221
        // JSConsumerOverlappingSubjectFilters consumer subject filters cannot overlap
222
        JSConsumerOverlappingSubjectFilters ErrorIdentifier = 10138
223

224
        // JSConsumerPinnedTTLWithoutPriorityPolicyNone PinnedTTL cannot be set when PriorityPolicy is none
225
        JSConsumerPinnedTTLWithoutPriorityPolicyNone ErrorIdentifier = 10197
226

227
        // JSConsumerPriorityGroupWithPolicyNone consumer can not have priority groups when policy is none
228
        JSConsumerPriorityGroupWithPolicyNone ErrorIdentifier = 10196
229

230
        // JSConsumerPriorityPolicyWithoutGroup Setting PriorityPolicy requires at least one PriorityGroup to be set
231
        JSConsumerPriorityPolicyWithoutGroup ErrorIdentifier = 10159
232

233
        // JSConsumerPullNotDurableErr consumer in pull mode requires a durable name
234
        JSConsumerPullNotDurableErr ErrorIdentifier = 10085
235

236
        // JSConsumerPullRequiresAckErr consumer in pull mode requires explicit ack policy on workqueue stream
237
        JSConsumerPullRequiresAckErr ErrorIdentifier = 10084
238

239
        // JSConsumerPullWithRateLimitErr consumer in pull mode can not have rate limit set
240
        JSConsumerPullWithRateLimitErr ErrorIdentifier = 10086
241

242
        // JSConsumerPushMaxWaitingErr consumer in push mode can not set max waiting
243
        JSConsumerPushMaxWaitingErr ErrorIdentifier = 10080
244

245
        // JSConsumerPushWithPriorityGroupErr priority groups can not be used with push consumers
246
        JSConsumerPushWithPriorityGroupErr ErrorIdentifier = 10178
247

248
        // JSConsumerReplacementWithDifferentNameErr consumer replacement durable config not the same
249
        JSConsumerReplacementWithDifferentNameErr ErrorIdentifier = 10106
250

251
        // JSConsumerReplayPolicyInvalidErr consumer replay policy invalid
252
        JSConsumerReplayPolicyInvalidErr ErrorIdentifier = 10182
253

254
        // JSConsumerReplicasExceedsStream consumer config replica count exceeds parent stream
255
        JSConsumerReplicasExceedsStream ErrorIdentifier = 10126
256

257
        // JSConsumerReplicasShouldMatchStream consumer config replicas must match interest retention stream's replicas
258
        JSConsumerReplicasShouldMatchStream ErrorIdentifier = 10134
259

260
        // JSConsumerSmallHeartbeatErr consumer idle heartbeat needs to be >= 100ms
261
        JSConsumerSmallHeartbeatErr ErrorIdentifier = 10083
262

263
        // JSConsumerStoreFailedErrF error creating store for consumer: {err}
264
        JSConsumerStoreFailedErrF ErrorIdentifier = 10104
265

266
        // JSConsumerWQConsumerNotDeliverAllErr consumer must be deliver all on workqueue stream
267
        JSConsumerWQConsumerNotDeliverAllErr ErrorIdentifier = 10101
268

269
        // JSConsumerWQConsumerNotUniqueErr filtered consumer not unique on workqueue stream
270
        JSConsumerWQConsumerNotUniqueErr ErrorIdentifier = 10100
271

272
        // JSConsumerWQMultipleUnfilteredErr multiple non-filtered consumers not allowed on workqueue stream
273
        JSConsumerWQMultipleUnfilteredErr ErrorIdentifier = 10099
274

275
        // JSConsumerWQRequiresExplicitAckErr workqueue stream requires explicit ack
276
        JSConsumerWQRequiresExplicitAckErr ErrorIdentifier = 10098
277

278
        // JSConsumerWithFlowControlNeedsHeartbeats consumer with flow control also needs heartbeats
279
        JSConsumerWithFlowControlNeedsHeartbeats ErrorIdentifier = 10108
280

281
        // JSInsufficientResourcesErr insufficient resources
282
        JSInsufficientResourcesErr ErrorIdentifier = 10023
283

284
        // JSInvalidJSONErr invalid JSON: {err}
285
        JSInvalidJSONErr ErrorIdentifier = 10025
286

287
        // JSMaximumConsumersLimitErr maximum consumers limit reached
288
        JSMaximumConsumersLimitErr ErrorIdentifier = 10026
289

290
        // JSMaximumStreamsLimitErr maximum number of streams reached
291
        JSMaximumStreamsLimitErr ErrorIdentifier = 10027
292

293
        // JSMemoryResourcesExceededErr insufficient memory resources available
294
        JSMemoryResourcesExceededErr ErrorIdentifier = 10028
295

296
        // JSMessageCounterBrokenErr message counter is broken
297
        JSMessageCounterBrokenErr ErrorIdentifier = 10172
298

299
        // JSMessageIncrDisabledErr message counters is disabled
300
        JSMessageIncrDisabledErr ErrorIdentifier = 10168
301

302
        // JSMessageIncrInvalidErr message counter increment is invalid
303
        JSMessageIncrInvalidErr ErrorIdentifier = 10171
304

305
        // JSMessageIncrMissingErr message counter increment is missing
306
        JSMessageIncrMissingErr ErrorIdentifier = 10169
307

308
        // JSMessageIncrPayloadErr message counter has payload
309
        JSMessageIncrPayloadErr ErrorIdentifier = 10170
310

311
        // JSMessageSchedulesDisabledErr message schedules is disabled
312
        JSMessageSchedulesDisabledErr ErrorIdentifier = 10188
313

314
        // JSMessageSchedulesPatternInvalidErr message schedules pattern is invalid
315
        JSMessageSchedulesPatternInvalidErr ErrorIdentifier = 10189
316

317
        // JSMessageSchedulesRollupInvalidErr message schedules invalid rollup
318
        JSMessageSchedulesRollupInvalidErr ErrorIdentifier = 10192
319

320
        // JSMessageSchedulesTTLInvalidErr message schedules invalid per-message TTL
321
        JSMessageSchedulesTTLInvalidErr ErrorIdentifier = 10191
322

323
        // JSMessageSchedulesTargetInvalidErr message schedules target is invalid
324
        JSMessageSchedulesTargetInvalidErr ErrorIdentifier = 10190
325

326
        // JSMessageTTLDisabledErr per-message TTL is disabled
327
        JSMessageTTLDisabledErr ErrorIdentifier = 10166
328

329
        // JSMessageTTLInvalidErr invalid per-message TTL
330
        JSMessageTTLInvalidErr ErrorIdentifier = 10165
331

332
        // JSMirrorConsumerSetupFailedErrF generic mirror consumer setup failure string ({err})
333
        JSMirrorConsumerSetupFailedErrF ErrorIdentifier = 10029
334

335
        // JSMirrorInvalidStreamName mirrored stream name is invalid
336
        JSMirrorInvalidStreamName ErrorIdentifier = 10142
337

338
        // JSMirrorInvalidSubjectFilter mirror transform source: {err}
339
        JSMirrorInvalidSubjectFilter ErrorIdentifier = 10151
340

341
        // JSMirrorInvalidTransformDestination mirror transform: {err}
342
        JSMirrorInvalidTransformDestination ErrorIdentifier = 10154
343

344
        // JSMirrorMaxMessageSizeTooBigErr stream mirror must have max message size >= source
345
        JSMirrorMaxMessageSizeTooBigErr ErrorIdentifier = 10030
346

347
        // JSMirrorMultipleFiltersNotAllowed mirror with multiple subject transforms cannot also have a single subject filter
348
        JSMirrorMultipleFiltersNotAllowed ErrorIdentifier = 10150
349

350
        // JSMirrorOverlappingSubjectFilters mirror subject filters can not overlap
351
        JSMirrorOverlappingSubjectFilters ErrorIdentifier = 10152
352

353
        // JSMirrorWithAtomicPublishErr stream mirrors can not also use atomic publishing
354
        JSMirrorWithAtomicPublishErr ErrorIdentifier = 10198
355

356
        // JSMirrorWithCountersErr stream mirrors can not also calculate counters
357
        JSMirrorWithCountersErr ErrorIdentifier = 10173
358

359
        // JSMirrorWithFirstSeqErr stream mirrors can not have first sequence configured
360
        JSMirrorWithFirstSeqErr ErrorIdentifier = 10143
361

362
        // JSMirrorWithMsgSchedulesErr stream mirrors can not also schedule messages
363
        JSMirrorWithMsgSchedulesErr ErrorIdentifier = 10186
364

365
        // JSMirrorWithSourcesErr stream mirrors can not also contain other sources
366
        JSMirrorWithSourcesErr ErrorIdentifier = 10031
367

368
        // JSMirrorWithStartSeqAndTimeErr stream mirrors can not have both start seq and start time configured
369
        JSMirrorWithStartSeqAndTimeErr ErrorIdentifier = 10032
370

371
        // JSMirrorWithSubjectFiltersErr stream mirrors can not contain filtered subjects
372
        JSMirrorWithSubjectFiltersErr ErrorIdentifier = 10033
373

374
        // JSMirrorWithSubjectsErr stream mirrors can not contain subjects
375
        JSMirrorWithSubjectsErr ErrorIdentifier = 10034
376

377
        // JSNoAccountErr account not found
378
        JSNoAccountErr ErrorIdentifier = 10035
379

380
        // JSNoLimitsErr no JetStream default or applicable tiered limit present
381
        JSNoLimitsErr ErrorIdentifier = 10120
382

383
        // JSNoMessageFoundErr no message found
384
        JSNoMessageFoundErr ErrorIdentifier = 10037
385

386
        // JSNotEmptyRequestErr expected an empty request payload
387
        JSNotEmptyRequestErr ErrorIdentifier = 10038
388

389
        // JSNotEnabledErr JetStream not enabled
390
        JSNotEnabledErr ErrorIdentifier = 10076
391

392
        // JSNotEnabledForAccountErr JetStream not enabled for account
393
        JSNotEnabledForAccountErr ErrorIdentifier = 10039
394

395
        // JSPedanticErrF pedantic mode: {err}
396
        JSPedanticErrF ErrorIdentifier = 10157
397

398
        // JSPeerRemapErr peer remap failed
399
        JSPeerRemapErr ErrorIdentifier = 10075
400

401
        // JSRaftGeneralErrF General RAFT error string ({err})
402
        JSRaftGeneralErrF ErrorIdentifier = 10041
403

404
        // JSReplicasCountCannotBeNegative replicas count cannot be negative
405
        JSReplicasCountCannotBeNegative ErrorIdentifier = 10133
406

407
        // JSRequiredApiLevelErr JetStream minimum api level required
408
        JSRequiredApiLevelErr ErrorIdentifier = 10185
409

410
        // JSRestoreSubscribeFailedErrF JetStream unable to subscribe to restore snapshot {subject}: {err}
411
        JSRestoreSubscribeFailedErrF ErrorIdentifier = 10042
412

413
        // JSSequenceNotFoundErrF sequence {seq} not found
414
        JSSequenceNotFoundErrF ErrorIdentifier = 10043
415

416
        // JSSnapshotDeliverSubjectInvalidErr deliver subject not valid
417
        JSSnapshotDeliverSubjectInvalidErr ErrorIdentifier = 10015
418

419
        // JSSourceConsumerSetupFailedErrF General source consumer setup failure string ({err})
420
        JSSourceConsumerSetupFailedErrF ErrorIdentifier = 10045
421

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

425
        // JSSourceInvalidStreamName sourced stream name is invalid
426
        JSSourceInvalidStreamName ErrorIdentifier = 10141
427

428
        // JSSourceInvalidSubjectFilter source transform source: {err}
429
        JSSourceInvalidSubjectFilter ErrorIdentifier = 10145
430

431
        // JSSourceInvalidTransformDestination source transform: {err}
432
        JSSourceInvalidTransformDestination ErrorIdentifier = 10146
433

434
        // JSSourceMaxMessageSizeTooBigErr stream source must have max message size >= target
435
        JSSourceMaxMessageSizeTooBigErr ErrorIdentifier = 10046
436

437
        // JSSourceMultipleFiltersNotAllowed source with multiple subject transforms cannot also have a single subject filter
438
        JSSourceMultipleFiltersNotAllowed ErrorIdentifier = 10144
439

440
        // JSSourceOverlappingSubjectFilters source filters can not overlap
441
        JSSourceOverlappingSubjectFilters ErrorIdentifier = 10147
442

443
        // JSSourceWithMsgSchedulesErr stream source can not also schedule messages
444
        JSSourceWithMsgSchedulesErr ErrorIdentifier = 10187
445

446
        // JSStorageResourcesExceededErr insufficient storage resources available
447
        JSStorageResourcesExceededErr ErrorIdentifier = 10047
448

449
        // JSStreamAssignmentErrF Generic stream assignment error string ({err})
450
        JSStreamAssignmentErrF ErrorIdentifier = 10048
451

452
        // JSStreamCreateErrF Generic stream creation error string ({err})
453
        JSStreamCreateErrF ErrorIdentifier = 10049
454

455
        // JSStreamDeleteErrF General stream deletion error string ({err})
456
        JSStreamDeleteErrF ErrorIdentifier = 10050
457

458
        // JSStreamDuplicateMessageConflict duplicate message id is in process
459
        JSStreamDuplicateMessageConflict ErrorIdentifier = 10158
460

461
        // JSStreamExpectedLastSeqPerSubjectInvalid missing sequence for expected last sequence per subject
462
        JSStreamExpectedLastSeqPerSubjectInvalid ErrorIdentifier = 10193
463

464
        // JSStreamExpectedLastSeqPerSubjectNotReady expected last sequence per subject temporarily unavailable
465
        JSStreamExpectedLastSeqPerSubjectNotReady ErrorIdentifier = 10163
466

467
        // JSStreamExternalApiOverlapErrF stream external api prefix {prefix} must not overlap with {subject}
468
        JSStreamExternalApiOverlapErrF ErrorIdentifier = 10021
469

470
        // JSStreamExternalDelPrefixOverlapsErrF stream external delivery prefix {prefix} overlaps with stream subject {subject}
471
        JSStreamExternalDelPrefixOverlapsErrF ErrorIdentifier = 10022
472

473
        // JSStreamGeneralErrorF General stream failure string ({err})
474
        JSStreamGeneralErrorF ErrorIdentifier = 10051
475

476
        // JSStreamHeaderExceedsMaximumErr header size exceeds maximum allowed of 64k
477
        JSStreamHeaderExceedsMaximumErr ErrorIdentifier = 10097
478

479
        // JSStreamInfoMaxSubjectsErr subject details would exceed maximum allowed
480
        JSStreamInfoMaxSubjectsErr ErrorIdentifier = 10117
481

482
        // JSStreamInvalidConfigF Stream configuration validation error string ({err})
483
        JSStreamInvalidConfigF ErrorIdentifier = 10052
484

485
        // JSStreamInvalidErr stream not valid
486
        JSStreamInvalidErr ErrorIdentifier = 10096
487

488
        // JSStreamInvalidExternalDeliverySubjErrF stream external delivery prefix {prefix} must not contain wildcards
489
        JSStreamInvalidExternalDeliverySubjErrF ErrorIdentifier = 10024
490

491
        // JSStreamLimitsErrF General stream limits exceeded error string ({err})
492
        JSStreamLimitsErrF ErrorIdentifier = 10053
493

494
        // JSStreamMaxBytesRequired account requires a stream config to have max bytes set
495
        JSStreamMaxBytesRequired ErrorIdentifier = 10113
496

497
        // JSStreamMaxStreamBytesExceeded stream max bytes exceeds account limit max stream bytes
498
        JSStreamMaxStreamBytesExceeded ErrorIdentifier = 10122
499

500
        // JSStreamMessageExceedsMaximumErr message size exceeds maximum allowed
501
        JSStreamMessageExceedsMaximumErr ErrorIdentifier = 10054
502

503
        // JSStreamMinLastSeqErr min last sequence
504
        JSStreamMinLastSeqErr ErrorIdentifier = 10180
505

506
        // JSStreamMirrorNotUpdatableErr stream mirror configuration can not be updated
507
        JSStreamMirrorNotUpdatableErr ErrorIdentifier = 10055
508

509
        // JSStreamMismatchErr stream name in subject does not match request
510
        JSStreamMismatchErr ErrorIdentifier = 10056
511

512
        // JSStreamMoveAndScaleErr can not move and scale a stream in a single update
513
        JSStreamMoveAndScaleErr ErrorIdentifier = 10123
514

515
        // JSStreamMoveInProgressF stream move already in progress: {msg}
516
        JSStreamMoveInProgressF ErrorIdentifier = 10124
517

518
        // JSStreamMoveNotInProgress stream move not in progress
519
        JSStreamMoveNotInProgress ErrorIdentifier = 10129
520

521
        // JSStreamMsgDeleteFailedF Generic message deletion failure error string ({err})
522
        JSStreamMsgDeleteFailedF ErrorIdentifier = 10057
523

524
        // JSStreamNameContainsPathSeparatorsErr Stream name can not contain path separators
525
        JSStreamNameContainsPathSeparatorsErr ErrorIdentifier = 10128
526

527
        // JSStreamNameExistErr stream name already in use with a different configuration
528
        JSStreamNameExistErr ErrorIdentifier = 10058
529

530
        // JSStreamNameExistRestoreFailedErr stream name already in use, cannot restore
531
        JSStreamNameExistRestoreFailedErr ErrorIdentifier = 10130
532

533
        // JSStreamNotFoundErr stream not found
534
        JSStreamNotFoundErr ErrorIdentifier = 10059
535

536
        // JSStreamNotMatchErr expected stream does not match
537
        JSStreamNotMatchErr ErrorIdentifier = 10060
538

539
        // JSStreamOfflineErr stream is offline
540
        JSStreamOfflineErr ErrorIdentifier = 10118
541

542
        // JSStreamOfflineReasonErrF stream is offline: {err}
543
        JSStreamOfflineReasonErrF ErrorIdentifier = 10194
544

545
        // JSStreamPurgeFailedF Generic stream purge failure error string ({err})
546
        JSStreamPurgeFailedF ErrorIdentifier = 10110
547

548
        // JSStreamReplicasNotSupportedErr replicas > 1 not supported in non-clustered mode
549
        JSStreamReplicasNotSupportedErr ErrorIdentifier = 10074
550

551
        // JSStreamReplicasNotUpdatableErr Replicas configuration can not be updated
552
        JSStreamReplicasNotUpdatableErr ErrorIdentifier = 10061
553

554
        // JSStreamRestoreErrF restore failed: {err}
555
        JSStreamRestoreErrF ErrorIdentifier = 10062
556

557
        // JSStreamRollupFailedF Generic stream rollup failure error string ({err})
558
        JSStreamRollupFailedF ErrorIdentifier = 10111
559

560
        // JSStreamSealedErr invalid operation on sealed stream
561
        JSStreamSealedErr ErrorIdentifier = 10109
562

563
        // JSStreamSequenceNotMatchErr expected stream sequence does not match
564
        JSStreamSequenceNotMatchErr ErrorIdentifier = 10063
565

566
        // JSStreamSnapshotErrF snapshot failed: {err}
567
        JSStreamSnapshotErrF ErrorIdentifier = 10064
568

569
        // JSStreamStoreFailedF Generic error when storing a message failed ({err})
570
        JSStreamStoreFailedF ErrorIdentifier = 10077
571

572
        // JSStreamSubjectOverlapErr subjects overlap with an existing stream
573
        JSStreamSubjectOverlapErr ErrorIdentifier = 10065
574

575
        // JSStreamTemplateCreateErrF Generic template creation failed string ({err})
576
        JSStreamTemplateCreateErrF ErrorIdentifier = 10066
577

578
        // JSStreamTemplateDeleteErrF Generic stream template deletion failed error string ({err})
579
        JSStreamTemplateDeleteErrF ErrorIdentifier = 10067
580

581
        // JSStreamTemplateNotFoundErr template not found
582
        JSStreamTemplateNotFoundErr ErrorIdentifier = 10068
583

584
        // JSStreamTooManyRequests too many requests
585
        JSStreamTooManyRequests ErrorIdentifier = 10167
586

587
        // JSStreamTransformInvalidDestination stream transform: {err}
588
        JSStreamTransformInvalidDestination ErrorIdentifier = 10156
589

590
        // JSStreamTransformInvalidSource stream transform source: {err}
591
        JSStreamTransformInvalidSource ErrorIdentifier = 10155
592

593
        // JSStreamUpdateErrF Generic stream update error string ({err})
594
        JSStreamUpdateErrF ErrorIdentifier = 10069
595

596
        // JSStreamWrongLastMsgIDErrF wrong last msg ID: {id}
597
        JSStreamWrongLastMsgIDErrF ErrorIdentifier = 10070
598

599
        // JSStreamWrongLastSequenceConstantErr wrong last sequence
600
        JSStreamWrongLastSequenceConstantErr ErrorIdentifier = 10164
601

602
        // JSStreamWrongLastSequenceErrF wrong last sequence: {seq}
603
        JSStreamWrongLastSequenceErrF ErrorIdentifier = 10071
604

605
        // JSTempStorageFailedErr JetStream unable to open temp storage for restore
606
        JSTempStorageFailedErr ErrorIdentifier = 10072
607

608
        // JSTemplateNameNotMatchSubjectErr template name in subject does not match request
609
        JSTemplateNameNotMatchSubjectErr ErrorIdentifier = 10073
610
)
611

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

840
// NewJSAccountResourcesExceededError creates a new JSAccountResourcesExceededErr error: "resource limits exceeded for account"
841
func NewJSAccountResourcesExceededError(opts ...ErrorOption) *ApiError {
20,060✔
842
        eopts := parseOpts(opts)
20,060✔
843
        if ae, ok := eopts.err.(*ApiError); ok {
20,060✔
844
                return ae
×
845
        }
×
846

847
        return ApiErrors[JSAccountResourcesExceededErr]
20,060✔
848
}
849

850
// NewJSAtomicPublishContainsDuplicateMessageError creates a new JSAtomicPublishContainsDuplicateMessageErr error: "atomic publish batch contains duplicate message id"
851
func NewJSAtomicPublishContainsDuplicateMessageError(opts ...ErrorOption) *ApiError {
21,983✔
852
        eopts := parseOpts(opts)
21,983✔
853
        if ae, ok := eopts.err.(*ApiError); ok {
21,983✔
854
                return ae
×
855
        }
×
856

857
        return ApiErrors[JSAtomicPublishContainsDuplicateMessageErr]
21,983✔
858
}
859

860
// NewJSAtomicPublishDisabledError creates a new JSAtomicPublishDisabledErr error: "atomic publish is disabled"
861
func NewJSAtomicPublishDisabledError(opts ...ErrorOption) *ApiError {
24✔
862
        eopts := parseOpts(opts)
24✔
863
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
864
                return ae
×
865
        }
×
866

867
        return ApiErrors[JSAtomicPublishDisabledErr]
24✔
868
}
869

870
// NewJSAtomicPublishIncompleteBatchError creates a new JSAtomicPublishIncompleteBatchErr error: "atomic publish batch is incomplete"
871
func NewJSAtomicPublishIncompleteBatchError(opts ...ErrorOption) *ApiError {
62✔
872
        eopts := parseOpts(opts)
62✔
873
        if ae, ok := eopts.err.(*ApiError); ok {
62✔
874
                return ae
×
875
        }
×
876

877
        return ApiErrors[JSAtomicPublishIncompleteBatchErr]
62✔
878
}
879

880
// NewJSAtomicPublishInvalidBatchCommitError creates a new JSAtomicPublishInvalidBatchCommitErr error: "atomic publish batch commit is invalid"
881
func NewJSAtomicPublishInvalidBatchCommitError(opts ...ErrorOption) *ApiError {
6✔
882
        eopts := parseOpts(opts)
6✔
883
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
884
                return ae
×
885
        }
×
886

887
        return ApiErrors[JSAtomicPublishInvalidBatchCommitErr]
6✔
888
}
889

890
// NewJSAtomicPublishInvalidBatchIDError creates a new JSAtomicPublishInvalidBatchIDErr error: "atomic publish batch ID is invalid"
891
func NewJSAtomicPublishInvalidBatchIDError(opts ...ErrorOption) *ApiError {
4✔
892
        eopts := parseOpts(opts)
4✔
893
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
894
                return ae
×
895
        }
×
896

897
        return ApiErrors[JSAtomicPublishInvalidBatchIDErr]
4✔
898
}
899

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

907
        return ApiErrors[JSAtomicPublishMissingSeqErr]
24✔
908
}
909

910
// NewJSAtomicPublishTooLargeBatchError creates a new JSAtomicPublishTooLargeBatchErrF error: "atomic publish batch is too large: {size}"
911
func NewJSAtomicPublishTooLargeBatchError(size interface{}, opts ...ErrorOption) *ApiError {
10✔
912
        eopts := parseOpts(opts)
10✔
913
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
914
                return ae
×
915
        }
×
916

917
        e := ApiErrors[JSAtomicPublishTooLargeBatchErrF]
10✔
918
        args := e.toReplacerArgs([]interface{}{"{size}", size})
10✔
919
        return &ApiError{
10✔
920
                Code:        e.Code,
10✔
921
                ErrCode:     e.ErrCode,
10✔
922
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
923
        }
10✔
924
}
925

926
// NewJSAtomicPublishUnsupportedHeaderBatchError creates a new JSAtomicPublishUnsupportedHeaderBatchErr error: "atomic publish unsupported header used: {header}"
927
func NewJSAtomicPublishUnsupportedHeaderBatchError(header interface{}, opts ...ErrorOption) *ApiError {
4✔
928
        eopts := parseOpts(opts)
4✔
929
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
930
                return ae
×
931
        }
×
932

933
        e := ApiErrors[JSAtomicPublishUnsupportedHeaderBatchErr]
4✔
934
        args := e.toReplacerArgs([]interface{}{"{header}", header})
4✔
935
        return &ApiError{
4✔
936
                Code:        e.Code,
4✔
937
                ErrCode:     e.ErrCode,
4✔
938
                Description: strings.NewReplacer(args...).Replace(e.Description),
4✔
939
        }
4✔
940
}
941

942
// NewJSBadRequestError creates a new JSBadRequestErr error: "bad request"
943
func NewJSBadRequestError(opts ...ErrorOption) *ApiError {
10✔
944
        eopts := parseOpts(opts)
10✔
945
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
946
                return ae
×
947
        }
×
948

949
        return ApiErrors[JSBadRequestErr]
10✔
950
}
951

952
// NewJSClusterIncompleteError creates a new JSClusterIncompleteErr error: "incomplete results"
953
func NewJSClusterIncompleteError(opts ...ErrorOption) *ApiError {
×
954
        eopts := parseOpts(opts)
×
955
        if ae, ok := eopts.err.(*ApiError); ok {
×
956
                return ae
×
957
        }
×
958

959
        return ApiErrors[JSClusterIncompleteErr]
×
960
}
961

962
// NewJSClusterNoPeersError creates a new JSClusterNoPeersErrF error: "{err}"
963
func NewJSClusterNoPeersError(err error, opts ...ErrorOption) *ApiError {
59✔
964
        eopts := parseOpts(opts)
59✔
965
        if ae, ok := eopts.err.(*ApiError); ok {
59✔
966
                return ae
×
967
        }
×
968

969
        e := ApiErrors[JSClusterNoPeersErrF]
59✔
970
        args := e.toReplacerArgs([]interface{}{"{err}", err})
59✔
971
        return &ApiError{
59✔
972
                Code:        e.Code,
59✔
973
                ErrCode:     e.ErrCode,
59✔
974
                Description: strings.NewReplacer(args...).Replace(e.Description),
59✔
975
        }
59✔
976
}
977

978
// NewJSClusterNotActiveError creates a new JSClusterNotActiveErr error: "JetStream not in clustered mode"
979
func NewJSClusterNotActiveError(opts ...ErrorOption) *ApiError {
1✔
980
        eopts := parseOpts(opts)
1✔
981
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
982
                return ae
×
983
        }
×
984

985
        return ApiErrors[JSClusterNotActiveErr]
1✔
986
}
987

988
// NewJSClusterNotAssignedError creates a new JSClusterNotAssignedErr error: "JetStream cluster not assigned to this server"
989
func NewJSClusterNotAssignedError(opts ...ErrorOption) *ApiError {
30✔
990
        eopts := parseOpts(opts)
30✔
991
        if ae, ok := eopts.err.(*ApiError); ok {
30✔
992
                return ae
×
993
        }
×
994

995
        return ApiErrors[JSClusterNotAssignedErr]
30✔
996
}
997

998
// NewJSClusterNotAvailError creates a new JSClusterNotAvailErr error: "JetStream system temporarily unavailable"
999
func NewJSClusterNotAvailError(opts ...ErrorOption) *ApiError {
13✔
1000
        eopts := parseOpts(opts)
13✔
1001
        if ae, ok := eopts.err.(*ApiError); ok {
13✔
1002
                return ae
×
1003
        }
×
1004

1005
        return ApiErrors[JSClusterNotAvailErr]
13✔
1006
}
1007

1008
// NewJSClusterNotLeaderError creates a new JSClusterNotLeaderErr error: "JetStream cluster can not handle request"
1009
func NewJSClusterNotLeaderError(opts ...ErrorOption) *ApiError {
1✔
1010
        eopts := parseOpts(opts)
1✔
1011
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1012
                return ae
×
1013
        }
×
1014

1015
        return ApiErrors[JSClusterNotLeaderErr]
1✔
1016
}
1017

1018
// NewJSClusterPeerNotMemberError creates a new JSClusterPeerNotMemberErr error: "peer not a member"
1019
func NewJSClusterPeerNotMemberError(opts ...ErrorOption) *ApiError {
1✔
1020
        eopts := parseOpts(opts)
1✔
1021
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1022
                return ae
×
1023
        }
×
1024

1025
        return ApiErrors[JSClusterPeerNotMemberErr]
1✔
1026
}
1027

1028
// NewJSClusterRequiredError creates a new JSClusterRequiredErr error: "JetStream clustering support required"
1029
func NewJSClusterRequiredError(opts ...ErrorOption) *ApiError {
×
1030
        eopts := parseOpts(opts)
×
1031
        if ae, ok := eopts.err.(*ApiError); ok {
×
1032
                return ae
×
1033
        }
×
1034

1035
        return ApiErrors[JSClusterRequiredErr]
×
1036
}
1037

1038
// NewJSClusterServerMemberChangeInflightError creates a new JSClusterServerMemberChangeInflightErr error: "cluster member change is in progress"
1039
func NewJSClusterServerMemberChangeInflightError(opts ...ErrorOption) *ApiError {
6✔
1040
        eopts := parseOpts(opts)
6✔
1041
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1042
                return ae
×
1043
        }
×
1044

1045
        return ApiErrors[JSClusterServerMemberChangeInflightErr]
6✔
1046
}
1047

1048
// NewJSClusterServerNotMemberError creates a new JSClusterServerNotMemberErr error: "server is not a member of the cluster"
1049
func NewJSClusterServerNotMemberError(opts ...ErrorOption) *ApiError {
6✔
1050
        eopts := parseOpts(opts)
6✔
1051
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1052
                return ae
×
1053
        }
×
1054

1055
        return ApiErrors[JSClusterServerNotMemberErr]
6✔
1056
}
1057

1058
// NewJSClusterTagsError creates a new JSClusterTagsErr error: "tags placement not supported for operation"
1059
func NewJSClusterTagsError(opts ...ErrorOption) *ApiError {
×
1060
        eopts := parseOpts(opts)
×
1061
        if ae, ok := eopts.err.(*ApiError); ok {
×
1062
                return ae
×
1063
        }
×
1064

1065
        return ApiErrors[JSClusterTagsErr]
×
1066
}
1067

1068
// NewJSClusterUnSupportFeatureError creates a new JSClusterUnSupportFeatureErr error: "not currently supported in clustered mode"
1069
func NewJSClusterUnSupportFeatureError(opts ...ErrorOption) *ApiError {
×
1070
        eopts := parseOpts(opts)
×
1071
        if ae, ok := eopts.err.(*ApiError); ok {
×
1072
                return ae
×
1073
        }
×
1074

1075
        return ApiErrors[JSClusterUnSupportFeatureErr]
×
1076
}
1077

1078
// NewJSConsumerAckPolicyInvalidError creates a new JSConsumerAckPolicyInvalidErr error: "consumer ack policy invalid"
1079
func NewJSConsumerAckPolicyInvalidError(opts ...ErrorOption) *ApiError {
2✔
1080
        eopts := parseOpts(opts)
2✔
1081
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1082
                return ae
×
1083
        }
×
1084

1085
        return ApiErrors[JSConsumerAckPolicyInvalidErr]
2✔
1086
}
1087

1088
// NewJSConsumerAckWaitNegativeError creates a new JSConsumerAckWaitNegativeErr error: "consumer ack wait needs to be positive"
1089
func NewJSConsumerAckWaitNegativeError(opts ...ErrorOption) *ApiError {
2✔
1090
        eopts := parseOpts(opts)
2✔
1091
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1092
                return ae
×
1093
        }
×
1094

1095
        return ApiErrors[JSConsumerAckWaitNegativeErr]
2✔
1096
}
1097

1098
// NewJSConsumerAlreadyExistsError creates a new JSConsumerAlreadyExists error: "consumer already exists"
1099
func NewJSConsumerAlreadyExistsError(opts ...ErrorOption) *ApiError {
5✔
1100
        eopts := parseOpts(opts)
5✔
1101
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
1102
                return ae
×
1103
        }
×
1104

1105
        return ApiErrors[JSConsumerAlreadyExists]
5✔
1106
}
1107

1108
// NewJSConsumerBackOffNegativeError creates a new JSConsumerBackOffNegativeErr error: "consumer backoff needs to be positive"
1109
func NewJSConsumerBackOffNegativeError(opts ...ErrorOption) *ApiError {
2✔
1110
        eopts := parseOpts(opts)
2✔
1111
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1112
                return ae
×
1113
        }
×
1114

1115
        return ApiErrors[JSConsumerBackOffNegativeErr]
2✔
1116
}
1117

1118
// NewJSConsumerBadDurableNameError creates a new JSConsumerBadDurableNameErr error: "durable name can not contain '.', '*', '>'"
1119
func NewJSConsumerBadDurableNameError(opts ...ErrorOption) *ApiError {
×
1120
        eopts := parseOpts(opts)
×
1121
        if ae, ok := eopts.err.(*ApiError); ok {
×
1122
                return ae
×
1123
        }
×
1124

1125
        return ApiErrors[JSConsumerBadDurableNameErr]
×
1126
}
1127

1128
// NewJSConsumerConfigRequiredError creates a new JSConsumerConfigRequiredErr error: "consumer config required"
1129
func NewJSConsumerConfigRequiredError(opts ...ErrorOption) *ApiError {
2✔
1130
        eopts := parseOpts(opts)
2✔
1131
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1132
                return ae
×
1133
        }
×
1134

1135
        return ApiErrors[JSConsumerConfigRequiredErr]
2✔
1136
}
1137

1138
// NewJSConsumerCreateDurableAndNameMismatchError creates a new JSConsumerCreateDurableAndNameMismatch error: "Consumer Durable and Name have to be equal if both are provided"
1139
func NewJSConsumerCreateDurableAndNameMismatchError(opts ...ErrorOption) *ApiError {
1✔
1140
        eopts := parseOpts(opts)
1✔
1141
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1142
                return ae
×
1143
        }
×
1144

1145
        return ApiErrors[JSConsumerCreateDurableAndNameMismatch]
1✔
1146
}
1147

1148
// NewJSConsumerCreateError creates a new JSConsumerCreateErrF error: "{err}"
1149
func NewJSConsumerCreateError(err error, opts ...ErrorOption) *ApiError {
71✔
1150
        eopts := parseOpts(opts)
71✔
1151
        if ae, ok := eopts.err.(*ApiError); ok {
124✔
1152
                return ae
53✔
1153
        }
53✔
1154

1155
        e := ApiErrors[JSConsumerCreateErrF]
18✔
1156
        args := e.toReplacerArgs([]interface{}{"{err}", err})
18✔
1157
        return &ApiError{
18✔
1158
                Code:        e.Code,
18✔
1159
                ErrCode:     e.ErrCode,
18✔
1160
                Description: strings.NewReplacer(args...).Replace(e.Description),
18✔
1161
        }
18✔
1162
}
1163

1164
// NewJSConsumerCreateFilterSubjectMismatchError creates a new JSConsumerCreateFilterSubjectMismatchErr error: "Consumer create request did not match filtered subject from create subject"
1165
func NewJSConsumerCreateFilterSubjectMismatchError(opts ...ErrorOption) *ApiError {
2✔
1166
        eopts := parseOpts(opts)
2✔
1167
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1168
                return ae
×
1169
        }
×
1170

1171
        return ApiErrors[JSConsumerCreateFilterSubjectMismatchErr]
2✔
1172
}
1173

1174
// NewJSConsumerDeliverCycleError creates a new JSConsumerDeliverCycleErr error: "consumer deliver subject forms a cycle"
1175
func NewJSConsumerDeliverCycleError(opts ...ErrorOption) *ApiError {
4✔
1176
        eopts := parseOpts(opts)
4✔
1177
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1178
                return ae
×
1179
        }
×
1180

1181
        return ApiErrors[JSConsumerDeliverCycleErr]
4✔
1182
}
1183

1184
// NewJSConsumerDeliverToWildcardsError creates a new JSConsumerDeliverToWildcardsErr error: "consumer deliver subject has wildcards"
1185
func NewJSConsumerDeliverToWildcardsError(opts ...ErrorOption) *ApiError {
4✔
1186
        eopts := parseOpts(opts)
4✔
1187
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1188
                return ae
×
1189
        }
×
1190

1191
        return ApiErrors[JSConsumerDeliverToWildcardsErr]
4✔
1192
}
1193

1194
// NewJSConsumerDescriptionTooLongError creates a new JSConsumerDescriptionTooLongErrF error: "consumer description is too long, maximum allowed is {max}"
1195
func NewJSConsumerDescriptionTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
1✔
1196
        eopts := parseOpts(opts)
1✔
1197
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1198
                return ae
×
1199
        }
×
1200

1201
        e := ApiErrors[JSConsumerDescriptionTooLongErrF]
1✔
1202
        args := e.toReplacerArgs([]interface{}{"{max}", max})
1✔
1203
        return &ApiError{
1✔
1204
                Code:        e.Code,
1✔
1205
                ErrCode:     e.ErrCode,
1✔
1206
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1207
        }
1✔
1208
}
1209

1210
// NewJSConsumerDirectRequiresEphemeralError creates a new JSConsumerDirectRequiresEphemeralErr error: "consumer direct requires an ephemeral consumer"
1211
func NewJSConsumerDirectRequiresEphemeralError(opts ...ErrorOption) *ApiError {
×
1212
        eopts := parseOpts(opts)
×
1213
        if ae, ok := eopts.err.(*ApiError); ok {
×
1214
                return ae
×
1215
        }
×
1216

1217
        return ApiErrors[JSConsumerDirectRequiresEphemeralErr]
×
1218
}
1219

1220
// NewJSConsumerDirectRequiresPushError creates a new JSConsumerDirectRequiresPushErr error: "consumer direct requires a push based consumer"
1221
func NewJSConsumerDirectRequiresPushError(opts ...ErrorOption) *ApiError {
×
1222
        eopts := parseOpts(opts)
×
1223
        if ae, ok := eopts.err.(*ApiError); ok {
×
1224
                return ae
×
1225
        }
×
1226

1227
        return ApiErrors[JSConsumerDirectRequiresPushErr]
×
1228
}
1229

1230
// NewJSConsumerDoesNotExistError creates a new JSConsumerDoesNotExist error: "consumer does not exist"
1231
func NewJSConsumerDoesNotExistError(opts ...ErrorOption) *ApiError {
3✔
1232
        eopts := parseOpts(opts)
3✔
1233
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1234
                return ae
×
1235
        }
×
1236

1237
        return ApiErrors[JSConsumerDoesNotExist]
3✔
1238
}
1239

1240
// NewJSConsumerDuplicateFilterSubjectsError creates a new JSConsumerDuplicateFilterSubjects error: "consumer cannot have both FilterSubject and FilterSubjects specified"
1241
func NewJSConsumerDuplicateFilterSubjectsError(opts ...ErrorOption) *ApiError {
1✔
1242
        eopts := parseOpts(opts)
1✔
1243
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1244
                return ae
×
1245
        }
×
1246

1247
        return ApiErrors[JSConsumerDuplicateFilterSubjects]
1✔
1248
}
1249

1250
// NewJSConsumerDurableNameNotInSubjectError creates a new JSConsumerDurableNameNotInSubjectErr error: "consumer expected to be durable but no durable name set in subject"
1251
func NewJSConsumerDurableNameNotInSubjectError(opts ...ErrorOption) *ApiError {
×
1252
        eopts := parseOpts(opts)
×
1253
        if ae, ok := eopts.err.(*ApiError); ok {
×
1254
                return ae
×
1255
        }
×
1256

1257
        return ApiErrors[JSConsumerDurableNameNotInSubjectErr]
×
1258
}
1259

1260
// NewJSConsumerDurableNameNotMatchSubjectError creates a new JSConsumerDurableNameNotMatchSubjectErr error: "consumer name in subject does not match durable name in request"
1261
func NewJSConsumerDurableNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
×
1262
        eopts := parseOpts(opts)
×
1263
        if ae, ok := eopts.err.(*ApiError); ok {
×
1264
                return ae
×
1265
        }
×
1266

1267
        return ApiErrors[JSConsumerDurableNameNotMatchSubjectErr]
×
1268
}
1269

1270
// NewJSConsumerDurableNameNotSetError creates a new JSConsumerDurableNameNotSetErr error: "consumer expected to be durable but a durable name was not set"
1271
func NewJSConsumerDurableNameNotSetError(opts ...ErrorOption) *ApiError {
1✔
1272
        eopts := parseOpts(opts)
1✔
1273
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1274
                return ae
×
1275
        }
×
1276

1277
        return ApiErrors[JSConsumerDurableNameNotSetErr]
1✔
1278
}
1279

1280
// NewJSConsumerEmptyFilterError creates a new JSConsumerEmptyFilter error: "consumer filter in FilterSubjects cannot be empty"
1281
func NewJSConsumerEmptyFilterError(opts ...ErrorOption) *ApiError {
1✔
1282
        eopts := parseOpts(opts)
1✔
1283
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1284
                return ae
×
1285
        }
×
1286

1287
        return ApiErrors[JSConsumerEmptyFilter]
1✔
1288
}
1289

1290
// NewJSConsumerEmptyGroupNameError creates a new JSConsumerEmptyGroupName error: "Group name cannot be an empty string"
1291
func NewJSConsumerEmptyGroupNameError(opts ...ErrorOption) *ApiError {
4✔
1292
        eopts := parseOpts(opts)
4✔
1293
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1294
                return ae
×
1295
        }
×
1296

1297
        return ApiErrors[JSConsumerEmptyGroupName]
4✔
1298
}
1299

1300
// NewJSConsumerEphemeralWithDurableInSubjectError creates a new JSConsumerEphemeralWithDurableInSubjectErr error: "consumer expected to be ephemeral but detected a durable name set in subject"
1301
func NewJSConsumerEphemeralWithDurableInSubjectError(opts ...ErrorOption) *ApiError {
×
1302
        eopts := parseOpts(opts)
×
1303
        if ae, ok := eopts.err.(*ApiError); ok {
×
1304
                return ae
×
1305
        }
×
1306

1307
        return ApiErrors[JSConsumerEphemeralWithDurableInSubjectErr]
×
1308
}
1309

1310
// NewJSConsumerEphemeralWithDurableNameError creates a new JSConsumerEphemeralWithDurableNameErr error: "consumer expected to be ephemeral but a durable name was set in request"
1311
func NewJSConsumerEphemeralWithDurableNameError(opts ...ErrorOption) *ApiError {
3✔
1312
        eopts := parseOpts(opts)
3✔
1313
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1314
                return ae
×
1315
        }
×
1316

1317
        return ApiErrors[JSConsumerEphemeralWithDurableNameErr]
3✔
1318
}
1319

1320
// NewJSConsumerExistingActiveError creates a new JSConsumerExistingActiveErr error: "consumer already exists and is still active"
1321
func NewJSConsumerExistingActiveError(opts ...ErrorOption) *ApiError {
×
1322
        eopts := parseOpts(opts)
×
1323
        if ae, ok := eopts.err.(*ApiError); ok {
×
1324
                return ae
×
1325
        }
×
1326

1327
        return ApiErrors[JSConsumerExistingActiveErr]
×
1328
}
1329

1330
// NewJSConsumerFCRequiresPushError creates a new JSConsumerFCRequiresPushErr error: "consumer flow control requires a push based consumer"
1331
func NewJSConsumerFCRequiresPushError(opts ...ErrorOption) *ApiError {
×
1332
        eopts := parseOpts(opts)
×
1333
        if ae, ok := eopts.err.(*ApiError); ok {
×
1334
                return ae
×
1335
        }
×
1336

1337
        return ApiErrors[JSConsumerFCRequiresPushErr]
×
1338
}
1339

1340
// NewJSConsumerFilterNotSubsetError creates a new JSConsumerFilterNotSubsetErr error: "consumer filter subject is not a valid subset of the interest subjects"
1341
func NewJSConsumerFilterNotSubsetError(opts ...ErrorOption) *ApiError {
×
1342
        eopts := parseOpts(opts)
×
1343
        if ae, ok := eopts.err.(*ApiError); ok {
×
1344
                return ae
×
1345
        }
×
1346

1347
        return ApiErrors[JSConsumerFilterNotSubsetErr]
×
1348
}
1349

1350
// NewJSConsumerHBRequiresPushError creates a new JSConsumerHBRequiresPushErr error: "consumer idle heartbeat requires a push based consumer"
1351
func NewJSConsumerHBRequiresPushError(opts ...ErrorOption) *ApiError {
×
1352
        eopts := parseOpts(opts)
×
1353
        if ae, ok := eopts.err.(*ApiError); ok {
×
1354
                return ae
×
1355
        }
×
1356

1357
        return ApiErrors[JSConsumerHBRequiresPushErr]
×
1358
}
1359

1360
// NewJSConsumerInactiveThresholdExcessError creates a new JSConsumerInactiveThresholdExcess error: "consumer inactive threshold exceeds system limit of {limit}"
1361
func NewJSConsumerInactiveThresholdExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
2✔
1362
        eopts := parseOpts(opts)
2✔
1363
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1364
                return ae
×
1365
        }
×
1366

1367
        e := ApiErrors[JSConsumerInactiveThresholdExcess]
2✔
1368
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
2✔
1369
        return &ApiError{
2✔
1370
                Code:        e.Code,
2✔
1371
                ErrCode:     e.ErrCode,
2✔
1372
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1373
        }
2✔
1374
}
1375

1376
// NewJSConsumerInvalidDeliverSubjectError creates a new JSConsumerInvalidDeliverSubject error: "invalid push consumer deliver subject"
1377
func NewJSConsumerInvalidDeliverSubjectError(opts ...ErrorOption) *ApiError {
2✔
1378
        eopts := parseOpts(opts)
2✔
1379
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1380
                return ae
×
1381
        }
×
1382

1383
        return ApiErrors[JSConsumerInvalidDeliverSubject]
2✔
1384
}
1385

1386
// NewJSConsumerInvalidGroupNameError creates a new JSConsumerInvalidGroupNameErr error: "Valid priority group name must match A-Z, a-z, 0-9, -_/=)+ and may not exceed 16 characters"
1387
func NewJSConsumerInvalidGroupNameError(opts ...ErrorOption) *ApiError {
4✔
1388
        eopts := parseOpts(opts)
4✔
1389
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1390
                return ae
×
1391
        }
×
1392

1393
        return ApiErrors[JSConsumerInvalidGroupNameErr]
4✔
1394
}
1395

1396
// NewJSConsumerInvalidPolicyError creates a new JSConsumerInvalidPolicyErrF error: "{err}"
1397
func NewJSConsumerInvalidPolicyError(err error, opts ...ErrorOption) *ApiError {
10✔
1398
        eopts := parseOpts(opts)
10✔
1399
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1400
                return ae
×
1401
        }
×
1402

1403
        e := ApiErrors[JSConsumerInvalidPolicyErrF]
10✔
1404
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1405
        return &ApiError{
10✔
1406
                Code:        e.Code,
10✔
1407
                ErrCode:     e.ErrCode,
10✔
1408
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1409
        }
10✔
1410
}
1411

1412
// NewJSConsumerInvalidPriorityGroupError creates a new JSConsumerInvalidPriorityGroupErr error: "Provided priority group does not exist for this consumer"
1413
func NewJSConsumerInvalidPriorityGroupError(opts ...ErrorOption) *ApiError {
2✔
1414
        eopts := parseOpts(opts)
2✔
1415
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1416
                return ae
×
1417
        }
×
1418

1419
        return ApiErrors[JSConsumerInvalidPriorityGroupErr]
2✔
1420
}
1421

1422
// NewJSConsumerInvalidSamplingError creates a new JSConsumerInvalidSamplingErrF error: "failed to parse consumer sampling configuration: {err}"
1423
func NewJSConsumerInvalidSamplingError(err error, opts ...ErrorOption) *ApiError {
×
1424
        eopts := parseOpts(opts)
×
1425
        if ae, ok := eopts.err.(*ApiError); ok {
×
1426
                return ae
×
1427
        }
×
1428

1429
        e := ApiErrors[JSConsumerInvalidSamplingErrF]
×
1430
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1431
        return &ApiError{
×
1432
                Code:        e.Code,
×
1433
                ErrCode:     e.ErrCode,
×
1434
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1435
        }
×
1436
}
1437

1438
// NewJSConsumerMaxDeliverBackoffError creates a new JSConsumerMaxDeliverBackoffErr error: "max deliver is required to be > length of backoff values"
1439
func NewJSConsumerMaxDeliverBackoffError(opts ...ErrorOption) *ApiError {
3✔
1440
        eopts := parseOpts(opts)
3✔
1441
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1442
                return ae
×
1443
        }
×
1444

1445
        return ApiErrors[JSConsumerMaxDeliverBackoffErr]
3✔
1446
}
1447

1448
// NewJSConsumerMaxPendingAckExcessError creates a new JSConsumerMaxPendingAckExcessErrF error: "consumer max ack pending exceeds system limit of {limit}"
1449
func NewJSConsumerMaxPendingAckExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
12✔
1450
        eopts := parseOpts(opts)
12✔
1451
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
1452
                return ae
×
1453
        }
×
1454

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

1464
// NewJSConsumerMaxPendingAckPolicyRequiredError creates a new JSConsumerMaxPendingAckPolicyRequiredErr error: "consumer requires ack policy for max ack pending"
1465
func NewJSConsumerMaxPendingAckPolicyRequiredError(opts ...ErrorOption) *ApiError {
2✔
1466
        eopts := parseOpts(opts)
2✔
1467
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1468
                return ae
×
1469
        }
×
1470

1471
        return ApiErrors[JSConsumerMaxPendingAckPolicyRequiredErr]
2✔
1472
}
1473

1474
// NewJSConsumerMaxRequestBatchExceededError creates a new JSConsumerMaxRequestBatchExceededF error: "consumer max request batch exceeds server limit of {limit}"
1475
func NewJSConsumerMaxRequestBatchExceededError(limit interface{}, opts ...ErrorOption) *ApiError {
4✔
1476
        eopts := parseOpts(opts)
4✔
1477
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1478
                return ae
×
1479
        }
×
1480

1481
        e := ApiErrors[JSConsumerMaxRequestBatchExceededF]
4✔
1482
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
4✔
1483
        return &ApiError{
4✔
1484
                Code:        e.Code,
4✔
1485
                ErrCode:     e.ErrCode,
4✔
1486
                Description: strings.NewReplacer(args...).Replace(e.Description),
4✔
1487
        }
4✔
1488
}
1489

1490
// NewJSConsumerMaxRequestBatchNegativeError creates a new JSConsumerMaxRequestBatchNegativeErr error: "consumer max request batch needs to be > 0"
1491
func NewJSConsumerMaxRequestBatchNegativeError(opts ...ErrorOption) *ApiError {
×
1492
        eopts := parseOpts(opts)
×
1493
        if ae, ok := eopts.err.(*ApiError); ok {
×
1494
                return ae
×
1495
        }
×
1496

1497
        return ApiErrors[JSConsumerMaxRequestBatchNegativeErr]
×
1498
}
1499

1500
// NewJSConsumerMaxRequestExpiresTooSmallError creates a new JSConsumerMaxRequestExpiresTooSmall error: "consumer max request expires needs to be >= 1ms"
1501
func NewJSConsumerMaxRequestExpiresTooSmallError(opts ...ErrorOption) *ApiError {
×
1502
        eopts := parseOpts(opts)
×
1503
        if ae, ok := eopts.err.(*ApiError); ok {
×
1504
                return ae
×
1505
        }
×
1506

1507
        return ApiErrors[JSConsumerMaxRequestExpiresTooSmall]
×
1508
}
1509

1510
// NewJSConsumerMaxWaitingNegativeError creates a new JSConsumerMaxWaitingNegativeErr error: "consumer max waiting needs to be positive"
1511
func NewJSConsumerMaxWaitingNegativeError(opts ...ErrorOption) *ApiError {
×
1512
        eopts := parseOpts(opts)
×
1513
        if ae, ok := eopts.err.(*ApiError); ok {
×
1514
                return ae
×
1515
        }
×
1516

1517
        return ApiErrors[JSConsumerMaxWaitingNegativeErr]
×
1518
}
1519

1520
// NewJSConsumerMetadataLengthError creates a new JSConsumerMetadataLengthErrF error: "consumer metadata exceeds maximum size of {limit}"
1521
func NewJSConsumerMetadataLengthError(limit interface{}, opts ...ErrorOption) *ApiError {
1✔
1522
        eopts := parseOpts(opts)
1✔
1523
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1524
                return ae
×
1525
        }
×
1526

1527
        e := ApiErrors[JSConsumerMetadataLengthErrF]
1✔
1528
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
1✔
1529
        return &ApiError{
1✔
1530
                Code:        e.Code,
1✔
1531
                ErrCode:     e.ErrCode,
1✔
1532
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1533
        }
1✔
1534
}
1535

1536
// NewJSConsumerMultipleFiltersNotAllowedError creates a new JSConsumerMultipleFiltersNotAllowed error: "consumer with multiple subject filters cannot use subject based API"
1537
func NewJSConsumerMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
1538
        eopts := parseOpts(opts)
1✔
1539
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1540
                return ae
×
1541
        }
×
1542

1543
        return ApiErrors[JSConsumerMultipleFiltersNotAllowed]
1✔
1544
}
1545

1546
// NewJSConsumerNameContainsPathSeparatorsError creates a new JSConsumerNameContainsPathSeparatorsErr error: "Consumer name can not contain path separators"
1547
func NewJSConsumerNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
8✔
1548
        eopts := parseOpts(opts)
8✔
1549
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1550
                return ae
×
1551
        }
×
1552

1553
        return ApiErrors[JSConsumerNameContainsPathSeparatorsErr]
8✔
1554
}
1555

1556
// NewJSConsumerNameExistError creates a new JSConsumerNameExistErr error: "consumer name already in use"
1557
func NewJSConsumerNameExistError(opts ...ErrorOption) *ApiError {
2✔
1558
        eopts := parseOpts(opts)
2✔
1559
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1560
                return ae
×
1561
        }
×
1562

1563
        return ApiErrors[JSConsumerNameExistErr]
2✔
1564
}
1565

1566
// NewJSConsumerNameTooLongError creates a new JSConsumerNameTooLongErrF error: "consumer name is too long, maximum allowed is {max}"
1567
func NewJSConsumerNameTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
×
1568
        eopts := parseOpts(opts)
×
1569
        if ae, ok := eopts.err.(*ApiError); ok {
×
1570
                return ae
×
1571
        }
×
1572

1573
        e := ApiErrors[JSConsumerNameTooLongErrF]
×
1574
        args := e.toReplacerArgs([]interface{}{"{max}", max})
×
1575
        return &ApiError{
×
1576
                Code:        e.Code,
×
1577
                ErrCode:     e.ErrCode,
×
1578
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1579
        }
×
1580
}
1581

1582
// NewJSConsumerNotFoundError creates a new JSConsumerNotFoundErr error: "consumer not found"
1583
func NewJSConsumerNotFoundError(opts ...ErrorOption) *ApiError {
2,806✔
1584
        eopts := parseOpts(opts)
2,806✔
1585
        if ae, ok := eopts.err.(*ApiError); ok {
2,806✔
1586
                return ae
×
1587
        }
×
1588

1589
        return ApiErrors[JSConsumerNotFoundErr]
2,806✔
1590
}
1591

1592
// NewJSConsumerOfflineError creates a new JSConsumerOfflineErr error: "consumer is offline"
1593
func NewJSConsumerOfflineError(opts ...ErrorOption) *ApiError {
6✔
1594
        eopts := parseOpts(opts)
6✔
1595
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1596
                return ae
×
1597
        }
×
1598

1599
        return ApiErrors[JSConsumerOfflineErr]
6✔
1600
}
1601

1602
// NewJSConsumerOfflineReasonError creates a new JSConsumerOfflineReasonErrF error: "consumer is offline: {err}"
1603
func NewJSConsumerOfflineReasonError(err error, opts ...ErrorOption) *ApiError {
24✔
1604
        eopts := parseOpts(opts)
24✔
1605
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
1606
                return ae
×
1607
        }
×
1608

1609
        e := ApiErrors[JSConsumerOfflineReasonErrF]
24✔
1610
        args := e.toReplacerArgs([]interface{}{"{err}", err})
24✔
1611
        return &ApiError{
24✔
1612
                Code:        e.Code,
24✔
1613
                ErrCode:     e.ErrCode,
24✔
1614
                Description: strings.NewReplacer(args...).Replace(e.Description),
24✔
1615
        }
24✔
1616
}
1617

1618
// NewJSConsumerOnMappedError creates a new JSConsumerOnMappedErr error: "consumer direct on a mapped consumer"
1619
func NewJSConsumerOnMappedError(opts ...ErrorOption) *ApiError {
×
1620
        eopts := parseOpts(opts)
×
1621
        if ae, ok := eopts.err.(*ApiError); ok {
×
1622
                return ae
×
1623
        }
×
1624

1625
        return ApiErrors[JSConsumerOnMappedErr]
×
1626
}
1627

1628
// NewJSConsumerOverlappingSubjectFiltersError creates a new JSConsumerOverlappingSubjectFilters error: "consumer subject filters cannot overlap"
1629
func NewJSConsumerOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
1✔
1630
        eopts := parseOpts(opts)
1✔
1631
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1632
                return ae
×
1633
        }
×
1634

1635
        return ApiErrors[JSConsumerOverlappingSubjectFilters]
1✔
1636
}
1637

1638
// NewJSConsumerPinnedTTLWithoutPriorityPolicyNoneError creates a new JSConsumerPinnedTTLWithoutPriorityPolicyNone error: "PinnedTTL cannot be set when PriorityPolicy is none"
1639
func NewJSConsumerPinnedTTLWithoutPriorityPolicyNoneError(opts ...ErrorOption) *ApiError {
1✔
1640
        eopts := parseOpts(opts)
1✔
1641
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1642
                return ae
×
1643
        }
×
1644

1645
        return ApiErrors[JSConsumerPinnedTTLWithoutPriorityPolicyNone]
1✔
1646
}
1647

1648
// NewJSConsumerPriorityGroupWithPolicyNoneError creates a new JSConsumerPriorityGroupWithPolicyNone error: "consumer can not have priority groups when policy is none"
1649
func NewJSConsumerPriorityGroupWithPolicyNoneError(opts ...ErrorOption) *ApiError {
1✔
1650
        eopts := parseOpts(opts)
1✔
1651
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1652
                return ae
×
1653
        }
×
1654

1655
        return ApiErrors[JSConsumerPriorityGroupWithPolicyNone]
1✔
1656
}
1657

1658
// NewJSConsumerPriorityPolicyWithoutGroupError creates a new JSConsumerPriorityPolicyWithoutGroup error: "Setting PriorityPolicy requires at least one PriorityGroup to be set"
1659
func NewJSConsumerPriorityPolicyWithoutGroupError(opts ...ErrorOption) *ApiError {
4✔
1660
        eopts := parseOpts(opts)
4✔
1661
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1662
                return ae
×
1663
        }
×
1664

1665
        return ApiErrors[JSConsumerPriorityPolicyWithoutGroup]
4✔
1666
}
1667

1668
// NewJSConsumerPullNotDurableError creates a new JSConsumerPullNotDurableErr error: "consumer in pull mode requires a durable name"
1669
func NewJSConsumerPullNotDurableError(opts ...ErrorOption) *ApiError {
×
1670
        eopts := parseOpts(opts)
×
1671
        if ae, ok := eopts.err.(*ApiError); ok {
×
1672
                return ae
×
1673
        }
×
1674

1675
        return ApiErrors[JSConsumerPullNotDurableErr]
×
1676
}
1677

1678
// NewJSConsumerPullRequiresAckError creates a new JSConsumerPullRequiresAckErr error: "consumer in pull mode requires explicit ack policy on workqueue stream"
1679
func NewJSConsumerPullRequiresAckError(opts ...ErrorOption) *ApiError {
6✔
1680
        eopts := parseOpts(opts)
6✔
1681
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1682
                return ae
×
1683
        }
×
1684

1685
        return ApiErrors[JSConsumerPullRequiresAckErr]
6✔
1686
}
1687

1688
// NewJSConsumerPullWithRateLimitError creates a new JSConsumerPullWithRateLimitErr error: "consumer in pull mode can not have rate limit set"
1689
func NewJSConsumerPullWithRateLimitError(opts ...ErrorOption) *ApiError {
1✔
1690
        eopts := parseOpts(opts)
1✔
1691
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1692
                return ae
×
1693
        }
×
1694

1695
        return ApiErrors[JSConsumerPullWithRateLimitErr]
1✔
1696
}
1697

1698
// NewJSConsumerPushMaxWaitingError creates a new JSConsumerPushMaxWaitingErr error: "consumer in push mode can not set max waiting"
1699
func NewJSConsumerPushMaxWaitingError(opts ...ErrorOption) *ApiError {
3✔
1700
        eopts := parseOpts(opts)
3✔
1701
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1702
                return ae
×
1703
        }
×
1704

1705
        return ApiErrors[JSConsumerPushMaxWaitingErr]
3✔
1706
}
1707

1708
// NewJSConsumerPushWithPriorityGroupError creates a new JSConsumerPushWithPriorityGroupErr error: "priority groups can not be used with push consumers"
1709
func NewJSConsumerPushWithPriorityGroupError(opts ...ErrorOption) *ApiError {
1✔
1710
        eopts := parseOpts(opts)
1✔
1711
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1712
                return ae
×
1713
        }
×
1714

1715
        return ApiErrors[JSConsumerPushWithPriorityGroupErr]
1✔
1716
}
1717

1718
// NewJSConsumerReplacementWithDifferentNameError creates a new JSConsumerReplacementWithDifferentNameErr error: "consumer replacement durable config not the same"
1719
func NewJSConsumerReplacementWithDifferentNameError(opts ...ErrorOption) *ApiError {
×
1720
        eopts := parseOpts(opts)
×
1721
        if ae, ok := eopts.err.(*ApiError); ok {
×
1722
                return ae
×
1723
        }
×
1724

1725
        return ApiErrors[JSConsumerReplacementWithDifferentNameErr]
×
1726
}
1727

1728
// NewJSConsumerReplayPolicyInvalidError creates a new JSConsumerReplayPolicyInvalidErr error: "consumer replay policy invalid"
1729
func NewJSConsumerReplayPolicyInvalidError(opts ...ErrorOption) *ApiError {
2✔
1730
        eopts := parseOpts(opts)
2✔
1731
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1732
                return ae
×
1733
        }
×
1734

1735
        return ApiErrors[JSConsumerReplayPolicyInvalidErr]
2✔
1736
}
1737

1738
// NewJSConsumerReplicasExceedsStreamError creates a new JSConsumerReplicasExceedsStream error: "consumer config replica count exceeds parent stream"
1739
func NewJSConsumerReplicasExceedsStreamError(opts ...ErrorOption) *ApiError {
1✔
1740
        eopts := parseOpts(opts)
1✔
1741
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1742
                return ae
×
1743
        }
×
1744

1745
        return ApiErrors[JSConsumerReplicasExceedsStream]
1✔
1746
}
1747

1748
// NewJSConsumerReplicasShouldMatchStreamError creates a new JSConsumerReplicasShouldMatchStream error: "consumer config replicas must match interest retention stream's replicas"
1749
func NewJSConsumerReplicasShouldMatchStreamError(opts ...ErrorOption) *ApiError {
2✔
1750
        eopts := parseOpts(opts)
2✔
1751
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1752
                return ae
×
1753
        }
×
1754

1755
        return ApiErrors[JSConsumerReplicasShouldMatchStream]
2✔
1756
}
1757

1758
// NewJSConsumerSmallHeartbeatError creates a new JSConsumerSmallHeartbeatErr error: "consumer idle heartbeat needs to be >= 100ms"
1759
func NewJSConsumerSmallHeartbeatError(opts ...ErrorOption) *ApiError {
1✔
1760
        eopts := parseOpts(opts)
1✔
1761
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1762
                return ae
×
1763
        }
×
1764

1765
        return ApiErrors[JSConsumerSmallHeartbeatErr]
1✔
1766
}
1767

1768
// NewJSConsumerStoreFailedError creates a new JSConsumerStoreFailedErrF error: "error creating store for consumer: {err}"
1769
func NewJSConsumerStoreFailedError(err error, opts ...ErrorOption) *ApiError {
9✔
1770
        eopts := parseOpts(opts)
9✔
1771
        if ae, ok := eopts.err.(*ApiError); ok {
9✔
1772
                return ae
×
1773
        }
×
1774

1775
        e := ApiErrors[JSConsumerStoreFailedErrF]
9✔
1776
        args := e.toReplacerArgs([]interface{}{"{err}", err})
9✔
1777
        return &ApiError{
9✔
1778
                Code:        e.Code,
9✔
1779
                ErrCode:     e.ErrCode,
9✔
1780
                Description: strings.NewReplacer(args...).Replace(e.Description),
9✔
1781
        }
9✔
1782
}
1783

1784
// NewJSConsumerWQConsumerNotDeliverAllError creates a new JSConsumerWQConsumerNotDeliverAllErr error: "consumer must be deliver all on workqueue stream"
1785
func NewJSConsumerWQConsumerNotDeliverAllError(opts ...ErrorOption) *ApiError {
×
1786
        eopts := parseOpts(opts)
×
1787
        if ae, ok := eopts.err.(*ApiError); ok {
×
1788
                return ae
×
1789
        }
×
1790

1791
        return ApiErrors[JSConsumerWQConsumerNotDeliverAllErr]
×
1792
}
1793

1794
// NewJSConsumerWQConsumerNotUniqueError creates a new JSConsumerWQConsumerNotUniqueErr error: "filtered consumer not unique on workqueue stream"
1795
func NewJSConsumerWQConsumerNotUniqueError(opts ...ErrorOption) *ApiError {
11✔
1796
        eopts := parseOpts(opts)
11✔
1797
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
1798
                return ae
×
1799
        }
×
1800

1801
        return ApiErrors[JSConsumerWQConsumerNotUniqueErr]
11✔
1802
}
1803

1804
// NewJSConsumerWQMultipleUnfilteredError creates a new JSConsumerWQMultipleUnfilteredErr error: "multiple non-filtered consumers not allowed on workqueue stream"
1805
func NewJSConsumerWQMultipleUnfilteredError(opts ...ErrorOption) *ApiError {
2✔
1806
        eopts := parseOpts(opts)
2✔
1807
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1808
                return ae
×
1809
        }
×
1810

1811
        return ApiErrors[JSConsumerWQMultipleUnfilteredErr]
2✔
1812
}
1813

1814
// NewJSConsumerWQRequiresExplicitAckError creates a new JSConsumerWQRequiresExplicitAckErr error: "workqueue stream requires explicit ack"
1815
func NewJSConsumerWQRequiresExplicitAckError(opts ...ErrorOption) *ApiError {
×
1816
        eopts := parseOpts(opts)
×
1817
        if ae, ok := eopts.err.(*ApiError); ok {
×
1818
                return ae
×
1819
        }
×
1820

1821
        return ApiErrors[JSConsumerWQRequiresExplicitAckErr]
×
1822
}
1823

1824
// NewJSConsumerWithFlowControlNeedsHeartbeatsError creates a new JSConsumerWithFlowControlNeedsHeartbeats error: "consumer with flow control also needs heartbeats"
1825
func NewJSConsumerWithFlowControlNeedsHeartbeatsError(opts ...ErrorOption) *ApiError {
4✔
1826
        eopts := parseOpts(opts)
4✔
1827
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1828
                return ae
×
1829
        }
×
1830

1831
        return ApiErrors[JSConsumerWithFlowControlNeedsHeartbeats]
4✔
1832
}
1833

1834
// NewJSInsufficientResourcesError creates a new JSInsufficientResourcesErr error: "insufficient resources"
1835
func NewJSInsufficientResourcesError(opts ...ErrorOption) *ApiError {
13✔
1836
        eopts := parseOpts(opts)
13✔
1837
        if ae, ok := eopts.err.(*ApiError); ok {
13✔
1838
                return ae
×
1839
        }
×
1840

1841
        return ApiErrors[JSInsufficientResourcesErr]
13✔
1842
}
1843

1844
// NewJSInvalidJSONError creates a new JSInvalidJSONErr error: "invalid JSON: {err}"
1845
func NewJSInvalidJSONError(err error, opts ...ErrorOption) *ApiError {
10✔
1846
        eopts := parseOpts(opts)
10✔
1847
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1848
                return ae
×
1849
        }
×
1850

1851
        e := ApiErrors[JSInvalidJSONErr]
10✔
1852
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1853
        return &ApiError{
10✔
1854
                Code:        e.Code,
10✔
1855
                ErrCode:     e.ErrCode,
10✔
1856
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1857
        }
10✔
1858
}
1859

1860
// NewJSMaximumConsumersLimitError creates a new JSMaximumConsumersLimitErr error: "maximum consumers limit reached"
1861
func NewJSMaximumConsumersLimitError(opts ...ErrorOption) *ApiError {
29✔
1862
        eopts := parseOpts(opts)
29✔
1863
        if ae, ok := eopts.err.(*ApiError); ok {
29✔
1864
                return ae
×
1865
        }
×
1866

1867
        return ApiErrors[JSMaximumConsumersLimitErr]
29✔
1868
}
1869

1870
// NewJSMaximumStreamsLimitError creates a new JSMaximumStreamsLimitErr error: "maximum number of streams reached"
1871
func NewJSMaximumStreamsLimitError(opts ...ErrorOption) *ApiError {
16✔
1872
        eopts := parseOpts(opts)
16✔
1873
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
1874
                return ae
×
1875
        }
×
1876

1877
        return ApiErrors[JSMaximumStreamsLimitErr]
16✔
1878
}
1879

1880
// NewJSMemoryResourcesExceededError creates a new JSMemoryResourcesExceededErr error: "insufficient memory resources available"
1881
func NewJSMemoryResourcesExceededError(opts ...ErrorOption) *ApiError {
4✔
1882
        eopts := parseOpts(opts)
4✔
1883
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1884
                return ae
×
1885
        }
×
1886

1887
        return ApiErrors[JSMemoryResourcesExceededErr]
4✔
1888
}
1889

1890
// NewJSMessageCounterBrokenError creates a new JSMessageCounterBrokenErr error: "message counter is broken"
1891
func NewJSMessageCounterBrokenError(opts ...ErrorOption) *ApiError {
4✔
1892
        eopts := parseOpts(opts)
4✔
1893
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1894
                return ae
×
1895
        }
×
1896

1897
        return ApiErrors[JSMessageCounterBrokenErr]
4✔
1898
}
1899

1900
// NewJSMessageIncrDisabledError creates a new JSMessageIncrDisabledErr error: "message counters is disabled"
1901
func NewJSMessageIncrDisabledError(opts ...ErrorOption) *ApiError {
4✔
1902
        eopts := parseOpts(opts)
4✔
1903
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1904
                return ae
×
1905
        }
×
1906

1907
        return ApiErrors[JSMessageIncrDisabledErr]
4✔
1908
}
1909

1910
// NewJSMessageIncrInvalidError creates a new JSMessageIncrInvalidErr error: "message counter increment is invalid"
1911
func NewJSMessageIncrInvalidError(opts ...ErrorOption) *ApiError {
24✔
1912
        eopts := parseOpts(opts)
24✔
1913
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
1914
                return ae
×
1915
        }
×
1916

1917
        return ApiErrors[JSMessageIncrInvalidErr]
24✔
1918
}
1919

1920
// NewJSMessageIncrMissingError creates a new JSMessageIncrMissingErr error: "message counter increment is missing"
1921
func NewJSMessageIncrMissingError(opts ...ErrorOption) *ApiError {
8✔
1922
        eopts := parseOpts(opts)
8✔
1923
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1924
                return ae
×
1925
        }
×
1926

1927
        return ApiErrors[JSMessageIncrMissingErr]
8✔
1928
}
1929

1930
// NewJSMessageIncrPayloadError creates a new JSMessageIncrPayloadErr error: "message counter has payload"
1931
func NewJSMessageIncrPayloadError(opts ...ErrorOption) *ApiError {
4✔
1932
        eopts := parseOpts(opts)
4✔
1933
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1934
                return ae
×
1935
        }
×
1936

1937
        return ApiErrors[JSMessageIncrPayloadErr]
4✔
1938
}
1939

1940
// NewJSMessageSchedulesDisabledError creates a new JSMessageSchedulesDisabledErr error: "message schedules is disabled"
1941
func NewJSMessageSchedulesDisabledError(opts ...ErrorOption) *ApiError {
20✔
1942
        eopts := parseOpts(opts)
20✔
1943
        if ae, ok := eopts.err.(*ApiError); ok {
20✔
1944
                return ae
×
1945
        }
×
1946

1947
        return ApiErrors[JSMessageSchedulesDisabledErr]
20✔
1948
}
1949

1950
// NewJSMessageSchedulesPatternInvalidError creates a new JSMessageSchedulesPatternInvalidErr error: "message schedules pattern is invalid"
1951
func NewJSMessageSchedulesPatternInvalidError(opts ...ErrorOption) *ApiError {
15✔
1952
        eopts := parseOpts(opts)
15✔
1953
        if ae, ok := eopts.err.(*ApiError); ok {
15✔
1954
                return ae
×
1955
        }
×
1956

1957
        return ApiErrors[JSMessageSchedulesPatternInvalidErr]
15✔
1958
}
1959

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

1967
        return ApiErrors[JSMessageSchedulesRollupInvalidErr]
8✔
1968
}
1969

1970
// NewJSMessageSchedulesTTLInvalidError creates a new JSMessageSchedulesTTLInvalidErr error: "message schedules invalid per-message TTL"
1971
func NewJSMessageSchedulesTTLInvalidError(opts ...ErrorOption) *ApiError {
10✔
1972
        eopts := parseOpts(opts)
10✔
1973
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1974
                return ae
×
1975
        }
×
1976

1977
        return ApiErrors[JSMessageSchedulesTTLInvalidErr]
10✔
1978
}
1979

1980
// NewJSMessageSchedulesTargetInvalidError creates a new JSMessageSchedulesTargetInvalidErr error: "message schedules target is invalid"
1981
func NewJSMessageSchedulesTargetInvalidError(opts ...ErrorOption) *ApiError {
30✔
1982
        eopts := parseOpts(opts)
30✔
1983
        if ae, ok := eopts.err.(*ApiError); ok {
30✔
1984
                return ae
×
1985
        }
×
1986

1987
        return ApiErrors[JSMessageSchedulesTargetInvalidErr]
30✔
1988
}
1989

1990
// NewJSMessageTTLDisabledError creates a new JSMessageTTLDisabledErr error: "per-message TTL is disabled"
1991
func NewJSMessageTTLDisabledError(opts ...ErrorOption) *ApiError {
16✔
1992
        eopts := parseOpts(opts)
16✔
1993
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
1994
                return ae
×
1995
        }
×
1996

1997
        return ApiErrors[JSMessageTTLDisabledErr]
16✔
1998
}
1999

2000
// NewJSMessageTTLInvalidError creates a new JSMessageTTLInvalidErr error: "invalid per-message TTL"
2001
func NewJSMessageTTLInvalidError(opts ...ErrorOption) *ApiError {
23✔
2002
        eopts := parseOpts(opts)
23✔
2003
        if ae, ok := eopts.err.(*ApiError); ok {
23✔
2004
                return ae
×
2005
        }
×
2006

2007
        return ApiErrors[JSMessageTTLInvalidErr]
23✔
2008
}
2009

2010
// NewJSMirrorConsumerSetupFailedError creates a new JSMirrorConsumerSetupFailedErrF error: "{err}"
2011
func NewJSMirrorConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
2012
        eopts := parseOpts(opts)
×
2013
        if ae, ok := eopts.err.(*ApiError); ok {
×
2014
                return ae
×
2015
        }
×
2016

2017
        e := ApiErrors[JSMirrorConsumerSetupFailedErrF]
×
2018
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2019
        return &ApiError{
×
2020
                Code:        e.Code,
×
2021
                ErrCode:     e.ErrCode,
×
2022
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2023
        }
×
2024
}
2025

2026
// NewJSMirrorInvalidStreamNameError creates a new JSMirrorInvalidStreamName error: "mirrored stream name is invalid"
2027
func NewJSMirrorInvalidStreamNameError(opts ...ErrorOption) *ApiError {
×
2028
        eopts := parseOpts(opts)
×
2029
        if ae, ok := eopts.err.(*ApiError); ok {
×
2030
                return ae
×
2031
        }
×
2032

2033
        return ApiErrors[JSMirrorInvalidStreamName]
×
2034
}
2035

2036
// NewJSMirrorInvalidSubjectFilterError creates a new JSMirrorInvalidSubjectFilter error: "mirror transform source: {err}"
2037
func NewJSMirrorInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
2✔
2038
        eopts := parseOpts(opts)
2✔
2039
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2040
                return ae
×
2041
        }
×
2042

2043
        e := ApiErrors[JSMirrorInvalidSubjectFilter]
2✔
2044
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2✔
2045
        return &ApiError{
2✔
2046
                Code:        e.Code,
2✔
2047
                ErrCode:     e.ErrCode,
2✔
2048
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2049
        }
2✔
2050
}
2051

2052
// NewJSMirrorInvalidTransformDestinationError creates a new JSMirrorInvalidTransformDestination error: "mirror transform: {err}"
2053
func NewJSMirrorInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
2✔
2054
        eopts := parseOpts(opts)
2✔
2055
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2056
                return ae
×
2057
        }
×
2058

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

2068
// NewJSMirrorMaxMessageSizeTooBigError creates a new JSMirrorMaxMessageSizeTooBigErr error: "stream mirror must have max message size >= source"
2069
func NewJSMirrorMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
2070
        eopts := parseOpts(opts)
×
2071
        if ae, ok := eopts.err.(*ApiError); ok {
×
2072
                return ae
×
2073
        }
×
2074

2075
        return ApiErrors[JSMirrorMaxMessageSizeTooBigErr]
×
2076
}
2077

2078
// NewJSMirrorMultipleFiltersNotAllowedError creates a new JSMirrorMultipleFiltersNotAllowed error: "mirror with multiple subject transforms cannot also have a single subject filter"
2079
func NewJSMirrorMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
2080
        eopts := parseOpts(opts)
1✔
2081
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2082
                return ae
×
2083
        }
×
2084

2085
        return ApiErrors[JSMirrorMultipleFiltersNotAllowed]
1✔
2086
}
2087

2088
// NewJSMirrorOverlappingSubjectFiltersError creates a new JSMirrorOverlappingSubjectFilters error: "mirror subject filters can not overlap"
2089
func NewJSMirrorOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
2✔
2090
        eopts := parseOpts(opts)
2✔
2091
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2092
                return ae
×
2093
        }
×
2094

2095
        return ApiErrors[JSMirrorOverlappingSubjectFilters]
2✔
2096
}
2097

2098
// NewJSMirrorWithAtomicPublishError creates a new JSMirrorWithAtomicPublishErr error: "stream mirrors can not also use atomic publishing"
2099
func NewJSMirrorWithAtomicPublishError(opts ...ErrorOption) *ApiError {
4✔
2100
        eopts := parseOpts(opts)
4✔
2101
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2102
                return ae
×
2103
        }
×
2104

2105
        return ApiErrors[JSMirrorWithAtomicPublishErr]
4✔
2106
}
2107

2108
// NewJSMirrorWithCountersError creates a new JSMirrorWithCountersErr error: "stream mirrors can not also calculate counters"
2109
func NewJSMirrorWithCountersError(opts ...ErrorOption) *ApiError {
4✔
2110
        eopts := parseOpts(opts)
4✔
2111
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2112
                return ae
×
2113
        }
×
2114

2115
        return ApiErrors[JSMirrorWithCountersErr]
4✔
2116
}
2117

2118
// NewJSMirrorWithFirstSeqError creates a new JSMirrorWithFirstSeqErr error: "stream mirrors can not have first sequence configured"
2119
func NewJSMirrorWithFirstSeqError(opts ...ErrorOption) *ApiError {
2✔
2120
        eopts := parseOpts(opts)
2✔
2121
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2122
                return ae
×
2123
        }
×
2124

2125
        return ApiErrors[JSMirrorWithFirstSeqErr]
2✔
2126
}
2127

2128
// NewJSMirrorWithMsgSchedulesError creates a new JSMirrorWithMsgSchedulesErr error: "stream mirrors can not also schedule messages"
2129
func NewJSMirrorWithMsgSchedulesError(opts ...ErrorOption) *ApiError {
2✔
2130
        eopts := parseOpts(opts)
2✔
2131
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2132
                return ae
×
2133
        }
×
2134

2135
        return ApiErrors[JSMirrorWithMsgSchedulesErr]
2✔
2136
}
2137

2138
// NewJSMirrorWithSourcesError creates a new JSMirrorWithSourcesErr error: "stream mirrors can not also contain other sources"
2139
func NewJSMirrorWithSourcesError(opts ...ErrorOption) *ApiError {
×
2140
        eopts := parseOpts(opts)
×
2141
        if ae, ok := eopts.err.(*ApiError); ok {
×
2142
                return ae
×
2143
        }
×
2144

2145
        return ApiErrors[JSMirrorWithSourcesErr]
×
2146
}
2147

2148
// NewJSMirrorWithStartSeqAndTimeError creates a new JSMirrorWithStartSeqAndTimeErr error: "stream mirrors can not have both start seq and start time configured"
2149
func NewJSMirrorWithStartSeqAndTimeError(opts ...ErrorOption) *ApiError {
×
2150
        eopts := parseOpts(opts)
×
2151
        if ae, ok := eopts.err.(*ApiError); ok {
×
2152
                return ae
×
2153
        }
×
2154

2155
        return ApiErrors[JSMirrorWithStartSeqAndTimeErr]
×
2156
}
2157

2158
// NewJSMirrorWithSubjectFiltersError creates a new JSMirrorWithSubjectFiltersErr error: "stream mirrors can not contain filtered subjects"
2159
func NewJSMirrorWithSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
2160
        eopts := parseOpts(opts)
×
2161
        if ae, ok := eopts.err.(*ApiError); ok {
×
2162
                return ae
×
2163
        }
×
2164

2165
        return ApiErrors[JSMirrorWithSubjectFiltersErr]
×
2166
}
2167

2168
// NewJSMirrorWithSubjectsError creates a new JSMirrorWithSubjectsErr error: "stream mirrors can not contain subjects"
2169
func NewJSMirrorWithSubjectsError(opts ...ErrorOption) *ApiError {
2✔
2170
        eopts := parseOpts(opts)
2✔
2171
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2172
                return ae
×
2173
        }
×
2174

2175
        return ApiErrors[JSMirrorWithSubjectsErr]
2✔
2176
}
2177

2178
// NewJSNoAccountError creates a new JSNoAccountErr error: "account not found"
2179
func NewJSNoAccountError(opts ...ErrorOption) *ApiError {
1✔
2180
        eopts := parseOpts(opts)
1✔
2181
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2182
                return ae
×
2183
        }
×
2184

2185
        return ApiErrors[JSNoAccountErr]
1✔
2186
}
2187

2188
// NewJSNoLimitsError creates a new JSNoLimitsErr error: "no JetStream default or applicable tiered limit present"
2189
func NewJSNoLimitsError(opts ...ErrorOption) *ApiError {
4✔
2190
        eopts := parseOpts(opts)
4✔
2191
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2192
                return ae
×
2193
        }
×
2194

2195
        return ApiErrors[JSNoLimitsErr]
4✔
2196
}
2197

2198
// NewJSNoMessageFoundError creates a new JSNoMessageFoundErr error: "no message found"
2199
func NewJSNoMessageFoundError(opts ...ErrorOption) *ApiError {
845✔
2200
        eopts := parseOpts(opts)
845✔
2201
        if ae, ok := eopts.err.(*ApiError); ok {
845✔
2202
                return ae
×
2203
        }
×
2204

2205
        return ApiErrors[JSNoMessageFoundErr]
845✔
2206
}
2207

2208
// NewJSNotEmptyRequestError creates a new JSNotEmptyRequestErr error: "expected an empty request payload"
2209
func NewJSNotEmptyRequestError(opts ...ErrorOption) *ApiError {
3✔
2210
        eopts := parseOpts(opts)
3✔
2211
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2212
                return ae
×
2213
        }
×
2214

2215
        return ApiErrors[JSNotEmptyRequestErr]
3✔
2216
}
2217

2218
// NewJSNotEnabledError creates a new JSNotEnabledErr error: "JetStream not enabled"
2219
func NewJSNotEnabledError(opts ...ErrorOption) *ApiError {
10✔
2220
        eopts := parseOpts(opts)
10✔
2221
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2222
                return ae
×
2223
        }
×
2224

2225
        return ApiErrors[JSNotEnabledErr]
10✔
2226
}
2227

2228
// NewJSNotEnabledForAccountError creates a new JSNotEnabledForAccountErr error: "JetStream not enabled for account"
2229
func NewJSNotEnabledForAccountError(opts ...ErrorOption) *ApiError {
320✔
2230
        eopts := parseOpts(opts)
320✔
2231
        if ae, ok := eopts.err.(*ApiError); ok {
320✔
2232
                return ae
×
2233
        }
×
2234

2235
        return ApiErrors[JSNotEnabledForAccountErr]
320✔
2236
}
2237

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

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

2254
// NewJSPeerRemapError creates a new JSPeerRemapErr error: "peer remap failed"
2255
func NewJSPeerRemapError(opts ...ErrorOption) *ApiError {
5✔
2256
        eopts := parseOpts(opts)
5✔
2257
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2258
                return ae
1✔
2259
        }
1✔
2260

2261
        return ApiErrors[JSPeerRemapErr]
4✔
2262
}
2263

2264
// NewJSRaftGeneralError creates a new JSRaftGeneralErrF error: "{err}"
2265
func NewJSRaftGeneralError(err error, opts ...ErrorOption) *ApiError {
×
2266
        eopts := parseOpts(opts)
×
2267
        if ae, ok := eopts.err.(*ApiError); ok {
×
2268
                return ae
×
2269
        }
×
2270

2271
        e := ApiErrors[JSRaftGeneralErrF]
×
2272
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2273
        return &ApiError{
×
2274
                Code:        e.Code,
×
2275
                ErrCode:     e.ErrCode,
×
2276
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2277
        }
×
2278
}
2279

2280
// NewJSReplicasCountCannotBeNegativeError creates a new JSReplicasCountCannotBeNegative error: "replicas count cannot be negative"
2281
func NewJSReplicasCountCannotBeNegativeError(opts ...ErrorOption) *ApiError {
16✔
2282
        eopts := parseOpts(opts)
16✔
2283
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2284
                return ae
×
2285
        }
×
2286

2287
        return ApiErrors[JSReplicasCountCannotBeNegative]
16✔
2288
}
2289

2290
// NewJSRequiredApiLevelError creates a new JSRequiredApiLevelErr error: "JetStream minimum api level required"
2291
func NewJSRequiredApiLevelError(opts ...ErrorOption) *ApiError {
50✔
2292
        eopts := parseOpts(opts)
50✔
2293
        if ae, ok := eopts.err.(*ApiError); ok {
50✔
2294
                return ae
×
2295
        }
×
2296

2297
        return ApiErrors[JSRequiredApiLevelErr]
50✔
2298
}
2299

2300
// NewJSRestoreSubscribeFailedError creates a new JSRestoreSubscribeFailedErrF error: "JetStream unable to subscribe to restore snapshot {subject}: {err}"
2301
func NewJSRestoreSubscribeFailedError(err error, subject interface{}, opts ...ErrorOption) *ApiError {
1✔
2302
        eopts := parseOpts(opts)
1✔
2303
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2304
                return ae
×
2305
        }
×
2306

2307
        e := ApiErrors[JSRestoreSubscribeFailedErrF]
1✔
2308
        args := e.toReplacerArgs([]interface{}{"{err}", err, "{subject}", subject})
1✔
2309
        return &ApiError{
1✔
2310
                Code:        e.Code,
1✔
2311
                ErrCode:     e.ErrCode,
1✔
2312
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2313
        }
1✔
2314
}
2315

2316
// NewJSSequenceNotFoundError creates a new JSSequenceNotFoundErrF error: "sequence {seq} not found"
2317
func NewJSSequenceNotFoundError(seq uint64, opts ...ErrorOption) *ApiError {
127✔
2318
        eopts := parseOpts(opts)
127✔
2319
        if ae, ok := eopts.err.(*ApiError); ok {
127✔
2320
                return ae
×
2321
        }
×
2322

2323
        e := ApiErrors[JSSequenceNotFoundErrF]
127✔
2324
        args := e.toReplacerArgs([]interface{}{"{seq}", seq})
127✔
2325
        return &ApiError{
127✔
2326
                Code:        e.Code,
127✔
2327
                ErrCode:     e.ErrCode,
127✔
2328
                Description: strings.NewReplacer(args...).Replace(e.Description),
127✔
2329
        }
127✔
2330
}
2331

2332
// NewJSSnapshotDeliverSubjectInvalidError creates a new JSSnapshotDeliverSubjectInvalidErr error: "deliver subject not valid"
2333
func NewJSSnapshotDeliverSubjectInvalidError(opts ...ErrorOption) *ApiError {
1✔
2334
        eopts := parseOpts(opts)
1✔
2335
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2336
                return ae
×
2337
        }
×
2338

2339
        return ApiErrors[JSSnapshotDeliverSubjectInvalidErr]
1✔
2340
}
2341

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

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

2358
// NewJSSourceDuplicateDetectedError creates a new JSSourceDuplicateDetected error: "duplicate source configuration detected"
2359
func NewJSSourceDuplicateDetectedError(opts ...ErrorOption) *ApiError {
×
2360
        eopts := parseOpts(opts)
×
2361
        if ae, ok := eopts.err.(*ApiError); ok {
×
2362
                return ae
×
2363
        }
×
2364

2365
        return ApiErrors[JSSourceDuplicateDetected]
×
2366
}
2367

2368
// NewJSSourceInvalidStreamNameError creates a new JSSourceInvalidStreamName error: "sourced stream name is invalid"
2369
func NewJSSourceInvalidStreamNameError(opts ...ErrorOption) *ApiError {
1✔
2370
        eopts := parseOpts(opts)
1✔
2371
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2372
                return ae
×
2373
        }
×
2374

2375
        return ApiErrors[JSSourceInvalidStreamName]
1✔
2376
}
2377

2378
// NewJSSourceInvalidSubjectFilterError creates a new JSSourceInvalidSubjectFilter error: "source transform source: {err}"
2379
func NewJSSourceInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
1✔
2380
        eopts := parseOpts(opts)
1✔
2381
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2382
                return ae
×
2383
        }
×
2384

2385
        e := ApiErrors[JSSourceInvalidSubjectFilter]
1✔
2386
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2387
        return &ApiError{
1✔
2388
                Code:        e.Code,
1✔
2389
                ErrCode:     e.ErrCode,
1✔
2390
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2391
        }
1✔
2392
}
2393

2394
// NewJSSourceInvalidTransformDestinationError creates a new JSSourceInvalidTransformDestination error: "source transform: {err}"
2395
func NewJSSourceInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
2396
        eopts := parseOpts(opts)
1✔
2397
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2398
                return ae
×
2399
        }
×
2400

2401
        e := ApiErrors[JSSourceInvalidTransformDestination]
1✔
2402
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2403
        return &ApiError{
1✔
2404
                Code:        e.Code,
1✔
2405
                ErrCode:     e.ErrCode,
1✔
2406
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2407
        }
1✔
2408
}
2409

2410
// NewJSSourceMaxMessageSizeTooBigError creates a new JSSourceMaxMessageSizeTooBigErr error: "stream source must have max message size >= target"
2411
func NewJSSourceMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
2412
        eopts := parseOpts(opts)
×
2413
        if ae, ok := eopts.err.(*ApiError); ok {
×
2414
                return ae
×
2415
        }
×
2416

2417
        return ApiErrors[JSSourceMaxMessageSizeTooBigErr]
×
2418
}
2419

2420
// NewJSSourceMultipleFiltersNotAllowedError creates a new JSSourceMultipleFiltersNotAllowed error: "source with multiple subject transforms cannot also have a single subject filter"
2421
func NewJSSourceMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
×
2422
        eopts := parseOpts(opts)
×
2423
        if ae, ok := eopts.err.(*ApiError); ok {
×
2424
                return ae
×
2425
        }
×
2426

2427
        return ApiErrors[JSSourceMultipleFiltersNotAllowed]
×
2428
}
2429

2430
// NewJSSourceOverlappingSubjectFiltersError creates a new JSSourceOverlappingSubjectFilters error: "source filters can not overlap"
2431
func NewJSSourceOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
2432
        eopts := parseOpts(opts)
×
2433
        if ae, ok := eopts.err.(*ApiError); ok {
×
2434
                return ae
×
2435
        }
×
2436

2437
        return ApiErrors[JSSourceOverlappingSubjectFilters]
×
2438
}
2439

2440
// NewJSSourceWithMsgSchedulesError creates a new JSSourceWithMsgSchedulesErr error: "stream source can not also schedule messages"
2441
func NewJSSourceWithMsgSchedulesError(opts ...ErrorOption) *ApiError {
2✔
2442
        eopts := parseOpts(opts)
2✔
2443
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2444
                return ae
×
2445
        }
×
2446

2447
        return ApiErrors[JSSourceWithMsgSchedulesErr]
2✔
2448
}
2449

2450
// NewJSStorageResourcesExceededError creates a new JSStorageResourcesExceededErr error: "insufficient storage resources available"
2451
func NewJSStorageResourcesExceededError(opts ...ErrorOption) *ApiError {
25✔
2452
        eopts := parseOpts(opts)
25✔
2453
        if ae, ok := eopts.err.(*ApiError); ok {
25✔
2454
                return ae
×
2455
        }
×
2456

2457
        return ApiErrors[JSStorageResourcesExceededErr]
25✔
2458
}
2459

2460
// NewJSStreamAssignmentError creates a new JSStreamAssignmentErrF error: "{err}"
2461
func NewJSStreamAssignmentError(err error, opts ...ErrorOption) *ApiError {
×
2462
        eopts := parseOpts(opts)
×
2463
        if ae, ok := eopts.err.(*ApiError); ok {
×
2464
                return ae
×
2465
        }
×
2466

2467
        e := ApiErrors[JSStreamAssignmentErrF]
×
2468
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2469
        return &ApiError{
×
2470
                Code:        e.Code,
×
2471
                ErrCode:     e.ErrCode,
×
2472
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2473
        }
×
2474
}
2475

2476
// NewJSStreamCreateError creates a new JSStreamCreateErrF error: "{err}"
2477
func NewJSStreamCreateError(err error, opts ...ErrorOption) *ApiError {
84✔
2478
        eopts := parseOpts(opts)
84✔
2479
        if ae, ok := eopts.err.(*ApiError); ok {
168✔
2480
                return ae
84✔
2481
        }
84✔
2482

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

2492
// NewJSStreamDeleteError creates a new JSStreamDeleteErrF error: "{err}"
2493
func NewJSStreamDeleteError(err error, opts ...ErrorOption) *ApiError {
×
2494
        eopts := parseOpts(opts)
×
2495
        if ae, ok := eopts.err.(*ApiError); ok {
×
2496
                return ae
×
2497
        }
×
2498

2499
        e := ApiErrors[JSStreamDeleteErrF]
×
2500
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2501
        return &ApiError{
×
2502
                Code:        e.Code,
×
2503
                ErrCode:     e.ErrCode,
×
2504
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2505
        }
×
2506
}
2507

2508
// NewJSStreamDuplicateMessageConflictError creates a new JSStreamDuplicateMessageConflict error: "duplicate message id is in process"
2509
func NewJSStreamDuplicateMessageConflictError(opts ...ErrorOption) *ApiError {
100✔
2510
        eopts := parseOpts(opts)
100✔
2511
        if ae, ok := eopts.err.(*ApiError); ok {
100✔
2512
                return ae
×
2513
        }
×
2514

2515
        return ApiErrors[JSStreamDuplicateMessageConflict]
100✔
2516
}
2517

2518
// NewJSStreamExpectedLastSeqPerSubjectInvalidError creates a new JSStreamExpectedLastSeqPerSubjectInvalid error: "missing sequence for expected last sequence per subject"
2519
func NewJSStreamExpectedLastSeqPerSubjectInvalidError(opts ...ErrorOption) *ApiError {
8✔
2520
        eopts := parseOpts(opts)
8✔
2521
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
2522
                return ae
×
2523
        }
×
2524

2525
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectInvalid]
8✔
2526
}
2527

2528
// NewJSStreamExpectedLastSeqPerSubjectNotReadyError creates a new JSStreamExpectedLastSeqPerSubjectNotReady error: "expected last sequence per subject temporarily unavailable"
2529
func NewJSStreamExpectedLastSeqPerSubjectNotReadyError(opts ...ErrorOption) *ApiError {
×
2530
        eopts := parseOpts(opts)
×
2531
        if ae, ok := eopts.err.(*ApiError); ok {
×
2532
                return ae
×
2533
        }
×
2534

2535
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectNotReady]
×
2536
}
2537

2538
// NewJSStreamExternalApiOverlapError creates a new JSStreamExternalApiOverlapErrF error: "stream external api prefix {prefix} must not overlap with {subject}"
2539
func NewJSStreamExternalApiOverlapError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
2✔
2540
        eopts := parseOpts(opts)
2✔
2541
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2542
                return ae
×
2543
        }
×
2544

2545
        e := ApiErrors[JSStreamExternalApiOverlapErrF]
2✔
2546
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
2✔
2547
        return &ApiError{
2✔
2548
                Code:        e.Code,
2✔
2549
                ErrCode:     e.ErrCode,
2✔
2550
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2551
        }
2✔
2552
}
2553

2554
// NewJSStreamExternalDelPrefixOverlapsError creates a new JSStreamExternalDelPrefixOverlapsErrF error: "stream external delivery prefix {prefix} overlaps with stream subject {subject}"
2555
func NewJSStreamExternalDelPrefixOverlapsError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
×
2556
        eopts := parseOpts(opts)
×
2557
        if ae, ok := eopts.err.(*ApiError); ok {
×
2558
                return ae
×
2559
        }
×
2560

2561
        e := ApiErrors[JSStreamExternalDelPrefixOverlapsErrF]
×
2562
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
×
2563
        return &ApiError{
×
2564
                Code:        e.Code,
×
2565
                ErrCode:     e.ErrCode,
×
2566
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2567
        }
×
2568
}
2569

2570
// NewJSStreamGeneralError creates a new JSStreamGeneralErrorF error: "{err}"
2571
func NewJSStreamGeneralError(err error, opts ...ErrorOption) *ApiError {
3✔
2572
        eopts := parseOpts(opts)
3✔
2573
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2574
                return ae
×
2575
        }
×
2576

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

2586
// NewJSStreamHeaderExceedsMaximumError creates a new JSStreamHeaderExceedsMaximumErr error: "header size exceeds maximum allowed of 64k"
2587
func NewJSStreamHeaderExceedsMaximumError(opts ...ErrorOption) *ApiError {
1✔
2588
        eopts := parseOpts(opts)
1✔
2589
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2590
                return ae
×
2591
        }
×
2592

2593
        return ApiErrors[JSStreamHeaderExceedsMaximumErr]
1✔
2594
}
2595

2596
// NewJSStreamInfoMaxSubjectsError creates a new JSStreamInfoMaxSubjectsErr error: "subject details would exceed maximum allowed"
2597
func NewJSStreamInfoMaxSubjectsError(opts ...ErrorOption) *ApiError {
×
2598
        eopts := parseOpts(opts)
×
2599
        if ae, ok := eopts.err.(*ApiError); ok {
×
2600
                return ae
×
2601
        }
×
2602

2603
        return ApiErrors[JSStreamInfoMaxSubjectsErr]
×
2604
}
2605

2606
// NewJSStreamInvalidConfigError creates a new JSStreamInvalidConfigF error: "{err}"
2607
func NewJSStreamInvalidConfigError(err error, opts ...ErrorOption) *ApiError {
165✔
2608
        eopts := parseOpts(opts)
165✔
2609
        if ae, ok := eopts.err.(*ApiError); ok {
186✔
2610
                return ae
21✔
2611
        }
21✔
2612

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

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

2629
        return ApiErrors[JSStreamInvalidErr]
×
2630
}
2631

2632
// NewJSStreamInvalidExternalDeliverySubjError creates a new JSStreamInvalidExternalDeliverySubjErrF error: "stream external delivery prefix {prefix} must not contain wildcards"
2633
func NewJSStreamInvalidExternalDeliverySubjError(prefix interface{}, opts ...ErrorOption) *ApiError {
×
2634
        eopts := parseOpts(opts)
×
2635
        if ae, ok := eopts.err.(*ApiError); ok {
×
2636
                return ae
×
2637
        }
×
2638

2639
        e := ApiErrors[JSStreamInvalidExternalDeliverySubjErrF]
×
2640
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix})
×
2641
        return &ApiError{
×
2642
                Code:        e.Code,
×
2643
                ErrCode:     e.ErrCode,
×
2644
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2645
        }
×
2646
}
2647

2648
// NewJSStreamLimitsError creates a new JSStreamLimitsErrF error: "{err}"
2649
func NewJSStreamLimitsError(err error, opts ...ErrorOption) *ApiError {
8✔
2650
        eopts := parseOpts(opts)
8✔
2651
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2652
                return ae
8✔
2653
        }
8✔
2654

2655
        e := ApiErrors[JSStreamLimitsErrF]
×
2656
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2657
        return &ApiError{
×
2658
                Code:        e.Code,
×
2659
                ErrCode:     e.ErrCode,
×
2660
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2661
        }
×
2662
}
2663

2664
// NewJSStreamMaxBytesRequiredError creates a new JSStreamMaxBytesRequired error: "account requires a stream config to have max bytes set"
2665
func NewJSStreamMaxBytesRequiredError(opts ...ErrorOption) *ApiError {
3✔
2666
        eopts := parseOpts(opts)
3✔
2667
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2668
                return ae
×
2669
        }
×
2670

2671
        return ApiErrors[JSStreamMaxBytesRequired]
3✔
2672
}
2673

2674
// NewJSStreamMaxStreamBytesExceededError creates a new JSStreamMaxStreamBytesExceeded error: "stream max bytes exceeds account limit max stream bytes"
2675
func NewJSStreamMaxStreamBytesExceededError(opts ...ErrorOption) *ApiError {
2✔
2676
        eopts := parseOpts(opts)
2✔
2677
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2678
                return ae
×
2679
        }
×
2680

2681
        return ApiErrors[JSStreamMaxStreamBytesExceeded]
2✔
2682
}
2683

2684
// NewJSStreamMessageExceedsMaximumError creates a new JSStreamMessageExceedsMaximumErr error: "message size exceeds maximum allowed"
2685
func NewJSStreamMessageExceedsMaximumError(opts ...ErrorOption) *ApiError {
19✔
2686
        eopts := parseOpts(opts)
19✔
2687
        if ae, ok := eopts.err.(*ApiError); ok {
19✔
2688
                return ae
×
2689
        }
×
2690

2691
        return ApiErrors[JSStreamMessageExceedsMaximumErr]
19✔
2692
}
2693

2694
// NewJSStreamMinLastSeqError creates a new JSStreamMinLastSeqErr error: "min last sequence"
2695
func NewJSStreamMinLastSeqError(opts ...ErrorOption) *ApiError {
×
2696
        eopts := parseOpts(opts)
×
2697
        if ae, ok := eopts.err.(*ApiError); ok {
×
2698
                return ae
×
2699
        }
×
2700

2701
        return ApiErrors[JSStreamMinLastSeqErr]
×
2702
}
2703

2704
// NewJSStreamMirrorNotUpdatableError creates a new JSStreamMirrorNotUpdatableErr error: "stream mirror configuration can not be updated"
2705
func NewJSStreamMirrorNotUpdatableError(opts ...ErrorOption) *ApiError {
2✔
2706
        eopts := parseOpts(opts)
2✔
2707
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2708
                return ae
×
2709
        }
×
2710

2711
        return ApiErrors[JSStreamMirrorNotUpdatableErr]
2✔
2712
}
2713

2714
// NewJSStreamMismatchError creates a new JSStreamMismatchErr error: "stream name in subject does not match request"
2715
func NewJSStreamMismatchError(opts ...ErrorOption) *ApiError {
3✔
2716
        eopts := parseOpts(opts)
3✔
2717
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2718
                return ae
×
2719
        }
×
2720

2721
        return ApiErrors[JSStreamMismatchErr]
3✔
2722
}
2723

2724
// NewJSStreamMoveAndScaleError creates a new JSStreamMoveAndScaleErr error: "can not move and scale a stream in a single update"
2725
func NewJSStreamMoveAndScaleError(opts ...ErrorOption) *ApiError {
4✔
2726
        eopts := parseOpts(opts)
4✔
2727
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2728
                return ae
×
2729
        }
×
2730

2731
        return ApiErrors[JSStreamMoveAndScaleErr]
4✔
2732
}
2733

2734
// NewJSStreamMoveInProgressError creates a new JSStreamMoveInProgressF error: "stream move already in progress: {msg}"
2735
func NewJSStreamMoveInProgressError(msg interface{}, opts ...ErrorOption) *ApiError {
2✔
2736
        eopts := parseOpts(opts)
2✔
2737
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2738
                return ae
×
2739
        }
×
2740

2741
        e := ApiErrors[JSStreamMoveInProgressF]
2✔
2742
        args := e.toReplacerArgs([]interface{}{"{msg}", msg})
2✔
2743
        return &ApiError{
2✔
2744
                Code:        e.Code,
2✔
2745
                ErrCode:     e.ErrCode,
2✔
2746
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2747
        }
2✔
2748
}
2749

2750
// NewJSStreamMoveNotInProgressError creates a new JSStreamMoveNotInProgress error: "stream move not in progress"
2751
func NewJSStreamMoveNotInProgressError(opts ...ErrorOption) *ApiError {
×
2752
        eopts := parseOpts(opts)
×
2753
        if ae, ok := eopts.err.(*ApiError); ok {
×
2754
                return ae
×
2755
        }
×
2756

2757
        return ApiErrors[JSStreamMoveNotInProgress]
×
2758
}
2759

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

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

2776
// NewJSStreamNameContainsPathSeparatorsError creates a new JSStreamNameContainsPathSeparatorsErr error: "Stream name can not contain path separators"
2777
func NewJSStreamNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
6✔
2778
        eopts := parseOpts(opts)
6✔
2779
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2780
                return ae
×
2781
        }
×
2782

2783
        return ApiErrors[JSStreamNameContainsPathSeparatorsErr]
6✔
2784
}
2785

2786
// NewJSStreamNameExistError creates a new JSStreamNameExistErr error: "stream name already in use with a different configuration"
2787
func NewJSStreamNameExistError(opts ...ErrorOption) *ApiError {
10✔
2788
        eopts := parseOpts(opts)
10✔
2789
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2790
                return ae
×
2791
        }
×
2792

2793
        return ApiErrors[JSStreamNameExistErr]
10✔
2794
}
2795

2796
// NewJSStreamNameExistRestoreFailedError creates a new JSStreamNameExistRestoreFailedErr error: "stream name already in use, cannot restore"
2797
func NewJSStreamNameExistRestoreFailedError(opts ...ErrorOption) *ApiError {
3✔
2798
        eopts := parseOpts(opts)
3✔
2799
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2800
                return ae
×
2801
        }
×
2802

2803
        return ApiErrors[JSStreamNameExistRestoreFailedErr]
3✔
2804
}
2805

2806
// NewJSStreamNotFoundError creates a new JSStreamNotFoundErr error: "stream not found"
2807
func NewJSStreamNotFoundError(opts ...ErrorOption) *ApiError {
29,977✔
2808
        eopts := parseOpts(opts)
29,977✔
2809
        if ae, ok := eopts.err.(*ApiError); ok {
30,731✔
2810
                return ae
754✔
2811
        }
754✔
2812

2813
        return ApiErrors[JSStreamNotFoundErr]
29,223✔
2814
}
2815

2816
// NewJSStreamNotMatchError creates a new JSStreamNotMatchErr error: "expected stream does not match"
2817
func NewJSStreamNotMatchError(opts ...ErrorOption) *ApiError {
5✔
2818
        eopts := parseOpts(opts)
5✔
2819
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2820
                return ae
×
2821
        }
×
2822

2823
        return ApiErrors[JSStreamNotMatchErr]
5✔
2824
}
2825

2826
// NewJSStreamOfflineError creates a new JSStreamOfflineErr error: "stream is offline"
2827
func NewJSStreamOfflineError(opts ...ErrorOption) *ApiError {
6✔
2828
        eopts := parseOpts(opts)
6✔
2829
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2830
                return ae
×
2831
        }
×
2832

2833
        return ApiErrors[JSStreamOfflineErr]
6✔
2834
}
2835

2836
// NewJSStreamOfflineReasonError creates a new JSStreamOfflineReasonErrF error: "stream is offline: {err}"
2837
func NewJSStreamOfflineReasonError(err error, opts ...ErrorOption) *ApiError {
40✔
2838
        eopts := parseOpts(opts)
40✔
2839
        if ae, ok := eopts.err.(*ApiError); ok {
40✔
2840
                return ae
×
2841
        }
×
2842

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

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

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

2868
// NewJSStreamReplicasNotSupportedError creates a new JSStreamReplicasNotSupportedErr error: "replicas > 1 not supported in non-clustered mode"
2869
func NewJSStreamReplicasNotSupportedError(opts ...ErrorOption) *ApiError {
1✔
2870
        eopts := parseOpts(opts)
1✔
2871
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2872
                return ae
×
2873
        }
×
2874

2875
        return ApiErrors[JSStreamReplicasNotSupportedErr]
1✔
2876
}
2877

2878
// NewJSStreamReplicasNotUpdatableError creates a new JSStreamReplicasNotUpdatableErr error: "Replicas configuration can not be updated"
2879
func NewJSStreamReplicasNotUpdatableError(opts ...ErrorOption) *ApiError {
×
2880
        eopts := parseOpts(opts)
×
2881
        if ae, ok := eopts.err.(*ApiError); ok {
×
2882
                return ae
×
2883
        }
×
2884

2885
        return ApiErrors[JSStreamReplicasNotUpdatableErr]
×
2886
}
2887

2888
// NewJSStreamRestoreError creates a new JSStreamRestoreErrF error: "restore failed: {err}"
2889
func NewJSStreamRestoreError(err error, opts ...ErrorOption) *ApiError {
7✔
2890
        eopts := parseOpts(opts)
7✔
2891
        if ae, ok := eopts.err.(*ApiError); ok {
9✔
2892
                return ae
2✔
2893
        }
2✔
2894

2895
        e := ApiErrors[JSStreamRestoreErrF]
5✔
2896
        args := e.toReplacerArgs([]interface{}{"{err}", err})
5✔
2897
        return &ApiError{
5✔
2898
                Code:        e.Code,
5✔
2899
                ErrCode:     e.ErrCode,
5✔
2900
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
2901
        }
5✔
2902
}
2903

2904
// NewJSStreamRollupFailedError creates a new JSStreamRollupFailedF error: "{err}"
2905
func NewJSStreamRollupFailedError(err error, opts ...ErrorOption) *ApiError {
13✔
2906
        eopts := parseOpts(opts)
13✔
2907
        if ae, ok := eopts.err.(*ApiError); ok {
13✔
2908
                return ae
×
2909
        }
×
2910

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

2920
// NewJSStreamSealedError creates a new JSStreamSealedErr error: "invalid operation on sealed stream"
2921
func NewJSStreamSealedError(opts ...ErrorOption) *ApiError {
10✔
2922
        eopts := parseOpts(opts)
10✔
2923
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2924
                return ae
×
2925
        }
×
2926

2927
        return ApiErrors[JSStreamSealedErr]
10✔
2928
}
2929

2930
// NewJSStreamSequenceNotMatchError creates a new JSStreamSequenceNotMatchErr error: "expected stream sequence does not match"
2931
func NewJSStreamSequenceNotMatchError(opts ...ErrorOption) *ApiError {
×
2932
        eopts := parseOpts(opts)
×
2933
        if ae, ok := eopts.err.(*ApiError); ok {
×
2934
                return ae
×
2935
        }
×
2936

2937
        return ApiErrors[JSStreamSequenceNotMatchErr]
×
2938
}
2939

2940
// NewJSStreamSnapshotError creates a new JSStreamSnapshotErrF error: "snapshot failed: {err}"
2941
func NewJSStreamSnapshotError(err error, opts ...ErrorOption) *ApiError {
×
2942
        eopts := parseOpts(opts)
×
2943
        if ae, ok := eopts.err.(*ApiError); ok {
×
2944
                return ae
×
2945
        }
×
2946

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

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

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

2972
// NewJSStreamSubjectOverlapError creates a new JSStreamSubjectOverlapErr error: "subjects overlap with an existing stream"
2973
func NewJSStreamSubjectOverlapError(opts ...ErrorOption) *ApiError {
43✔
2974
        eopts := parseOpts(opts)
43✔
2975
        if ae, ok := eopts.err.(*ApiError); ok {
43✔
2976
                return ae
×
2977
        }
×
2978

2979
        return ApiErrors[JSStreamSubjectOverlapErr]
43✔
2980
}
2981

2982
// NewJSStreamTemplateCreateError creates a new JSStreamTemplateCreateErrF error: "{err}"
2983
func NewJSStreamTemplateCreateError(err error, opts ...ErrorOption) *ApiError {
×
2984
        eopts := parseOpts(opts)
×
2985
        if ae, ok := eopts.err.(*ApiError); ok {
×
2986
                return ae
×
2987
        }
×
2988

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

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

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

3014
// NewJSStreamTemplateNotFoundError creates a new JSStreamTemplateNotFoundErr error: "template not found"
3015
func NewJSStreamTemplateNotFoundError(opts ...ErrorOption) *ApiError {
×
3016
        eopts := parseOpts(opts)
×
3017
        if ae, ok := eopts.err.(*ApiError); ok {
×
3018
                return ae
×
3019
        }
×
3020

3021
        return ApiErrors[JSStreamTemplateNotFoundErr]
×
3022
}
3023

3024
// NewJSStreamTooManyRequestsError creates a new JSStreamTooManyRequests error: "too many requests"
3025
func NewJSStreamTooManyRequestsError(opts ...ErrorOption) *ApiError {
188✔
3026
        eopts := parseOpts(opts)
188✔
3027
        if ae, ok := eopts.err.(*ApiError); ok {
188✔
3028
                return ae
×
3029
        }
×
3030

3031
        return ApiErrors[JSStreamTooManyRequests]
188✔
3032
}
3033

3034
// NewJSStreamTransformInvalidDestinationError creates a new JSStreamTransformInvalidDestination error: "stream transform: {err}"
3035
func NewJSStreamTransformInvalidDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
3036
        eopts := parseOpts(opts)
1✔
3037
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3038
                return ae
×
3039
        }
×
3040

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

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

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

3066
// NewJSStreamUpdateError creates a new JSStreamUpdateErrF error: "{err}"
3067
func NewJSStreamUpdateError(err error, opts ...ErrorOption) *ApiError {
29✔
3068
        eopts := parseOpts(opts)
29✔
3069
        if ae, ok := eopts.err.(*ApiError); ok {
52✔
3070
                return ae
23✔
3071
        }
23✔
3072

3073
        e := ApiErrors[JSStreamUpdateErrF]
6✔
3074
        args := e.toReplacerArgs([]interface{}{"{err}", err})
6✔
3075
        return &ApiError{
6✔
3076
                Code:        e.Code,
6✔
3077
                ErrCode:     e.ErrCode,
6✔
3078
                Description: strings.NewReplacer(args...).Replace(e.Description),
6✔
3079
        }
6✔
3080
}
3081

3082
// NewJSStreamWrongLastMsgIDError creates a new JSStreamWrongLastMsgIDErrF error: "wrong last msg ID: {id}"
3083
func NewJSStreamWrongLastMsgIDError(id interface{}, opts ...ErrorOption) *ApiError {
5✔
3084
        eopts := parseOpts(opts)
5✔
3085
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
3086
                return ae
×
3087
        }
×
3088

3089
        e := ApiErrors[JSStreamWrongLastMsgIDErrF]
5✔
3090
        args := e.toReplacerArgs([]interface{}{"{id}", id})
5✔
3091
        return &ApiError{
5✔
3092
                Code:        e.Code,
5✔
3093
                ErrCode:     e.ErrCode,
5✔
3094
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
3095
        }
5✔
3096
}
3097

3098
// NewJSStreamWrongLastSequenceConstantError creates a new JSStreamWrongLastSequenceConstantErr error: "wrong last sequence"
3099
func NewJSStreamWrongLastSequenceConstantError(opts ...ErrorOption) *ApiError {
24✔
3100
        eopts := parseOpts(opts)
24✔
3101
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
3102
                return ae
×
3103
        }
×
3104

3105
        return ApiErrors[JSStreamWrongLastSequenceConstantErr]
24✔
3106
}
3107

3108
// NewJSStreamWrongLastSequenceError creates a new JSStreamWrongLastSequenceErrF error: "wrong last sequence: {seq}"
3109
func NewJSStreamWrongLastSequenceError(seq uint64, opts ...ErrorOption) *ApiError {
95✔
3110
        eopts := parseOpts(opts)
95✔
3111
        if ae, ok := eopts.err.(*ApiError); ok {
95✔
3112
                return ae
×
3113
        }
×
3114

3115
        e := ApiErrors[JSStreamWrongLastSequenceErrF]
95✔
3116
        args := e.toReplacerArgs([]interface{}{"{seq}", seq})
95✔
3117
        return &ApiError{
95✔
3118
                Code:        e.Code,
95✔
3119
                ErrCode:     e.ErrCode,
95✔
3120
                Description: strings.NewReplacer(args...).Replace(e.Description),
95✔
3121
        }
95✔
3122
}
3123

3124
// NewJSTempStorageFailedError creates a new JSTempStorageFailedErr error: "JetStream unable to open temp storage for restore"
3125
func NewJSTempStorageFailedError(opts ...ErrorOption) *ApiError {
×
3126
        eopts := parseOpts(opts)
×
3127
        if ae, ok := eopts.err.(*ApiError); ok {
×
3128
                return ae
×
3129
        }
×
3130

3131
        return ApiErrors[JSTempStorageFailedErr]
×
3132
}
3133

3134
// NewJSTemplateNameNotMatchSubjectError creates a new JSTemplateNameNotMatchSubjectErr error: "template name in subject does not match request"
3135
func NewJSTemplateNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
×
3136
        eopts := parseOpts(opts)
×
3137
        if ae, ok := eopts.err.(*ApiError); ok {
×
3138
                return ae
×
3139
        }
×
3140

3141
        return ApiErrors[JSTemplateNameNotMatchSubjectErr]
×
3142
}
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