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

nats-io / nats-server / 24949216239

24 Apr 2026 08:34AM UTC coverage: 80.645% (-2.4%) from 83.05%
24949216239

push

github

web-flow
(2.14) [ADDED] `RemoteLeafOpts.IgnoreDiscoveredServers` option (#8067)

For a given leafnode remote, if this is set to true, this remote will
ignore any server leafnode URLs returned by the hub, allowing the user
to fully manage the servers this remote can connect to.

Resolves #8002

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>

74685 of 92610 relevant lines covered (80.64%)

632737.46 hits per line

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

56.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
        // JSAtomicPublishTooManyInflight atomic publish too many inflight
33
        JSAtomicPublishTooManyInflight ErrorIdentifier = 10210
34

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

92
        // JSConsumerAckFCRequiresFCErr flow control ack policy requires flow control
93
        JSConsumerAckFCRequiresFCErr ErrorIdentifier = 10219
94

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

368
        // JSMessageTTLDisabledErr per-message TTL is disabled
369
        JSMessageTTLDisabledErr ErrorIdentifier = 10166
370

371
        // JSMessageTTLInvalidErr invalid per-message TTL
372
        JSMessageTTLInvalidErr ErrorIdentifier = 10165
373

374
        // JSMirrorConsumerRequiresAckFCErr stream mirror consumer requires flow control ack policy
375
        JSMirrorConsumerRequiresAckFCErr ErrorIdentifier = 10214
376

377
        // JSMirrorConsumerSetupFailedErrF generic mirror consumer setup failure string ({err})
378
        JSMirrorConsumerSetupFailedErrF ErrorIdentifier = 10029
379

380
        // JSMirrorDurableConsumerCfgInvalid stream mirror consumer config is invalid
381
        JSMirrorDurableConsumerCfgInvalid ErrorIdentifier = 10213
382

383
        // JSMirrorInvalidStreamName mirrored stream name is invalid
384
        JSMirrorInvalidStreamName ErrorIdentifier = 10142
385

386
        // JSMirrorInvalidSubjectFilter mirror transform source: {err}
387
        JSMirrorInvalidSubjectFilter ErrorIdentifier = 10151
388

389
        // JSMirrorInvalidTransformDestination mirror transform: {err}
390
        JSMirrorInvalidTransformDestination ErrorIdentifier = 10154
391

392
        // JSMirrorMaxMessageSizeTooBigErr stream mirror must have max message size >= source
393
        JSMirrorMaxMessageSizeTooBigErr ErrorIdentifier = 10030
394

395
        // JSMirrorMultipleFiltersNotAllowed mirror with multiple subject transforms cannot also have a single subject filter
396
        JSMirrorMultipleFiltersNotAllowed ErrorIdentifier = 10150
397

398
        // JSMirrorOverlappingSubjectFilters mirror subject filters can not overlap
399
        JSMirrorOverlappingSubjectFilters ErrorIdentifier = 10152
400

401
        // JSMirrorWithAtomicPublishErr stream mirrors can not also use atomic publishing
402
        JSMirrorWithAtomicPublishErr ErrorIdentifier = 10198
403

404
        // JSMirrorWithBatchPublishErr stream mirrors can not also use batch publishing
405
        JSMirrorWithBatchPublishErr ErrorIdentifier = 10209
406

407
        // JSMirrorWithCountersErr stream mirrors can not also calculate counters
408
        JSMirrorWithCountersErr ErrorIdentifier = 10173
409

410
        // JSMirrorWithFirstSeqErr stream mirrors can not have first sequence configured
411
        JSMirrorWithFirstSeqErr ErrorIdentifier = 10143
412

413
        // JSMirrorWithMsgSchedulesErr stream mirrors can not also schedule messages
414
        JSMirrorWithMsgSchedulesErr ErrorIdentifier = 10186
415

416
        // JSMirrorWithSourcesErr stream mirrors can not also contain other sources
417
        JSMirrorWithSourcesErr ErrorIdentifier = 10031
418

419
        // JSMirrorWithStartSeqAndTimeErr stream mirrors can not have both start seq and start time configured
420
        JSMirrorWithStartSeqAndTimeErr ErrorIdentifier = 10032
421

422
        // JSMirrorWithSubjectFiltersErr stream mirrors can not contain filtered subjects
423
        JSMirrorWithSubjectFiltersErr ErrorIdentifier = 10033
424

425
        // JSMirrorWithSubjectsErr stream mirrors can not contain subjects
426
        JSMirrorWithSubjectsErr ErrorIdentifier = 10034
427

428
        // JSNoAccountErr account not found
429
        JSNoAccountErr ErrorIdentifier = 10035
430

431
        // JSNoLimitsErr no JetStream default or applicable tiered limit present
432
        JSNoLimitsErr ErrorIdentifier = 10120
433

434
        // JSNoMessageFoundErr no message found
435
        JSNoMessageFoundErr ErrorIdentifier = 10037
436

437
        // JSNotEmptyRequestErr expected an empty request payload
438
        JSNotEmptyRequestErr ErrorIdentifier = 10038
439

440
        // JSNotEnabledErr JetStream not enabled
441
        JSNotEnabledErr ErrorIdentifier = 10076
442

443
        // JSNotEnabledForAccountErr JetStream not enabled for account
444
        JSNotEnabledForAccountErr ErrorIdentifier = 10039
445

446
        // JSPedanticErrF pedantic mode: {err}
447
        JSPedanticErrF ErrorIdentifier = 10157
448

449
        // JSPeerRemapErr peer remap failed
450
        JSPeerRemapErr ErrorIdentifier = 10075
451

452
        // JSRaftGeneralErrF General RAFT error string ({err})
453
        JSRaftGeneralErrF ErrorIdentifier = 10041
454

455
        // JSReplicasCountCannotBeNegative replicas count cannot be negative
456
        JSReplicasCountCannotBeNegative ErrorIdentifier = 10133
457

458
        // JSRequiredApiLevelErr JetStream minimum api level required
459
        JSRequiredApiLevelErr ErrorIdentifier = 10185
460

461
        // JSRestoreSubscribeFailedErrF JetStream unable to subscribe to restore snapshot {subject}: {err}
462
        JSRestoreSubscribeFailedErrF ErrorIdentifier = 10042
463

464
        // JSSequenceNotFoundErrF sequence {seq} not found
465
        JSSequenceNotFoundErrF ErrorIdentifier = 10043
466

467
        // JSSnapshotDeliverSubjectInvalidErr deliver subject not valid
468
        JSSnapshotDeliverSubjectInvalidErr ErrorIdentifier = 10015
469

470
        // JSSourceConsumerRequiresAckFCErr stream source consumer requires flow control ack policy
471
        JSSourceConsumerRequiresAckFCErr ErrorIdentifier = 10217
472

473
        // JSSourceConsumerSetupFailedErrF General source consumer setup failure string ({err})
474
        JSSourceConsumerSetupFailedErrF ErrorIdentifier = 10045
475

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

479
        // JSSourceDurableConsumerCfgInvalid stream source consumer config is invalid
480
        JSSourceDurableConsumerCfgInvalid ErrorIdentifier = 10215
481

482
        // JSSourceDurableConsumerDuplicateDetected duplicate stream source consumer detected
483
        JSSourceDurableConsumerDuplicateDetected ErrorIdentifier = 10216
484

485
        // JSSourceInvalidStreamName sourced stream name is invalid
486
        JSSourceInvalidStreamName ErrorIdentifier = 10141
487

488
        // JSSourceInvalidSubjectFilter source transform source: {err}
489
        JSSourceInvalidSubjectFilter ErrorIdentifier = 10145
490

491
        // JSSourceInvalidTransformDestination source transform: {err}
492
        JSSourceInvalidTransformDestination ErrorIdentifier = 10146
493

494
        // JSSourceMaxMessageSizeTooBigErr stream source must have max message size >= target
495
        JSSourceMaxMessageSizeTooBigErr ErrorIdentifier = 10046
496

497
        // JSSourceMultipleFiltersNotAllowed source with multiple subject transforms cannot also have a single subject filter
498
        JSSourceMultipleFiltersNotAllowed ErrorIdentifier = 10144
499

500
        // JSSourceOverlappingSubjectFilters source filters can not overlap
501
        JSSourceOverlappingSubjectFilters ErrorIdentifier = 10147
502

503
        // JSSourceWithMsgSchedulesErr stream source can not also schedule messages
504
        JSSourceWithMsgSchedulesErr ErrorIdentifier = 10187
505

506
        // JSStorageResourcesExceededErr insufficient storage resources available
507
        JSStorageResourcesExceededErr ErrorIdentifier = 10047
508

509
        // JSStreamAssignmentErrF Generic stream assignment error string ({err})
510
        JSStreamAssignmentErrF ErrorIdentifier = 10048
511

512
        // JSStreamCreateErrF Generic stream creation error string ({err})
513
        JSStreamCreateErrF ErrorIdentifier = 10049
514

515
        // JSStreamDeleteErrF General stream deletion error string ({err})
516
        JSStreamDeleteErrF ErrorIdentifier = 10050
517

518
        // JSStreamDuplicateMessageConflict duplicate message id is in process
519
        JSStreamDuplicateMessageConflict ErrorIdentifier = 10158
520

521
        // JSStreamExpectedLastSeqPerSubjectInvalid missing sequence for expected last sequence per subject
522
        JSStreamExpectedLastSeqPerSubjectInvalid ErrorIdentifier = 10193
523

524
        // JSStreamExpectedLastSeqPerSubjectNotReady expected last sequence per subject temporarily unavailable
525
        JSStreamExpectedLastSeqPerSubjectNotReady ErrorIdentifier = 10163
526

527
        // JSStreamExternalApiOverlapErrF stream external api prefix {prefix} must not overlap with {subject}
528
        JSStreamExternalApiOverlapErrF ErrorIdentifier = 10021
529

530
        // JSStreamExternalDelPrefixOverlapsErrF stream external delivery prefix {prefix} overlaps with stream subject {subject}
531
        JSStreamExternalDelPrefixOverlapsErrF ErrorIdentifier = 10022
532

533
        // JSStreamGeneralErrorF General stream failure string ({err})
534
        JSStreamGeneralErrorF ErrorIdentifier = 10051
535

536
        // JSStreamHeaderExceedsMaximumErr header size exceeds maximum allowed of 64k
537
        JSStreamHeaderExceedsMaximumErr ErrorIdentifier = 10097
538

539
        // JSStreamInfoMaxSubjectsErr subject details would exceed maximum allowed
540
        JSStreamInfoMaxSubjectsErr ErrorIdentifier = 10117
541

542
        // JSStreamInvalidConfigF Stream configuration validation error string ({err})
543
        JSStreamInvalidConfigF ErrorIdentifier = 10052
544

545
        // JSStreamInvalidErr stream not valid
546
        JSStreamInvalidErr ErrorIdentifier = 10096
547

548
        // JSStreamInvalidExternalDeliverySubjErrF stream external delivery prefix {prefix} must not contain wildcards
549
        JSStreamInvalidExternalDeliverySubjErrF ErrorIdentifier = 10024
550

551
        // JSStreamLimitsErrF General stream limits exceeded error string ({err})
552
        JSStreamLimitsErrF ErrorIdentifier = 10053
553

554
        // JSStreamMaxBytesRequired account requires a stream config to have max bytes set
555
        JSStreamMaxBytesRequired ErrorIdentifier = 10113
556

557
        // JSStreamMaxStreamBytesExceeded stream max bytes exceeds account limit max stream bytes
558
        JSStreamMaxStreamBytesExceeded ErrorIdentifier = 10122
559

560
        // JSStreamMessageExceedsMaximumErr message size exceeds maximum allowed
561
        JSStreamMessageExceedsMaximumErr ErrorIdentifier = 10054
562

563
        // JSStreamMinLastSeqErr min last sequence
564
        JSStreamMinLastSeqErr ErrorIdentifier = 10180
565

566
        // JSStreamMirrorNotUpdatableErr stream mirror configuration can not be updated
567
        JSStreamMirrorNotUpdatableErr ErrorIdentifier = 10055
568

569
        // JSStreamMismatchErr stream name in subject does not match request
570
        JSStreamMismatchErr ErrorIdentifier = 10056
571

572
        // JSStreamMoveAndScaleErr can not move and scale a stream in a single update
573
        JSStreamMoveAndScaleErr ErrorIdentifier = 10123
574

575
        // JSStreamMoveInProgressF stream move already in progress: {msg}
576
        JSStreamMoveInProgressF ErrorIdentifier = 10124
577

578
        // JSStreamMoveNotInProgress stream move not in progress
579
        JSStreamMoveNotInProgress ErrorIdentifier = 10129
580

581
        // JSStreamMsgDeleteFailedF Generic message deletion failure error string ({err})
582
        JSStreamMsgDeleteFailedF ErrorIdentifier = 10057
583

584
        // JSStreamNameContainsPathSeparatorsErr Stream name can not contain path separators
585
        JSStreamNameContainsPathSeparatorsErr ErrorIdentifier = 10128
586

587
        // JSStreamNameExistErr stream name already in use with a different configuration
588
        JSStreamNameExistErr ErrorIdentifier = 10058
589

590
        // JSStreamNameExistRestoreFailedErr stream name already in use, cannot restore
591
        JSStreamNameExistRestoreFailedErr ErrorIdentifier = 10130
592

593
        // JSStreamNotFoundErr stream not found
594
        JSStreamNotFoundErr ErrorIdentifier = 10059
595

596
        // JSStreamNotMatchErr expected stream does not match
597
        JSStreamNotMatchErr ErrorIdentifier = 10060
598

599
        // JSStreamOfflineErr stream is offline
600
        JSStreamOfflineErr ErrorIdentifier = 10118
601

602
        // JSStreamOfflineReasonErrF stream is offline: {err}
603
        JSStreamOfflineReasonErrF ErrorIdentifier = 10194
604

605
        // JSStreamPurgeFailedF Generic stream purge failure error string ({err})
606
        JSStreamPurgeFailedF ErrorIdentifier = 10110
607

608
        // JSStreamReplicasNotSupportedErr replicas > 1 not supported in non-clustered mode
609
        JSStreamReplicasNotSupportedErr ErrorIdentifier = 10074
610

611
        // JSStreamReplicasNotUpdatableErr Replicas configuration can not be updated
612
        JSStreamReplicasNotUpdatableErr ErrorIdentifier = 10061
613

614
        // JSStreamRestoreErrF restore failed: {err}
615
        JSStreamRestoreErrF ErrorIdentifier = 10062
616

617
        // JSStreamRollupFailedF Generic stream rollup failure error string ({err})
618
        JSStreamRollupFailedF ErrorIdentifier = 10111
619

620
        // JSStreamSealedErr invalid operation on sealed stream
621
        JSStreamSealedErr ErrorIdentifier = 10109
622

623
        // JSStreamSequenceNotMatchErr expected stream sequence does not match
624
        JSStreamSequenceNotMatchErr ErrorIdentifier = 10063
625

626
        // JSStreamSnapshotErrF snapshot failed: {err}
627
        JSStreamSnapshotErrF ErrorIdentifier = 10064
628

629
        // JSStreamStoreFailedF Generic error when storing a message failed ({err})
630
        JSStreamStoreFailedF ErrorIdentifier = 10077
631

632
        // JSStreamSubjectOverlapErr subjects overlap with an existing stream
633
        JSStreamSubjectOverlapErr ErrorIdentifier = 10065
634

635
        // JSStreamTemplateCreateErrF Generic template creation failed string ({err})
636
        JSStreamTemplateCreateErrF ErrorIdentifier = 10066
637

638
        // JSStreamTemplateDeleteErrF Generic stream template deletion failed error string ({err})
639
        JSStreamTemplateDeleteErrF ErrorIdentifier = 10067
640

641
        // JSStreamTemplateNotFoundErr template not found
642
        JSStreamTemplateNotFoundErr ErrorIdentifier = 10068
643

644
        // JSStreamTooManyRequests too many requests
645
        JSStreamTooManyRequests ErrorIdentifier = 10167
646

647
        // JSStreamTransformInvalidDestination stream transform: {err}
648
        JSStreamTransformInvalidDestination ErrorIdentifier = 10156
649

650
        // JSStreamTransformInvalidSource stream transform source: {err}
651
        JSStreamTransformInvalidSource ErrorIdentifier = 10155
652

653
        // JSStreamUpdateErrF Generic stream update error string ({err})
654
        JSStreamUpdateErrF ErrorIdentifier = 10069
655

656
        // JSStreamWrongLastMsgIDErrF wrong last msg ID: {id}
657
        JSStreamWrongLastMsgIDErrF ErrorIdentifier = 10070
658

659
        // JSStreamWrongLastSequenceConstantErr wrong last sequence
660
        JSStreamWrongLastSequenceConstantErr ErrorIdentifier = 10164
661

662
        // JSStreamWrongLastSequenceErrF wrong last sequence: {seq}
663
        JSStreamWrongLastSequenceErrF ErrorIdentifier = 10071
664

665
        // JSTempStorageFailedErr JetStream unable to open temp storage for restore
666
        JSTempStorageFailedErr ErrorIdentifier = 10072
667

668
        // JSTemplateNameNotMatchSubjectErr template name in subject does not match request
669
        JSTemplateNameNotMatchSubjectErr ErrorIdentifier = 10073
670
)
671

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

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

927
        return ApiErrors[JSAccountResourcesExceededErr]
20,067✔
928
}
929

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

937
        return ApiErrors[JSAtomicPublishContainsDuplicateMessageErr]
21,969✔
938
}
939

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

947
        return ApiErrors[JSAtomicPublishDisabledErr]
24✔
948
}
949

950
// NewJSAtomicPublishIncompleteBatchError creates a new JSAtomicPublishIncompleteBatchErr error: "atomic publish batch is incomplete"
951
func NewJSAtomicPublishIncompleteBatchError(opts ...ErrorOption) *ApiError {
54✔
952
        eopts := parseOpts(opts)
54✔
953
        if ae, ok := eopts.err.(*ApiError); ok {
54✔
954
                return ae
×
955
        }
×
956

957
        return ApiErrors[JSAtomicPublishIncompleteBatchErr]
54✔
958
}
959

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

967
        return ApiErrors[JSAtomicPublishInvalidBatchCommitErr]
6✔
968
}
969

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

977
        return ApiErrors[JSAtomicPublishInvalidBatchIDErr]
4✔
978
}
979

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

987
        return ApiErrors[JSAtomicPublishMissingSeqErr]
24✔
988
}
989

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

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

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

1013
        return ApiErrors[JSAtomicPublishTooManyInflight]
8✔
1014
}
1015

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

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

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

1039
        return ApiErrors[JSBadRequestErr]
10✔
1040
}
1041

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

1049
        return ApiErrors[JSBatchPublishDisabledErr]
24✔
1050
}
1051

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

1059
        return ApiErrors[JSBatchPublishInvalidBatchIDErr]
28✔
1060
}
1061

1062
// NewJSBatchPublishInvalidPatternError creates a new JSBatchPublishInvalidPatternErr error: "batch publish pattern is invalid"
1063
func NewJSBatchPublishInvalidPatternError(opts ...ErrorOption) *ApiError {
28✔
1064
        eopts := parseOpts(opts)
28✔
1065
        if ae, ok := eopts.err.(*ApiError); ok {
28✔
1066
                return ae
×
1067
        }
×
1068

1069
        return ApiErrors[JSBatchPublishInvalidPatternErr]
28✔
1070
}
1071

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

1079
        return ApiErrors[JSBatchPublishTooManyInflight]
8✔
1080
}
1081

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

1089
        return ApiErrors[JSBatchPublishUnknownBatchIDErr]
28✔
1090
}
1091

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

1099
        return ApiErrors[JSClusterIncompleteErr]
×
1100
}
1101

1102
// NewJSClusterNoPeersError creates a new JSClusterNoPeersErrF error: "{err}"
1103
func NewJSClusterNoPeersError(err error, opts ...ErrorOption) *ApiError {
56✔
1104
        eopts := parseOpts(opts)
56✔
1105
        if ae, ok := eopts.err.(*ApiError); ok {
56✔
1106
                return ae
×
1107
        }
×
1108

1109
        e := ApiErrors[JSClusterNoPeersErrF]
56✔
1110
        args := e.toReplacerArgs([]interface{}{"{err}", err})
56✔
1111
        return &ApiError{
56✔
1112
                Code:        e.Code,
56✔
1113
                ErrCode:     e.ErrCode,
56✔
1114
                Description: strings.NewReplacer(args...).Replace(e.Description),
56✔
1115
        }
56✔
1116
}
1117

1118
// NewJSClusterNotActiveError creates a new JSClusterNotActiveErr error: "JetStream not in clustered mode"
1119
func NewJSClusterNotActiveError(opts ...ErrorOption) *ApiError {
1✔
1120
        eopts := parseOpts(opts)
1✔
1121
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1122
                return ae
×
1123
        }
×
1124

1125
        return ApiErrors[JSClusterNotActiveErr]
1✔
1126
}
1127

1128
// NewJSClusterNotAssignedError creates a new JSClusterNotAssignedErr error: "JetStream cluster not assigned to this server"
1129
func NewJSClusterNotAssignedError(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[JSClusterNotAssignedErr]
2✔
1136
}
1137

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

1145
        return ApiErrors[JSClusterNotAvailErr]
13✔
1146
}
1147

1148
// NewJSClusterNotLeaderError creates a new JSClusterNotLeaderErr error: "JetStream cluster can not handle request"
1149
func NewJSClusterNotLeaderError(opts ...ErrorOption) *ApiError {
830✔
1150
        eopts := parseOpts(opts)
830✔
1151
        if ae, ok := eopts.err.(*ApiError); ok {
830✔
1152
                return ae
×
1153
        }
×
1154

1155
        return ApiErrors[JSClusterNotLeaderErr]
830✔
1156
}
1157

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

1165
        return ApiErrors[JSClusterPeerNotMemberErr]
1✔
1166
}
1167

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

1175
        return ApiErrors[JSClusterRequiredErr]
6✔
1176
}
1177

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

1185
        return ApiErrors[JSClusterServerMemberChangeInflightErr]
6✔
1186
}
1187

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

1195
        return ApiErrors[JSClusterServerNotMemberErr]
6✔
1196
}
1197

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

1205
        return ApiErrors[JSClusterTagsErr]
×
1206
}
1207

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

1215
        return ApiErrors[JSClusterUnSupportFeatureErr]
×
1216
}
1217

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

1225
        return ApiErrors[JSConsumerAckFCRequiresFCErr]
4✔
1226
}
1227

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

1235
        return ApiErrors[JSConsumerAckFCRequiresMaxAckPendingErr]
4✔
1236
}
1237

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

1245
        return ApiErrors[JSConsumerAckFCRequiresNoAckWaitErr]
8✔
1246
}
1247

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

1255
        return ApiErrors[JSConsumerAckFCRequiresNoMaxDeliverErr]
4✔
1256
}
1257

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

1265
        return ApiErrors[JSConsumerAckFCRequiresPushErr]
4✔
1266
}
1267

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

1275
        return ApiErrors[JSConsumerAckPolicyInvalidErr]
2✔
1276
}
1277

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

1285
        return ApiErrors[JSConsumerAckWaitNegativeErr]
2✔
1286
}
1287

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

1295
        return ApiErrors[JSConsumerAlreadyExists]
5✔
1296
}
1297

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

1305
        return ApiErrors[JSConsumerBackOffNegativeErr]
2✔
1306
}
1307

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

1315
        return ApiErrors[JSConsumerBadDurableNameErr]
×
1316
}
1317

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

1325
        return ApiErrors[JSConsumerConfigRequiredErr]
2✔
1326
}
1327

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

1335
        return ApiErrors[JSConsumerCreateDurableAndNameMismatch]
1✔
1336
}
1337

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

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

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

1361
        return ApiErrors[JSConsumerCreateFilterSubjectMismatchErr]
2✔
1362
}
1363

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

1371
        return ApiErrors[JSConsumerDeliverCycleErr]
4✔
1372
}
1373

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

1381
        return ApiErrors[JSConsumerDeliverToWildcardsErr]
4✔
1382
}
1383

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

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

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

1407
        return ApiErrors[JSConsumerDirectRequiresEphemeralErr]
×
1408
}
1409

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

1417
        return ApiErrors[JSConsumerDirectRequiresPushErr]
×
1418
}
1419

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

1427
        return ApiErrors[JSConsumerDoesNotExist]
3✔
1428
}
1429

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

1437
        return ApiErrors[JSConsumerDuplicateFilterSubjects]
1✔
1438
}
1439

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

1447
        return ApiErrors[JSConsumerDurableNameNotInSubjectErr]
×
1448
}
1449

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

1457
        return ApiErrors[JSConsumerDurableNameNotMatchSubjectErr]
×
1458
}
1459

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

1467
        return ApiErrors[JSConsumerDurableNameNotSetErr]
1✔
1468
}
1469

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

1477
        return ApiErrors[JSConsumerEmptyFilter]
1✔
1478
}
1479

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

1487
        return ApiErrors[JSConsumerEmptyGroupName]
4✔
1488
}
1489

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

1497
        return ApiErrors[JSConsumerEphemeralWithDurableInSubjectErr]
×
1498
}
1499

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

1507
        return ApiErrors[JSConsumerEphemeralWithDurableNameErr]
3✔
1508
}
1509

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

1517
        return ApiErrors[JSConsumerExistingActiveErr]
×
1518
}
1519

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

1527
        return ApiErrors[JSConsumerFCRequiresPushErr]
×
1528
}
1529

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

1537
        return ApiErrors[JSConsumerFilterNotSubsetErr]
×
1538
}
1539

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

1547
        return ApiErrors[JSConsumerHBRequiresPushErr]
×
1548
}
1549

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

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

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

1573
        return ApiErrors[JSConsumerInvalidDeliverSubject]
2✔
1574
}
1575

1576
// NewJSConsumerInvalidGroupNameError creates a new JSConsumerInvalidGroupNameErr error: "Valid priority group name must match A-Z, a-z, 0-9, -_/=)+ and may not exceed 16 characters"
1577
func NewJSConsumerInvalidGroupNameError(opts ...ErrorOption) *ApiError {
2✔
1578
        eopts := parseOpts(opts)
2✔
1579
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1580
                return ae
×
1581
        }
×
1582

1583
        return ApiErrors[JSConsumerInvalidGroupNameErr]
2✔
1584
}
1585

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

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

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

1609
        return ApiErrors[JSConsumerInvalidPriorityGroupErr]
2✔
1610
}
1611

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

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

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

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

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

1651
        return ApiErrors[JSConsumerMaxDeliverBackoffErr]
3✔
1652
}
1653

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

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

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

1677
        return ApiErrors[JSConsumerMaxPendingAckPolicyRequiredErr]
2✔
1678
}
1679

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

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

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

1703
        return ApiErrors[JSConsumerMaxRequestBatchNegativeErr]
×
1704
}
1705

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

1713
        return ApiErrors[JSConsumerMaxRequestExpiresTooSmall]
×
1714
}
1715

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

1723
        return ApiErrors[JSConsumerMaxWaitingNegativeErr]
×
1724
}
1725

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

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

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

1749
        return ApiErrors[JSConsumerMultipleFiltersNotAllowed]
1✔
1750
}
1751

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

1759
        return ApiErrors[JSConsumerNameContainsPathSeparatorsErr]
8✔
1760
}
1761

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

1769
        return ApiErrors[JSConsumerNameExistErr]
2✔
1770
}
1771

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

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

1788
// NewJSConsumerNotFoundError creates a new JSConsumerNotFoundErr error: "consumer not found"
1789
func NewJSConsumerNotFoundError(opts ...ErrorOption) *ApiError {
2,809✔
1790
        eopts := parseOpts(opts)
2,809✔
1791
        if ae, ok := eopts.err.(*ApiError); ok {
2,809✔
1792
                return ae
×
1793
        }
×
1794

1795
        return ApiErrors[JSConsumerNotFoundErr]
2,809✔
1796
}
1797

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

1805
        return ApiErrors[JSConsumerOfflineErr]
8✔
1806
}
1807

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

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

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

1831
        return ApiErrors[JSConsumerOnMappedErr]
×
1832
}
1833

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

1841
        return ApiErrors[JSConsumerOverlappingSubjectFilters]
3✔
1842
}
1843

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

1851
        return ApiErrors[JSConsumerPinnedTTLWithoutPriorityPolicyNone]
1✔
1852
}
1853

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

1861
        return ApiErrors[JSConsumerPriorityGroupWithPolicyNone]
1✔
1862
}
1863

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

1871
        return ApiErrors[JSConsumerPriorityPolicyWithoutGroup]
4✔
1872
}
1873

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

1881
        return ApiErrors[JSConsumerPullNotDurableErr]
×
1882
}
1883

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

1891
        return ApiErrors[JSConsumerPullRequiresAckErr]
6✔
1892
}
1893

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

1901
        return ApiErrors[JSConsumerPullWithRateLimitErr]
1✔
1902
}
1903

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

1911
        return ApiErrors[JSConsumerPushMaxWaitingErr]
3✔
1912
}
1913

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

1921
        return ApiErrors[JSConsumerPushWithPriorityGroupErr]
1✔
1922
}
1923

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

1931
        return ApiErrors[JSConsumerReplacementWithDifferentNameErr]
×
1932
}
1933

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

1941
        return ApiErrors[JSConsumerReplayPolicyInvalidErr]
2✔
1942
}
1943

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

1951
        return ApiErrors[JSConsumerReplicasExceedsStream]
1✔
1952
}
1953

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

1961
        return ApiErrors[JSConsumerReplicasShouldMatchStream]
2✔
1962
}
1963

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

1971
        return ApiErrors[JSConsumerSmallHeartbeatErr]
1✔
1972
}
1973

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

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

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

1997
        return ApiErrors[JSConsumerWQConsumerNotDeliverAllErr]
×
1998
}
1999

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

2007
        return ApiErrors[JSConsumerWQConsumerNotUniqueErr]
11✔
2008
}
2009

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

2017
        return ApiErrors[JSConsumerWQMultipleUnfilteredErr]
2✔
2018
}
2019

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

2027
        return ApiErrors[JSConsumerWQRequiresExplicitAckErr]
×
2028
}
2029

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

2037
        return ApiErrors[JSConsumerWithFlowControlNeedsHeartbeats]
4✔
2038
}
2039

2040
// NewJSInsufficientResourcesError creates a new JSInsufficientResourcesErr error: "insufficient resources"
2041
func NewJSInsufficientResourcesError(opts ...ErrorOption) *ApiError {
9✔
2042
        eopts := parseOpts(opts)
9✔
2043
        if ae, ok := eopts.err.(*ApiError); ok {
9✔
2044
                return ae
×
2045
        }
×
2046

2047
        return ApiErrors[JSInsufficientResourcesErr]
9✔
2048
}
2049

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

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

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

2073
        return ApiErrors[JSMaximumConsumersLimitErr]
43✔
2074
}
2075

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

2083
        return ApiErrors[JSMaximumStreamsLimitErr]
16✔
2084
}
2085

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

2093
        return ApiErrors[JSMemoryResourcesExceededErr]
11✔
2094
}
2095

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

2103
        return ApiErrors[JSMessageCounterBrokenErr]
4✔
2104
}
2105

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

2113
        return ApiErrors[JSMessageIncrDisabledErr]
4✔
2114
}
2115

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

2123
        return ApiErrors[JSMessageIncrInvalidErr]
24✔
2124
}
2125

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

2133
        return ApiErrors[JSMessageIncrMissingErr]
8✔
2134
}
2135

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

2143
        return ApiErrors[JSMessageIncrPayloadErr]
4✔
2144
}
2145

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

2153
        return ApiErrors[JSMessageSchedulesDisabledErr]
26✔
2154
}
2155

2156
// NewJSMessageSchedulesPatternInvalidError creates a new JSMessageSchedulesPatternInvalidErr error: "message schedules pattern is invalid"
2157
func NewJSMessageSchedulesPatternInvalidError(opts ...ErrorOption) *ApiError {
15✔
2158
        eopts := parseOpts(opts)
15✔
2159
        if ae, ok := eopts.err.(*ApiError); ok {
15✔
2160
                return ae
×
2161
        }
×
2162

2163
        return ApiErrors[JSMessageSchedulesPatternInvalidErr]
15✔
2164
}
2165

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

2173
        return ApiErrors[JSMessageSchedulesRollupInvalidErr]
18✔
2174
}
2175

2176
// NewJSMessageSchedulesSchedulerInvalidError creates a new JSMessageSchedulesSchedulerInvalidErr error: "message schedules invalid scheduler"
2177
func NewJSMessageSchedulesSchedulerInvalidError(opts ...ErrorOption) *ApiError {
28✔
2178
        eopts := parseOpts(opts)
28✔
2179
        if ae, ok := eopts.err.(*ApiError); ok {
28✔
2180
                return ae
×
2181
        }
×
2182

2183
        return ApiErrors[JSMessageSchedulesSchedulerInvalidErr]
28✔
2184
}
2185

2186
// NewJSMessageSchedulesSourceInvalidError creates a new JSMessageSchedulesSourceInvalidErr error: "message schedules source is invalid"
2187
func NewJSMessageSchedulesSourceInvalidError(opts ...ErrorOption) *ApiError {
32✔
2188
        eopts := parseOpts(opts)
32✔
2189
        if ae, ok := eopts.err.(*ApiError); ok {
32✔
2190
                return ae
×
2191
        }
×
2192

2193
        return ApiErrors[JSMessageSchedulesSourceInvalidErr]
32✔
2194
}
2195

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

2203
        return ApiErrors[JSMessageSchedulesTTLInvalidErr]
10✔
2204
}
2205

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

2213
        return ApiErrors[JSMessageSchedulesTargetInvalidErr]
30✔
2214
}
2215

2216
// NewJSMessageTTLDisabledError creates a new JSMessageTTLDisabledErr error: "per-message TTL is disabled"
2217
func NewJSMessageTTLDisabledError(opts ...ErrorOption) *ApiError {
16✔
2218
        eopts := parseOpts(opts)
16✔
2219
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2220
                return ae
×
2221
        }
×
2222

2223
        return ApiErrors[JSMessageTTLDisabledErr]
16✔
2224
}
2225

2226
// NewJSMessageTTLInvalidError creates a new JSMessageTTLInvalidErr error: "invalid per-message TTL"
2227
func NewJSMessageTTLInvalidError(opts ...ErrorOption) *ApiError {
23✔
2228
        eopts := parseOpts(opts)
23✔
2229
        if ae, ok := eopts.err.(*ApiError); ok {
23✔
2230
                return ae
×
2231
        }
×
2232

2233
        return ApiErrors[JSMessageTTLInvalidErr]
23✔
2234
}
2235

2236
// NewJSMirrorConsumerRequiresAckFCError creates a new JSMirrorConsumerRequiresAckFCErr error: "stream mirror consumer requires flow control ack policy"
2237
func NewJSMirrorConsumerRequiresAckFCError(opts ...ErrorOption) *ApiError {
2✔
2238
        eopts := parseOpts(opts)
2✔
2239
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2240
                return ae
×
2241
        }
×
2242

2243
        return ApiErrors[JSMirrorConsumerRequiresAckFCErr]
2✔
2244
}
2245

2246
// NewJSMirrorConsumerSetupFailedError creates a new JSMirrorConsumerSetupFailedErrF error: "{err}"
2247
func NewJSMirrorConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
2248
        eopts := parseOpts(opts)
×
2249
        if ae, ok := eopts.err.(*ApiError); ok {
×
2250
                return ae
×
2251
        }
×
2252

2253
        e := ApiErrors[JSMirrorConsumerSetupFailedErrF]
×
2254
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2255
        return &ApiError{
×
2256
                Code:        e.Code,
×
2257
                ErrCode:     e.ErrCode,
×
2258
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2259
        }
×
2260
}
2261

2262
// NewJSMirrorDurableConsumerCfgInvalidError creates a new JSMirrorDurableConsumerCfgInvalid error: "stream mirror consumer config is invalid"
2263
func NewJSMirrorDurableConsumerCfgInvalidError(opts ...ErrorOption) *ApiError {
14✔
2264
        eopts := parseOpts(opts)
14✔
2265
        if ae, ok := eopts.err.(*ApiError); ok {
14✔
2266
                return ae
×
2267
        }
×
2268

2269
        return ApiErrors[JSMirrorDurableConsumerCfgInvalid]
14✔
2270
}
2271

2272
// NewJSMirrorInvalidStreamNameError creates a new JSMirrorInvalidStreamName error: "mirrored stream name is invalid"
2273
func NewJSMirrorInvalidStreamNameError(opts ...ErrorOption) *ApiError {
×
2274
        eopts := parseOpts(opts)
×
2275
        if ae, ok := eopts.err.(*ApiError); ok {
×
2276
                return ae
×
2277
        }
×
2278

2279
        return ApiErrors[JSMirrorInvalidStreamName]
×
2280
}
2281

2282
// NewJSMirrorInvalidSubjectFilterError creates a new JSMirrorInvalidSubjectFilter error: "mirror transform source: {err}"
2283
func NewJSMirrorInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
2✔
2284
        eopts := parseOpts(opts)
2✔
2285
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2286
                return ae
×
2287
        }
×
2288

2289
        e := ApiErrors[JSMirrorInvalidSubjectFilter]
2✔
2290
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2✔
2291
        return &ApiError{
2✔
2292
                Code:        e.Code,
2✔
2293
                ErrCode:     e.ErrCode,
2✔
2294
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2295
        }
2✔
2296
}
2297

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

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

2314
// NewJSMirrorMaxMessageSizeTooBigError creates a new JSMirrorMaxMessageSizeTooBigErr error: "stream mirror must have max message size >= source"
2315
func NewJSMirrorMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
2316
        eopts := parseOpts(opts)
×
2317
        if ae, ok := eopts.err.(*ApiError); ok {
×
2318
                return ae
×
2319
        }
×
2320

2321
        return ApiErrors[JSMirrorMaxMessageSizeTooBigErr]
×
2322
}
2323

2324
// NewJSMirrorMultipleFiltersNotAllowedError creates a new JSMirrorMultipleFiltersNotAllowed error: "mirror with multiple subject transforms cannot also have a single subject filter"
2325
func NewJSMirrorMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
2326
        eopts := parseOpts(opts)
1✔
2327
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2328
                return ae
×
2329
        }
×
2330

2331
        return ApiErrors[JSMirrorMultipleFiltersNotAllowed]
1✔
2332
}
2333

2334
// NewJSMirrorOverlappingSubjectFiltersError creates a new JSMirrorOverlappingSubjectFilters error: "mirror subject filters can not overlap"
2335
func NewJSMirrorOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
2✔
2336
        eopts := parseOpts(opts)
2✔
2337
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2338
                return ae
×
2339
        }
×
2340

2341
        return ApiErrors[JSMirrorOverlappingSubjectFilters]
2✔
2342
}
2343

2344
// NewJSMirrorWithAtomicPublishError creates a new JSMirrorWithAtomicPublishErr error: "stream mirrors can not also use atomic publishing"
2345
func NewJSMirrorWithAtomicPublishError(opts ...ErrorOption) *ApiError {
4✔
2346
        eopts := parseOpts(opts)
4✔
2347
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2348
                return ae
×
2349
        }
×
2350

2351
        return ApiErrors[JSMirrorWithAtomicPublishErr]
4✔
2352
}
2353

2354
// NewJSMirrorWithBatchPublishError creates a new JSMirrorWithBatchPublishErr error: "stream mirrors can not also use batch publishing"
2355
func NewJSMirrorWithBatchPublishError(opts ...ErrorOption) *ApiError {
4✔
2356
        eopts := parseOpts(opts)
4✔
2357
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2358
                return ae
×
2359
        }
×
2360

2361
        return ApiErrors[JSMirrorWithBatchPublishErr]
4✔
2362
}
2363

2364
// NewJSMirrorWithCountersError creates a new JSMirrorWithCountersErr error: "stream mirrors can not also calculate counters"
2365
func NewJSMirrorWithCountersError(opts ...ErrorOption) *ApiError {
4✔
2366
        eopts := parseOpts(opts)
4✔
2367
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2368
                return ae
×
2369
        }
×
2370

2371
        return ApiErrors[JSMirrorWithCountersErr]
4✔
2372
}
2373

2374
// NewJSMirrorWithFirstSeqError creates a new JSMirrorWithFirstSeqErr error: "stream mirrors can not have first sequence configured"
2375
func NewJSMirrorWithFirstSeqError(opts ...ErrorOption) *ApiError {
2✔
2376
        eopts := parseOpts(opts)
2✔
2377
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2378
                return ae
×
2379
        }
×
2380

2381
        return ApiErrors[JSMirrorWithFirstSeqErr]
2✔
2382
}
2383

2384
// NewJSMirrorWithMsgSchedulesError creates a new JSMirrorWithMsgSchedulesErr error: "stream mirrors can not also schedule messages"
2385
func NewJSMirrorWithMsgSchedulesError(opts ...ErrorOption) *ApiError {
4✔
2386
        eopts := parseOpts(opts)
4✔
2387
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2388
                return ae
×
2389
        }
×
2390

2391
        return ApiErrors[JSMirrorWithMsgSchedulesErr]
4✔
2392
}
2393

2394
// NewJSMirrorWithSourcesError creates a new JSMirrorWithSourcesErr error: "stream mirrors can not also contain other sources"
2395
func NewJSMirrorWithSourcesError(opts ...ErrorOption) *ApiError {
×
2396
        eopts := parseOpts(opts)
×
2397
        if ae, ok := eopts.err.(*ApiError); ok {
×
2398
                return ae
×
2399
        }
×
2400

2401
        return ApiErrors[JSMirrorWithSourcesErr]
×
2402
}
2403

2404
// NewJSMirrorWithStartSeqAndTimeError creates a new JSMirrorWithStartSeqAndTimeErr error: "stream mirrors can not have both start seq and start time configured"
2405
func NewJSMirrorWithStartSeqAndTimeError(opts ...ErrorOption) *ApiError {
×
2406
        eopts := parseOpts(opts)
×
2407
        if ae, ok := eopts.err.(*ApiError); ok {
×
2408
                return ae
×
2409
        }
×
2410

2411
        return ApiErrors[JSMirrorWithStartSeqAndTimeErr]
×
2412
}
2413

2414
// NewJSMirrorWithSubjectFiltersError creates a new JSMirrorWithSubjectFiltersErr error: "stream mirrors can not contain filtered subjects"
2415
func NewJSMirrorWithSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
2416
        eopts := parseOpts(opts)
×
2417
        if ae, ok := eopts.err.(*ApiError); ok {
×
2418
                return ae
×
2419
        }
×
2420

2421
        return ApiErrors[JSMirrorWithSubjectFiltersErr]
×
2422
}
2423

2424
// NewJSMirrorWithSubjectsError creates a new JSMirrorWithSubjectsErr error: "stream mirrors can not contain subjects"
2425
func NewJSMirrorWithSubjectsError(opts ...ErrorOption) *ApiError {
2✔
2426
        eopts := parseOpts(opts)
2✔
2427
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2428
                return ae
×
2429
        }
×
2430

2431
        return ApiErrors[JSMirrorWithSubjectsErr]
2✔
2432
}
2433

2434
// NewJSNoAccountError creates a new JSNoAccountErr error: "account not found"
2435
func NewJSNoAccountError(opts ...ErrorOption) *ApiError {
1✔
2436
        eopts := parseOpts(opts)
1✔
2437
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2438
                return ae
×
2439
        }
×
2440

2441
        return ApiErrors[JSNoAccountErr]
1✔
2442
}
2443

2444
// NewJSNoLimitsError creates a new JSNoLimitsErr error: "no JetStream default or applicable tiered limit present"
2445
func NewJSNoLimitsError(opts ...ErrorOption) *ApiError {
4✔
2446
        eopts := parseOpts(opts)
4✔
2447
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2448
                return ae
×
2449
        }
×
2450

2451
        return ApiErrors[JSNoLimitsErr]
4✔
2452
}
2453

2454
// NewJSNoMessageFoundError creates a new JSNoMessageFoundErr error: "no message found"
2455
func NewJSNoMessageFoundError(opts ...ErrorOption) *ApiError {
685✔
2456
        eopts := parseOpts(opts)
685✔
2457
        if ae, ok := eopts.err.(*ApiError); ok {
685✔
2458
                return ae
×
2459
        }
×
2460

2461
        return ApiErrors[JSNoMessageFoundErr]
685✔
2462
}
2463

2464
// NewJSNotEmptyRequestError creates a new JSNotEmptyRequestErr error: "expected an empty request payload"
2465
func NewJSNotEmptyRequestError(opts ...ErrorOption) *ApiError {
3✔
2466
        eopts := parseOpts(opts)
3✔
2467
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2468
                return ae
×
2469
        }
×
2470

2471
        return ApiErrors[JSNotEmptyRequestErr]
3✔
2472
}
2473

2474
// NewJSNotEnabledError creates a new JSNotEnabledErr error: "JetStream not enabled"
2475
func NewJSNotEnabledError(opts ...ErrorOption) *ApiError {
11✔
2476
        eopts := parseOpts(opts)
11✔
2477
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
2478
                return ae
×
2479
        }
×
2480

2481
        return ApiErrors[JSNotEnabledErr]
11✔
2482
}
2483

2484
// NewJSNotEnabledForAccountError creates a new JSNotEnabledForAccountErr error: "JetStream not enabled for account"
2485
func NewJSNotEnabledForAccountError(opts ...ErrorOption) *ApiError {
205✔
2486
        eopts := parseOpts(opts)
205✔
2487
        if ae, ok := eopts.err.(*ApiError); ok {
205✔
2488
                return ae
×
2489
        }
×
2490

2491
        return ApiErrors[JSNotEnabledForAccountErr]
205✔
2492
}
2493

2494
// NewJSPedanticError creates a new JSPedanticErrF error: "pedantic mode: {err}"
2495
func NewJSPedanticError(err error, opts ...ErrorOption) *ApiError {
36✔
2496
        eopts := parseOpts(opts)
36✔
2497
        if ae, ok := eopts.err.(*ApiError); ok {
36✔
2498
                return ae
×
2499
        }
×
2500

2501
        e := ApiErrors[JSPedanticErrF]
36✔
2502
        args := e.toReplacerArgs([]interface{}{"{err}", err})
36✔
2503
        return &ApiError{
36✔
2504
                Code:        e.Code,
36✔
2505
                ErrCode:     e.ErrCode,
36✔
2506
                Description: strings.NewReplacer(args...).Replace(e.Description),
36✔
2507
        }
36✔
2508
}
2509

2510
// NewJSPeerRemapError creates a new JSPeerRemapErr error: "peer remap failed"
2511
func NewJSPeerRemapError(opts ...ErrorOption) *ApiError {
5✔
2512
        eopts := parseOpts(opts)
5✔
2513
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2514
                return ae
1✔
2515
        }
1✔
2516

2517
        return ApiErrors[JSPeerRemapErr]
4✔
2518
}
2519

2520
// NewJSRaftGeneralError creates a new JSRaftGeneralErrF error: "{err}"
2521
func NewJSRaftGeneralError(err error, opts ...ErrorOption) *ApiError {
×
2522
        eopts := parseOpts(opts)
×
2523
        if ae, ok := eopts.err.(*ApiError); ok {
×
2524
                return ae
×
2525
        }
×
2526

2527
        e := ApiErrors[JSRaftGeneralErrF]
×
2528
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2529
        return &ApiError{
×
2530
                Code:        e.Code,
×
2531
                ErrCode:     e.ErrCode,
×
2532
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2533
        }
×
2534
}
2535

2536
// NewJSReplicasCountCannotBeNegativeError creates a new JSReplicasCountCannotBeNegative error: "replicas count cannot be negative"
2537
func NewJSReplicasCountCannotBeNegativeError(opts ...ErrorOption) *ApiError {
16✔
2538
        eopts := parseOpts(opts)
16✔
2539
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2540
                return ae
×
2541
        }
×
2542

2543
        return ApiErrors[JSReplicasCountCannotBeNegative]
16✔
2544
}
2545

2546
// NewJSRequiredApiLevelError creates a new JSRequiredApiLevelErr error: "JetStream minimum api level required"
2547
func NewJSRequiredApiLevelError(opts ...ErrorOption) *ApiError {
44✔
2548
        eopts := parseOpts(opts)
44✔
2549
        if ae, ok := eopts.err.(*ApiError); ok {
44✔
2550
                return ae
×
2551
        }
×
2552

2553
        return ApiErrors[JSRequiredApiLevelErr]
44✔
2554
}
2555

2556
// NewJSRestoreSubscribeFailedError creates a new JSRestoreSubscribeFailedErrF error: "JetStream unable to subscribe to restore snapshot {subject}: {err}"
2557
func NewJSRestoreSubscribeFailedError(err error, subject interface{}, opts ...ErrorOption) *ApiError {
1✔
2558
        eopts := parseOpts(opts)
1✔
2559
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2560
                return ae
×
2561
        }
×
2562

2563
        e := ApiErrors[JSRestoreSubscribeFailedErrF]
1✔
2564
        args := e.toReplacerArgs([]interface{}{"{err}", err, "{subject}", subject})
1✔
2565
        return &ApiError{
1✔
2566
                Code:        e.Code,
1✔
2567
                ErrCode:     e.ErrCode,
1✔
2568
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2569
        }
1✔
2570
}
2571

2572
// NewJSSequenceNotFoundError creates a new JSSequenceNotFoundErrF error: "sequence {seq} not found"
2573
func NewJSSequenceNotFoundError(seq uint64, opts ...ErrorOption) *ApiError {
2,018✔
2574
        eopts := parseOpts(opts)
2,018✔
2575
        if ae, ok := eopts.err.(*ApiError); ok {
2,018✔
2576
                return ae
×
2577
        }
×
2578

2579
        e := ApiErrors[JSSequenceNotFoundErrF]
2,018✔
2580
        args := e.toReplacerArgs([]interface{}{"{seq}", seq})
2,018✔
2581
        return &ApiError{
2,018✔
2582
                Code:        e.Code,
2,018✔
2583
                ErrCode:     e.ErrCode,
2,018✔
2584
                Description: strings.NewReplacer(args...).Replace(e.Description),
2,018✔
2585
        }
2,018✔
2586
}
2587

2588
// NewJSSnapshotDeliverSubjectInvalidError creates a new JSSnapshotDeliverSubjectInvalidErr error: "deliver subject not valid"
2589
func NewJSSnapshotDeliverSubjectInvalidError(opts ...ErrorOption) *ApiError {
1✔
2590
        eopts := parseOpts(opts)
1✔
2591
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2592
                return ae
×
2593
        }
×
2594

2595
        return ApiErrors[JSSnapshotDeliverSubjectInvalidErr]
1✔
2596
}
2597

2598
// NewJSSourceConsumerRequiresAckFCError creates a new JSSourceConsumerRequiresAckFCErr error: "stream source consumer requires flow control ack policy"
2599
func NewJSSourceConsumerRequiresAckFCError(opts ...ErrorOption) *ApiError {
3✔
2600
        eopts := parseOpts(opts)
3✔
2601
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2602
                return ae
×
2603
        }
×
2604

2605
        return ApiErrors[JSSourceConsumerRequiresAckFCErr]
3✔
2606
}
2607

2608
// NewJSSourceConsumerSetupFailedError creates a new JSSourceConsumerSetupFailedErrF error: "{err}"
2609
func NewJSSourceConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
2610
        eopts := parseOpts(opts)
×
2611
        if ae, ok := eopts.err.(*ApiError); ok {
×
2612
                return ae
×
2613
        }
×
2614

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

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

2631
        return ApiErrors[JSSourceDuplicateDetected]
×
2632
}
2633

2634
// NewJSSourceDurableConsumerCfgInvalidError creates a new JSSourceDurableConsumerCfgInvalid error: "stream source consumer config is invalid"
2635
func NewJSSourceDurableConsumerCfgInvalidError(opts ...ErrorOption) *ApiError {
14✔
2636
        eopts := parseOpts(opts)
14✔
2637
        if ae, ok := eopts.err.(*ApiError); ok {
14✔
2638
                return ae
×
2639
        }
×
2640

2641
        return ApiErrors[JSSourceDurableConsumerCfgInvalid]
14✔
2642
}
2643

2644
// NewJSSourceDurableConsumerDuplicateDetectedError creates a new JSSourceDurableConsumerDuplicateDetected error: "duplicate stream source consumer detected"
2645
func NewJSSourceDurableConsumerDuplicateDetectedError(opts ...ErrorOption) *ApiError {
2✔
2646
        eopts := parseOpts(opts)
2✔
2647
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2648
                return ae
×
2649
        }
×
2650

2651
        return ApiErrors[JSSourceDurableConsumerDuplicateDetected]
2✔
2652
}
2653

2654
// NewJSSourceInvalidStreamNameError creates a new JSSourceInvalidStreamName error: "sourced stream name is invalid"
2655
func NewJSSourceInvalidStreamNameError(opts ...ErrorOption) *ApiError {
2✔
2656
        eopts := parseOpts(opts)
2✔
2657
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2658
                return ae
×
2659
        }
×
2660

2661
        return ApiErrors[JSSourceInvalidStreamName]
2✔
2662
}
2663

2664
// NewJSSourceInvalidSubjectFilterError creates a new JSSourceInvalidSubjectFilter error: "source transform source: {err}"
2665
func NewJSSourceInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
5✔
2666
        eopts := parseOpts(opts)
5✔
2667
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2668
                return ae
×
2669
        }
×
2670

2671
        e := ApiErrors[JSSourceInvalidSubjectFilter]
5✔
2672
        args := e.toReplacerArgs([]interface{}{"{err}", err})
5✔
2673
        return &ApiError{
5✔
2674
                Code:        e.Code,
5✔
2675
                ErrCode:     e.ErrCode,
5✔
2676
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
2677
        }
5✔
2678
}
2679

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

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

2696
// NewJSSourceMaxMessageSizeTooBigError creates a new JSSourceMaxMessageSizeTooBigErr error: "stream source must have max message size >= target"
2697
func NewJSSourceMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
2698
        eopts := parseOpts(opts)
×
2699
        if ae, ok := eopts.err.(*ApiError); ok {
×
2700
                return ae
×
2701
        }
×
2702

2703
        return ApiErrors[JSSourceMaxMessageSizeTooBigErr]
×
2704
}
2705

2706
// NewJSSourceMultipleFiltersNotAllowedError creates a new JSSourceMultipleFiltersNotAllowed error: "source with multiple subject transforms cannot also have a single subject filter"
2707
func NewJSSourceMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
4✔
2708
        eopts := parseOpts(opts)
4✔
2709
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2710
                return ae
×
2711
        }
×
2712

2713
        return ApiErrors[JSSourceMultipleFiltersNotAllowed]
4✔
2714
}
2715

2716
// NewJSSourceOverlappingSubjectFiltersError creates a new JSSourceOverlappingSubjectFilters error: "source filters can not overlap"
2717
func NewJSSourceOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
4✔
2718
        eopts := parseOpts(opts)
4✔
2719
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2720
                return ae
×
2721
        }
×
2722

2723
        return ApiErrors[JSSourceOverlappingSubjectFilters]
4✔
2724
}
2725

2726
// NewJSSourceWithMsgSchedulesError creates a new JSSourceWithMsgSchedulesErr error: "stream source can not also schedule messages"
2727
func NewJSSourceWithMsgSchedulesError(opts ...ErrorOption) *ApiError {
4✔
2728
        eopts := parseOpts(opts)
4✔
2729
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2730
                return ae
×
2731
        }
×
2732

2733
        return ApiErrors[JSSourceWithMsgSchedulesErr]
4✔
2734
}
2735

2736
// NewJSStorageResourcesExceededError creates a new JSStorageResourcesExceededErr error: "insufficient storage resources available"
2737
func NewJSStorageResourcesExceededError(opts ...ErrorOption) *ApiError {
37✔
2738
        eopts := parseOpts(opts)
37✔
2739
        if ae, ok := eopts.err.(*ApiError); ok {
37✔
2740
                return ae
×
2741
        }
×
2742

2743
        return ApiErrors[JSStorageResourcesExceededErr]
37✔
2744
}
2745

2746
// NewJSStreamAssignmentError creates a new JSStreamAssignmentErrF error: "{err}"
2747
func NewJSStreamAssignmentError(err error, opts ...ErrorOption) *ApiError {
×
2748
        eopts := parseOpts(opts)
×
2749
        if ae, ok := eopts.err.(*ApiError); ok {
×
2750
                return ae
×
2751
        }
×
2752

2753
        e := ApiErrors[JSStreamAssignmentErrF]
×
2754
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2755
        return &ApiError{
×
2756
                Code:        e.Code,
×
2757
                ErrCode:     e.ErrCode,
×
2758
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2759
        }
×
2760
}
2761

2762
// NewJSStreamCreateError creates a new JSStreamCreateErrF error: "{err}"
2763
func NewJSStreamCreateError(err error, opts ...ErrorOption) *ApiError {
82✔
2764
        eopts := parseOpts(opts)
82✔
2765
        if ae, ok := eopts.err.(*ApiError); ok {
161✔
2766
                return ae
79✔
2767
        }
79✔
2768

2769
        e := ApiErrors[JSStreamCreateErrF]
3✔
2770
        args := e.toReplacerArgs([]interface{}{"{err}", err})
3✔
2771
        return &ApiError{
3✔
2772
                Code:        e.Code,
3✔
2773
                ErrCode:     e.ErrCode,
3✔
2774
                Description: strings.NewReplacer(args...).Replace(e.Description),
3✔
2775
        }
3✔
2776
}
2777

2778
// NewJSStreamDeleteError creates a new JSStreamDeleteErrF error: "{err}"
2779
func NewJSStreamDeleteError(err error, opts ...ErrorOption) *ApiError {
×
2780
        eopts := parseOpts(opts)
×
2781
        if ae, ok := eopts.err.(*ApiError); ok {
×
2782
                return ae
×
2783
        }
×
2784

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

2794
// NewJSStreamDuplicateMessageConflictError creates a new JSStreamDuplicateMessageConflict error: "duplicate message id is in process"
2795
func NewJSStreamDuplicateMessageConflictError(opts ...ErrorOption) *ApiError {
131✔
2796
        eopts := parseOpts(opts)
131✔
2797
        if ae, ok := eopts.err.(*ApiError); ok {
131✔
2798
                return ae
×
2799
        }
×
2800

2801
        return ApiErrors[JSStreamDuplicateMessageConflict]
131✔
2802
}
2803

2804
// NewJSStreamExpectedLastSeqPerSubjectInvalidError creates a new JSStreamExpectedLastSeqPerSubjectInvalid error: "missing sequence for expected last sequence per subject"
2805
func NewJSStreamExpectedLastSeqPerSubjectInvalidError(opts ...ErrorOption) *ApiError {
8✔
2806
        eopts := parseOpts(opts)
8✔
2807
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
2808
                return ae
×
2809
        }
×
2810

2811
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectInvalid]
8✔
2812
}
2813

2814
// NewJSStreamExpectedLastSeqPerSubjectNotReadyError creates a new JSStreamExpectedLastSeqPerSubjectNotReady error: "expected last sequence per subject temporarily unavailable"
2815
func NewJSStreamExpectedLastSeqPerSubjectNotReadyError(opts ...ErrorOption) *ApiError {
×
2816
        eopts := parseOpts(opts)
×
2817
        if ae, ok := eopts.err.(*ApiError); ok {
×
2818
                return ae
×
2819
        }
×
2820

2821
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectNotReady]
×
2822
}
2823

2824
// NewJSStreamExternalApiOverlapError creates a new JSStreamExternalApiOverlapErrF error: "stream external api prefix {prefix} must not overlap with {subject}"
2825
func NewJSStreamExternalApiOverlapError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
2✔
2826
        eopts := parseOpts(opts)
2✔
2827
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2828
                return ae
×
2829
        }
×
2830

2831
        e := ApiErrors[JSStreamExternalApiOverlapErrF]
2✔
2832
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
2✔
2833
        return &ApiError{
2✔
2834
                Code:        e.Code,
2✔
2835
                ErrCode:     e.ErrCode,
2✔
2836
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2837
        }
2✔
2838
}
2839

2840
// NewJSStreamExternalDelPrefixOverlapsError creates a new JSStreamExternalDelPrefixOverlapsErrF error: "stream external delivery prefix {prefix} overlaps with stream subject {subject}"
2841
func NewJSStreamExternalDelPrefixOverlapsError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
×
2842
        eopts := parseOpts(opts)
×
2843
        if ae, ok := eopts.err.(*ApiError); ok {
×
2844
                return ae
×
2845
        }
×
2846

2847
        e := ApiErrors[JSStreamExternalDelPrefixOverlapsErrF]
×
2848
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
×
2849
        return &ApiError{
×
2850
                Code:        e.Code,
×
2851
                ErrCode:     e.ErrCode,
×
2852
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2853
        }
×
2854
}
2855

2856
// NewJSStreamGeneralError creates a new JSStreamGeneralErrorF error: "{err}"
2857
func NewJSStreamGeneralError(err error, opts ...ErrorOption) *ApiError {
5✔
2858
        eopts := parseOpts(opts)
5✔
2859
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2860
                return ae
×
2861
        }
×
2862

2863
        e := ApiErrors[JSStreamGeneralErrorF]
5✔
2864
        args := e.toReplacerArgs([]interface{}{"{err}", err})
5✔
2865
        return &ApiError{
5✔
2866
                Code:        e.Code,
5✔
2867
                ErrCode:     e.ErrCode,
5✔
2868
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
2869
        }
5✔
2870
}
2871

2872
// NewJSStreamHeaderExceedsMaximumError creates a new JSStreamHeaderExceedsMaximumErr error: "header size exceeds maximum allowed of 64k"
2873
func NewJSStreamHeaderExceedsMaximumError(opts ...ErrorOption) *ApiError {
1✔
2874
        eopts := parseOpts(opts)
1✔
2875
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2876
                return ae
×
2877
        }
×
2878

2879
        return ApiErrors[JSStreamHeaderExceedsMaximumErr]
1✔
2880
}
2881

2882
// NewJSStreamInfoMaxSubjectsError creates a new JSStreamInfoMaxSubjectsErr error: "subject details would exceed maximum allowed"
2883
func NewJSStreamInfoMaxSubjectsError(opts ...ErrorOption) *ApiError {
×
2884
        eopts := parseOpts(opts)
×
2885
        if ae, ok := eopts.err.(*ApiError); ok {
×
2886
                return ae
×
2887
        }
×
2888

2889
        return ApiErrors[JSStreamInfoMaxSubjectsErr]
×
2890
}
2891

2892
// NewJSStreamInvalidConfigError creates a new JSStreamInvalidConfigF error: "{err}"
2893
func NewJSStreamInvalidConfigError(err error, opts ...ErrorOption) *ApiError {
168✔
2894
        eopts := parseOpts(opts)
168✔
2895
        if ae, ok := eopts.err.(*ApiError); ok {
188✔
2896
                return ae
20✔
2897
        }
20✔
2898

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

2908
// NewJSStreamInvalidError creates a new JSStreamInvalidErr error: "stream not valid"
2909
func NewJSStreamInvalidError(opts ...ErrorOption) *ApiError {
×
2910
        eopts := parseOpts(opts)
×
2911
        if ae, ok := eopts.err.(*ApiError); ok {
×
2912
                return ae
×
2913
        }
×
2914

2915
        return ApiErrors[JSStreamInvalidErr]
×
2916
}
2917

2918
// NewJSStreamInvalidExternalDeliverySubjError creates a new JSStreamInvalidExternalDeliverySubjErrF error: "stream external delivery prefix {prefix} must not contain wildcards"
2919
func NewJSStreamInvalidExternalDeliverySubjError(prefix interface{}, opts ...ErrorOption) *ApiError {
×
2920
        eopts := parseOpts(opts)
×
2921
        if ae, ok := eopts.err.(*ApiError); ok {
×
2922
                return ae
×
2923
        }
×
2924

2925
        e := ApiErrors[JSStreamInvalidExternalDeliverySubjErrF]
×
2926
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix})
×
2927
        return &ApiError{
×
2928
                Code:        e.Code,
×
2929
                ErrCode:     e.ErrCode,
×
2930
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2931
        }
×
2932
}
2933

2934
// NewJSStreamLimitsError creates a new JSStreamLimitsErrF error: "{err}"
2935
func NewJSStreamLimitsError(err error, opts ...ErrorOption) *ApiError {
18✔
2936
        eopts := parseOpts(opts)
18✔
2937
        if ae, ok := eopts.err.(*ApiError); ok {
36✔
2938
                return ae
18✔
2939
        }
18✔
2940

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

2950
// NewJSStreamMaxBytesRequiredError creates a new JSStreamMaxBytesRequired error: "account requires a stream config to have max bytes set"
2951
func NewJSStreamMaxBytesRequiredError(opts ...ErrorOption) *ApiError {
11✔
2952
        eopts := parseOpts(opts)
11✔
2953
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
2954
                return ae
×
2955
        }
×
2956

2957
        return ApiErrors[JSStreamMaxBytesRequired]
11✔
2958
}
2959

2960
// NewJSStreamMaxStreamBytesExceededError creates a new JSStreamMaxStreamBytesExceeded error: "stream max bytes exceeds account limit max stream bytes"
2961
func NewJSStreamMaxStreamBytesExceededError(opts ...ErrorOption) *ApiError {
12✔
2962
        eopts := parseOpts(opts)
12✔
2963
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
2964
                return ae
×
2965
        }
×
2966

2967
        return ApiErrors[JSStreamMaxStreamBytesExceeded]
12✔
2968
}
2969

2970
// NewJSStreamMessageExceedsMaximumError creates a new JSStreamMessageExceedsMaximumErr error: "message size exceeds maximum allowed"
2971
func NewJSStreamMessageExceedsMaximumError(opts ...ErrorOption) *ApiError {
15✔
2972
        eopts := parseOpts(opts)
15✔
2973
        if ae, ok := eopts.err.(*ApiError); ok {
15✔
2974
                return ae
×
2975
        }
×
2976

2977
        return ApiErrors[JSStreamMessageExceedsMaximumErr]
15✔
2978
}
2979

2980
// NewJSStreamMinLastSeqError creates a new JSStreamMinLastSeqErr error: "min last sequence"
2981
func NewJSStreamMinLastSeqError(opts ...ErrorOption) *ApiError {
×
2982
        eopts := parseOpts(opts)
×
2983
        if ae, ok := eopts.err.(*ApiError); ok {
×
2984
                return ae
×
2985
        }
×
2986

2987
        return ApiErrors[JSStreamMinLastSeqErr]
×
2988
}
2989

2990
// NewJSStreamMirrorNotUpdatableError creates a new JSStreamMirrorNotUpdatableErr error: "stream mirror configuration can not be updated"
2991
func NewJSStreamMirrorNotUpdatableError(opts ...ErrorOption) *ApiError {
4✔
2992
        eopts := parseOpts(opts)
4✔
2993
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2994
                return ae
×
2995
        }
×
2996

2997
        return ApiErrors[JSStreamMirrorNotUpdatableErr]
4✔
2998
}
2999

3000
// NewJSStreamMismatchError creates a new JSStreamMismatchErr error: "stream name in subject does not match request"
3001
func NewJSStreamMismatchError(opts ...ErrorOption) *ApiError {
7✔
3002
        eopts := parseOpts(opts)
7✔
3003
        if ae, ok := eopts.err.(*ApiError); ok {
7✔
3004
                return ae
×
3005
        }
×
3006

3007
        return ApiErrors[JSStreamMismatchErr]
7✔
3008
}
3009

3010
// NewJSStreamMoveAndScaleError creates a new JSStreamMoveAndScaleErr error: "can not move and scale a stream in a single update"
3011
func NewJSStreamMoveAndScaleError(opts ...ErrorOption) *ApiError {
4✔
3012
        eopts := parseOpts(opts)
4✔
3013
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
3014
                return ae
×
3015
        }
×
3016

3017
        return ApiErrors[JSStreamMoveAndScaleErr]
4✔
3018
}
3019

3020
// NewJSStreamMoveInProgressError creates a new JSStreamMoveInProgressF error: "stream move already in progress: {msg}"
3021
func NewJSStreamMoveInProgressError(msg interface{}, opts ...ErrorOption) *ApiError {
2✔
3022
        eopts := parseOpts(opts)
2✔
3023
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
3024
                return ae
×
3025
        }
×
3026

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

3036
// NewJSStreamMoveNotInProgressError creates a new JSStreamMoveNotInProgress error: "stream move not in progress"
3037
func NewJSStreamMoveNotInProgressError(opts ...ErrorOption) *ApiError {
×
3038
        eopts := parseOpts(opts)
×
3039
        if ae, ok := eopts.err.(*ApiError); ok {
×
3040
                return ae
×
3041
        }
×
3042

3043
        return ApiErrors[JSStreamMoveNotInProgress]
×
3044
}
3045

3046
// NewJSStreamMsgDeleteFailedError creates a new JSStreamMsgDeleteFailedF error: "{err}"
3047
func NewJSStreamMsgDeleteFailedError(err error, opts ...ErrorOption) *ApiError {
1,654✔
3048
        eopts := parseOpts(opts)
1,654✔
3049
        if ae, ok := eopts.err.(*ApiError); ok {
1,654✔
3050
                return ae
×
3051
        }
×
3052

3053
        e := ApiErrors[JSStreamMsgDeleteFailedF]
1,654✔
3054
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1,654✔
3055
        return &ApiError{
1,654✔
3056
                Code:        e.Code,
1,654✔
3057
                ErrCode:     e.ErrCode,
1,654✔
3058
                Description: strings.NewReplacer(args...).Replace(e.Description),
1,654✔
3059
        }
1,654✔
3060
}
3061

3062
// NewJSStreamNameContainsPathSeparatorsError creates a new JSStreamNameContainsPathSeparatorsErr error: "Stream name can not contain path separators"
3063
func NewJSStreamNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
6✔
3064
        eopts := parseOpts(opts)
6✔
3065
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
3066
                return ae
×
3067
        }
×
3068

3069
        return ApiErrors[JSStreamNameContainsPathSeparatorsErr]
6✔
3070
}
3071

3072
// NewJSStreamNameExistError creates a new JSStreamNameExistErr error: "stream name already in use with a different configuration"
3073
func NewJSStreamNameExistError(opts ...ErrorOption) *ApiError {
10✔
3074
        eopts := parseOpts(opts)
10✔
3075
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
3076
                return ae
×
3077
        }
×
3078

3079
        return ApiErrors[JSStreamNameExistErr]
10✔
3080
}
3081

3082
// NewJSStreamNameExistRestoreFailedError creates a new JSStreamNameExistRestoreFailedErr error: "stream name already in use, cannot restore"
3083
func NewJSStreamNameExistRestoreFailedError(opts ...ErrorOption) *ApiError {
7✔
3084
        eopts := parseOpts(opts)
7✔
3085
        if ae, ok := eopts.err.(*ApiError); ok {
7✔
3086
                return ae
×
3087
        }
×
3088

3089
        return ApiErrors[JSStreamNameExistRestoreFailedErr]
7✔
3090
}
3091

3092
// NewJSStreamNotFoundError creates a new JSStreamNotFoundErr error: "stream not found"
3093
func NewJSStreamNotFoundError(opts ...ErrorOption) *ApiError {
29,923✔
3094
        eopts := parseOpts(opts)
29,923✔
3095
        if ae, ok := eopts.err.(*ApiError); ok {
30,251✔
3096
                return ae
328✔
3097
        }
328✔
3098

3099
        return ApiErrors[JSStreamNotFoundErr]
29,595✔
3100
}
3101

3102
// NewJSStreamNotMatchError creates a new JSStreamNotMatchErr error: "expected stream does not match"
3103
func NewJSStreamNotMatchError(opts ...ErrorOption) *ApiError {
1✔
3104
        eopts := parseOpts(opts)
1✔
3105
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3106
                return ae
×
3107
        }
×
3108

3109
        return ApiErrors[JSStreamNotMatchErr]
1✔
3110
}
3111

3112
// NewJSStreamOfflineError creates a new JSStreamOfflineErr error: "stream is offline"
3113
func NewJSStreamOfflineError(opts ...ErrorOption) *ApiError {
8✔
3114
        eopts := parseOpts(opts)
8✔
3115
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
3116
                return ae
×
3117
        }
×
3118

3119
        return ApiErrors[JSStreamOfflineErr]
8✔
3120
}
3121

3122
// NewJSStreamOfflineReasonError creates a new JSStreamOfflineReasonErrF error: "stream is offline: {err}"
3123
func NewJSStreamOfflineReasonError(err error, opts ...ErrorOption) *ApiError {
40✔
3124
        eopts := parseOpts(opts)
40✔
3125
        if ae, ok := eopts.err.(*ApiError); ok {
40✔
3126
                return ae
×
3127
        }
×
3128

3129
        e := ApiErrors[JSStreamOfflineReasonErrF]
40✔
3130
        args := e.toReplacerArgs([]interface{}{"{err}", err})
40✔
3131
        return &ApiError{
40✔
3132
                Code:        e.Code,
40✔
3133
                ErrCode:     e.ErrCode,
40✔
3134
                Description: strings.NewReplacer(args...).Replace(e.Description),
40✔
3135
        }
40✔
3136
}
3137

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

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

3154
// NewJSStreamReplicasNotSupportedError creates a new JSStreamReplicasNotSupportedErr error: "replicas > 1 not supported in non-clustered mode"
3155
func NewJSStreamReplicasNotSupportedError(opts ...ErrorOption) *ApiError {
×
3156
        eopts := parseOpts(opts)
×
3157
        if ae, ok := eopts.err.(*ApiError); ok {
×
3158
                return ae
×
3159
        }
×
3160

3161
        return ApiErrors[JSStreamReplicasNotSupportedErr]
×
3162
}
3163

3164
// NewJSStreamReplicasNotUpdatableError creates a new JSStreamReplicasNotUpdatableErr error: "Replicas configuration can not be updated"
3165
func NewJSStreamReplicasNotUpdatableError(opts ...ErrorOption) *ApiError {
×
3166
        eopts := parseOpts(opts)
×
3167
        if ae, ok := eopts.err.(*ApiError); ok {
×
3168
                return ae
×
3169
        }
×
3170

3171
        return ApiErrors[JSStreamReplicasNotUpdatableErr]
×
3172
}
3173

3174
// NewJSStreamRestoreError creates a new JSStreamRestoreErrF error: "restore failed: {err}"
3175
func NewJSStreamRestoreError(err error, opts ...ErrorOption) *ApiError {
7✔
3176
        eopts := parseOpts(opts)
7✔
3177
        if ae, ok := eopts.err.(*ApiError); ok {
9✔
3178
                return ae
2✔
3179
        }
2✔
3180

3181
        e := ApiErrors[JSStreamRestoreErrF]
5✔
3182
        args := e.toReplacerArgs([]interface{}{"{err}", err})
5✔
3183
        return &ApiError{
5✔
3184
                Code:        e.Code,
5✔
3185
                ErrCode:     e.ErrCode,
5✔
3186
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
3187
        }
5✔
3188
}
3189

3190
// NewJSStreamRollupFailedError creates a new JSStreamRollupFailedF error: "{err}"
3191
func NewJSStreamRollupFailedError(err error, opts ...ErrorOption) *ApiError {
5✔
3192
        eopts := parseOpts(opts)
5✔
3193
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
3194
                return ae
×
3195
        }
×
3196

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

3206
// NewJSStreamSealedError creates a new JSStreamSealedErr error: "invalid operation on sealed stream"
3207
func NewJSStreamSealedError(opts ...ErrorOption) *ApiError {
8✔
3208
        eopts := parseOpts(opts)
8✔
3209
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
3210
                return ae
×
3211
        }
×
3212

3213
        return ApiErrors[JSStreamSealedErr]
8✔
3214
}
3215

3216
// NewJSStreamSequenceNotMatchError creates a new JSStreamSequenceNotMatchErr error: "expected stream sequence does not match"
3217
func NewJSStreamSequenceNotMatchError(opts ...ErrorOption) *ApiError {
×
3218
        eopts := parseOpts(opts)
×
3219
        if ae, ok := eopts.err.(*ApiError); ok {
×
3220
                return ae
×
3221
        }
×
3222

3223
        return ApiErrors[JSStreamSequenceNotMatchErr]
×
3224
}
3225

3226
// NewJSStreamSnapshotError creates a new JSStreamSnapshotErrF error: "snapshot failed: {err}"
3227
func NewJSStreamSnapshotError(err error, opts ...ErrorOption) *ApiError {
×
3228
        eopts := parseOpts(opts)
×
3229
        if ae, ok := eopts.err.(*ApiError); ok {
×
3230
                return ae
×
3231
        }
×
3232

3233
        e := ApiErrors[JSStreamSnapshotErrF]
×
3234
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
3235
        return &ApiError{
×
3236
                Code:        e.Code,
×
3237
                ErrCode:     e.ErrCode,
×
3238
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
3239
        }
×
3240
}
3241

3242
// NewJSStreamStoreFailedError creates a new JSStreamStoreFailedF error: "{err}"
3243
func NewJSStreamStoreFailedError(err error, opts ...ErrorOption) *ApiError {
2,979✔
3244
        eopts := parseOpts(opts)
2,979✔
3245
        if ae, ok := eopts.err.(*ApiError); ok {
2,979✔
3246
                return ae
×
3247
        }
×
3248

3249
        e := ApiErrors[JSStreamStoreFailedF]
2,979✔
3250
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2,979✔
3251
        return &ApiError{
2,979✔
3252
                Code:        e.Code,
2,979✔
3253
                ErrCode:     e.ErrCode,
2,979✔
3254
                Description: strings.NewReplacer(args...).Replace(e.Description),
2,979✔
3255
        }
2,979✔
3256
}
3257

3258
// NewJSStreamSubjectOverlapError creates a new JSStreamSubjectOverlapErr error: "subjects overlap with an existing stream"
3259
func NewJSStreamSubjectOverlapError(opts ...ErrorOption) *ApiError {
25✔
3260
        eopts := parseOpts(opts)
25✔
3261
        if ae, ok := eopts.err.(*ApiError); ok {
25✔
3262
                return ae
×
3263
        }
×
3264

3265
        return ApiErrors[JSStreamSubjectOverlapErr]
25✔
3266
}
3267

3268
// NewJSStreamTemplateCreateError creates a new JSStreamTemplateCreateErrF error: "{err}"
3269
func NewJSStreamTemplateCreateError(err error, opts ...ErrorOption) *ApiError {
×
3270
        eopts := parseOpts(opts)
×
3271
        if ae, ok := eopts.err.(*ApiError); ok {
×
3272
                return ae
×
3273
        }
×
3274

3275
        e := ApiErrors[JSStreamTemplateCreateErrF]
×
3276
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
3277
        return &ApiError{
×
3278
                Code:        e.Code,
×
3279
                ErrCode:     e.ErrCode,
×
3280
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
3281
        }
×
3282
}
3283

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

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

3300
// NewJSStreamTemplateNotFoundError creates a new JSStreamTemplateNotFoundErr error: "template not found"
3301
func NewJSStreamTemplateNotFoundError(opts ...ErrorOption) *ApiError {
×
3302
        eopts := parseOpts(opts)
×
3303
        if ae, ok := eopts.err.(*ApiError); ok {
×
3304
                return ae
×
3305
        }
×
3306

3307
        return ApiErrors[JSStreamTemplateNotFoundErr]
×
3308
}
3309

3310
// NewJSStreamTooManyRequestsError creates a new JSStreamTooManyRequests error: "too many requests"
3311
func NewJSStreamTooManyRequestsError(opts ...ErrorOption) *ApiError {
78✔
3312
        eopts := parseOpts(opts)
78✔
3313
        if ae, ok := eopts.err.(*ApiError); ok {
78✔
3314
                return ae
×
3315
        }
×
3316

3317
        return ApiErrors[JSStreamTooManyRequests]
78✔
3318
}
3319

3320
// NewJSStreamTransformInvalidDestinationError creates a new JSStreamTransformInvalidDestination error: "stream transform: {err}"
3321
func NewJSStreamTransformInvalidDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
3322
        eopts := parseOpts(opts)
1✔
3323
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3324
                return ae
×
3325
        }
×
3326

3327
        e := ApiErrors[JSStreamTransformInvalidDestination]
1✔
3328
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
3329
        return &ApiError{
1✔
3330
                Code:        e.Code,
1✔
3331
                ErrCode:     e.ErrCode,
1✔
3332
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
3333
        }
1✔
3334
}
3335

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

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

3352
// NewJSStreamUpdateError creates a new JSStreamUpdateErrF error: "{err}"
3353
func NewJSStreamUpdateError(err error, opts ...ErrorOption) *ApiError {
31✔
3354
        eopts := parseOpts(opts)
31✔
3355
        if ae, ok := eopts.err.(*ApiError); ok {
56✔
3356
                return ae
25✔
3357
        }
25✔
3358

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

3368
// NewJSStreamWrongLastMsgIDError creates a new JSStreamWrongLastMsgIDErrF error: "wrong last msg ID: {id}"
3369
func NewJSStreamWrongLastMsgIDError(id interface{}, opts ...ErrorOption) *ApiError {
1✔
3370
        eopts := parseOpts(opts)
1✔
3371
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3372
                return ae
×
3373
        }
×
3374

3375
        e := ApiErrors[JSStreamWrongLastMsgIDErrF]
1✔
3376
        args := e.toReplacerArgs([]interface{}{"{id}", id})
1✔
3377
        return &ApiError{
1✔
3378
                Code:        e.Code,
1✔
3379
                ErrCode:     e.ErrCode,
1✔
3380
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
3381
        }
1✔
3382
}
3383

3384
// NewJSStreamWrongLastSequenceConstantError creates a new JSStreamWrongLastSequenceConstantErr error: "wrong last sequence"
3385
func NewJSStreamWrongLastSequenceConstantError(opts ...ErrorOption) *ApiError {
22✔
3386
        eopts := parseOpts(opts)
22✔
3387
        if ae, ok := eopts.err.(*ApiError); ok {
22✔
3388
                return ae
×
3389
        }
×
3390

3391
        return ApiErrors[JSStreamWrongLastSequenceConstantErr]
22✔
3392
}
3393

3394
// NewJSStreamWrongLastSequenceError creates a new JSStreamWrongLastSequenceErrF error: "wrong last sequence: {seq}"
3395
func NewJSStreamWrongLastSequenceError(seq uint64, opts ...ErrorOption) *ApiError {
123✔
3396
        eopts := parseOpts(opts)
123✔
3397
        if ae, ok := eopts.err.(*ApiError); ok {
123✔
3398
                return ae
×
3399
        }
×
3400

3401
        e := ApiErrors[JSStreamWrongLastSequenceErrF]
123✔
3402
        args := e.toReplacerArgs([]interface{}{"{seq}", seq})
123✔
3403
        return &ApiError{
123✔
3404
                Code:        e.Code,
123✔
3405
                ErrCode:     e.ErrCode,
123✔
3406
                Description: strings.NewReplacer(args...).Replace(e.Description),
123✔
3407
        }
123✔
3408
}
3409

3410
// NewJSTempStorageFailedError creates a new JSTempStorageFailedErr error: "JetStream unable to open temp storage for restore"
3411
func NewJSTempStorageFailedError(opts ...ErrorOption) *ApiError {
×
3412
        eopts := parseOpts(opts)
×
3413
        if ae, ok := eopts.err.(*ApiError); ok {
×
3414
                return ae
×
3415
        }
×
3416

3417
        return ApiErrors[JSTempStorageFailedErr]
×
3418
}
3419

3420
// NewJSTemplateNameNotMatchSubjectError creates a new JSTemplateNameNotMatchSubjectErr error: "template name in subject does not match request"
3421
func NewJSTemplateNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
×
3422
        eopts := parseOpts(opts)
×
3423
        if ae, ok := eopts.err.(*ApiError); ok {
×
3424
                return ae
×
3425
        }
×
3426

3427
        return ApiErrors[JSTemplateNameNotMatchSubjectErr]
×
3428
}
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