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

nats-io / nats-server / 17314866352

28 Aug 2025 03:54PM UTC coverage: 86.062% (+0.08%) from 85.985%
17314866352

push

github

web-flow
Add StaleConnectionStats (#7218)

Adds counters for stale connections similar to slow consumers

```sh
$ curl http://localhost:8222/varz
...
# Total
  "stale_connections": 1,
# Granular per connection
  "stale_connection_stats": {
    "clients": 1,
    "routes": 0,
    "gateways": 0,
    "leafs": 0
  },
```

Signed-off-by: Waldemar Quevedo <wally@nats.io>

73974 of 85954 relevant lines covered (86.06%)

336552.96 hits per line

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

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

3
package server
4

5
import "strings"
6

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

11
        // JSAtomicPublishDisabledErr atomic publish is disabled
12
        JSAtomicPublishDisabledErr ErrorIdentifier = 10174
13

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

212
        // JSConsumerPinnedTTLWithoutPriorityPolicyNone PinnedTTL cannot be set when PriorityPolicy is none
213
        JSConsumerPinnedTTLWithoutPriorityPolicyNone ErrorIdentifier = 10197
214

215
        // JSConsumerPriorityGroupWithPolicyNone consumer can not have priority groups when policy is none
216
        JSConsumerPriorityGroupWithPolicyNone ErrorIdentifier = 10196
217

218
        // JSConsumerPriorityPolicyWithoutGroup Setting PriorityPolicy requires at least one PriorityGroup to be set
219
        JSConsumerPriorityPolicyWithoutGroup ErrorIdentifier = 10159
220

221
        // JSConsumerPullNotDurableErr consumer in pull mode requires a durable name
222
        JSConsumerPullNotDurableErr ErrorIdentifier = 10085
223

224
        // JSConsumerPullRequiresAckErr consumer in pull mode requires explicit ack policy on workqueue stream
225
        JSConsumerPullRequiresAckErr ErrorIdentifier = 10084
226

227
        // JSConsumerPullWithRateLimitErr consumer in pull mode can not have rate limit set
228
        JSConsumerPullWithRateLimitErr ErrorIdentifier = 10086
229

230
        // JSConsumerPushMaxWaitingErr consumer in push mode can not set max waiting
231
        JSConsumerPushMaxWaitingErr ErrorIdentifier = 10080
232

233
        // JSConsumerPushWithPriorityGroupErr priority groups can not be used with push consumers
234
        JSConsumerPushWithPriorityGroupErr ErrorIdentifier = 10178
235

236
        // JSConsumerReplacementWithDifferentNameErr consumer replacement durable config not the same
237
        JSConsumerReplacementWithDifferentNameErr ErrorIdentifier = 10106
238

239
        // JSConsumerReplayPolicyInvalidErr consumer replay policy invalid
240
        JSConsumerReplayPolicyInvalidErr ErrorIdentifier = 10182
241

242
        // JSConsumerReplicasExceedsStream consumer config replica count exceeds parent stream
243
        JSConsumerReplicasExceedsStream ErrorIdentifier = 10126
244

245
        // JSConsumerReplicasShouldMatchStream consumer config replicas must match interest retention stream's replicas
246
        JSConsumerReplicasShouldMatchStream ErrorIdentifier = 10134
247

248
        // JSConsumerSmallHeartbeatErr consumer idle heartbeat needs to be >= 100ms
249
        JSConsumerSmallHeartbeatErr ErrorIdentifier = 10083
250

251
        // JSConsumerStoreFailedErrF error creating store for consumer: {err}
252
        JSConsumerStoreFailedErrF ErrorIdentifier = 10104
253

254
        // JSConsumerWQConsumerNotDeliverAllErr consumer must be deliver all on workqueue stream
255
        JSConsumerWQConsumerNotDeliverAllErr ErrorIdentifier = 10101
256

257
        // JSConsumerWQConsumerNotUniqueErr filtered consumer not unique on workqueue stream
258
        JSConsumerWQConsumerNotUniqueErr ErrorIdentifier = 10100
259

260
        // JSConsumerWQMultipleUnfilteredErr multiple non-filtered consumers not allowed on workqueue stream
261
        JSConsumerWQMultipleUnfilteredErr ErrorIdentifier = 10099
262

263
        // JSConsumerWQRequiresExplicitAckErr workqueue stream requires explicit ack
264
        JSConsumerWQRequiresExplicitAckErr ErrorIdentifier = 10098
265

266
        // JSConsumerWithFlowControlNeedsHeartbeats consumer with flow control also needs heartbeats
267
        JSConsumerWithFlowControlNeedsHeartbeats ErrorIdentifier = 10108
268

269
        // JSInsufficientResourcesErr insufficient resources
270
        JSInsufficientResourcesErr ErrorIdentifier = 10023
271

272
        // JSInvalidJSONErr invalid JSON: {err}
273
        JSInvalidJSONErr ErrorIdentifier = 10025
274

275
        // JSMaximumConsumersLimitErr maximum consumers limit reached
276
        JSMaximumConsumersLimitErr ErrorIdentifier = 10026
277

278
        // JSMaximumStreamsLimitErr maximum number of streams reached
279
        JSMaximumStreamsLimitErr ErrorIdentifier = 10027
280

281
        // JSMemoryResourcesExceededErr insufficient memory resources available
282
        JSMemoryResourcesExceededErr ErrorIdentifier = 10028
283

284
        // JSMessageCounterBrokenErr message counter is broken
285
        JSMessageCounterBrokenErr ErrorIdentifier = 10172
286

287
        // JSMessageIncrDisabledErr message counters is disabled
288
        JSMessageIncrDisabledErr ErrorIdentifier = 10168
289

290
        // JSMessageIncrInvalidErr message counter increment is invalid
291
        JSMessageIncrInvalidErr ErrorIdentifier = 10171
292

293
        // JSMessageIncrMissingErr message counter increment is missing
294
        JSMessageIncrMissingErr ErrorIdentifier = 10169
295

296
        // JSMessageIncrPayloadErr message counter has payload
297
        JSMessageIncrPayloadErr ErrorIdentifier = 10170
298

299
        // JSMessageSchedulesDisabledErr message schedules is disabled
300
        JSMessageSchedulesDisabledErr ErrorIdentifier = 10188
301

302
        // JSMessageSchedulesPatternInvalidErr message schedules pattern is invalid
303
        JSMessageSchedulesPatternInvalidErr ErrorIdentifier = 10189
304

305
        // JSMessageSchedulesRollupInvalidErr message schedules invalid rollup
306
        JSMessageSchedulesRollupInvalidErr ErrorIdentifier = 10192
307

308
        // JSMessageSchedulesTTLInvalidErr message schedules invalid per-message TTL
309
        JSMessageSchedulesTTLInvalidErr ErrorIdentifier = 10191
310

311
        // JSMessageSchedulesTargetInvalidErr message schedules target is invalid
312
        JSMessageSchedulesTargetInvalidErr ErrorIdentifier = 10190
313

314
        // JSMessageTTLDisabledErr per-message TTL is disabled
315
        JSMessageTTLDisabledErr ErrorIdentifier = 10166
316

317
        // JSMessageTTLInvalidErr invalid per-message TTL
318
        JSMessageTTLInvalidErr ErrorIdentifier = 10165
319

320
        // JSMirrorConsumerSetupFailedErrF generic mirror consumer setup failure string ({err})
321
        JSMirrorConsumerSetupFailedErrF ErrorIdentifier = 10029
322

323
        // JSMirrorInvalidStreamName mirrored stream name is invalid
324
        JSMirrorInvalidStreamName ErrorIdentifier = 10142
325

326
        // JSMirrorInvalidSubjectFilter mirror transform source: {err}
327
        JSMirrorInvalidSubjectFilter ErrorIdentifier = 10151
328

329
        // JSMirrorInvalidTransformDestination mirror transform: {err}
330
        JSMirrorInvalidTransformDestination ErrorIdentifier = 10154
331

332
        // JSMirrorMaxMessageSizeTooBigErr stream mirror must have max message size >= source
333
        JSMirrorMaxMessageSizeTooBigErr ErrorIdentifier = 10030
334

335
        // JSMirrorMultipleFiltersNotAllowed mirror with multiple subject transforms cannot also have a single subject filter
336
        JSMirrorMultipleFiltersNotAllowed ErrorIdentifier = 10150
337

338
        // JSMirrorOverlappingSubjectFilters mirror subject filters can not overlap
339
        JSMirrorOverlappingSubjectFilters ErrorIdentifier = 10152
340

341
        // JSMirrorWithCountersErr stream mirrors can not also calculate counters
342
        JSMirrorWithCountersErr ErrorIdentifier = 10173
343

344
        // JSMirrorWithFirstSeqErr stream mirrors can not have first sequence configured
345
        JSMirrorWithFirstSeqErr ErrorIdentifier = 10143
346

347
        // JSMirrorWithMsgSchedulesErr stream mirrors can not also schedule messages
348
        JSMirrorWithMsgSchedulesErr ErrorIdentifier = 10186
349

350
        // JSMirrorWithSourcesErr stream mirrors can not also contain other sources
351
        JSMirrorWithSourcesErr ErrorIdentifier = 10031
352

353
        // JSMirrorWithStartSeqAndTimeErr stream mirrors can not have both start seq and start time configured
354
        JSMirrorWithStartSeqAndTimeErr ErrorIdentifier = 10032
355

356
        // JSMirrorWithSubjectFiltersErr stream mirrors can not contain filtered subjects
357
        JSMirrorWithSubjectFiltersErr ErrorIdentifier = 10033
358

359
        // JSMirrorWithSubjectsErr stream mirrors can not contain subjects
360
        JSMirrorWithSubjectsErr ErrorIdentifier = 10034
361

362
        // JSNoAccountErr account not found
363
        JSNoAccountErr ErrorIdentifier = 10035
364

365
        // JSNoLimitsErr no JetStream default or applicable tiered limit present
366
        JSNoLimitsErr ErrorIdentifier = 10120
367

368
        // JSNoMessageFoundErr no message found
369
        JSNoMessageFoundErr ErrorIdentifier = 10037
370

371
        // JSNotEmptyRequestErr expected an empty request payload
372
        JSNotEmptyRequestErr ErrorIdentifier = 10038
373

374
        // JSNotEnabledErr JetStream not enabled
375
        JSNotEnabledErr ErrorIdentifier = 10076
376

377
        // JSNotEnabledForAccountErr JetStream not enabled for account
378
        JSNotEnabledForAccountErr ErrorIdentifier = 10039
379

380
        // JSPedanticErrF pedantic mode: {err}
381
        JSPedanticErrF ErrorIdentifier = 10157
382

383
        // JSPeerRemapErr peer remap failed
384
        JSPeerRemapErr ErrorIdentifier = 10075
385

386
        // JSRaftGeneralErrF General RAFT error string ({err})
387
        JSRaftGeneralErrF ErrorIdentifier = 10041
388

389
        // JSReplicasCountCannotBeNegative replicas count cannot be negative
390
        JSReplicasCountCannotBeNegative ErrorIdentifier = 10133
391

392
        // JSRequiredApiLevelErr JetStream minimum api level required
393
        JSRequiredApiLevelErr ErrorIdentifier = 10185
394

395
        // JSRestoreSubscribeFailedErrF JetStream unable to subscribe to restore snapshot {subject}: {err}
396
        JSRestoreSubscribeFailedErrF ErrorIdentifier = 10042
397

398
        // JSSequenceNotFoundErrF sequence {seq} not found
399
        JSSequenceNotFoundErrF ErrorIdentifier = 10043
400

401
        // JSSnapshotDeliverSubjectInvalidErr deliver subject not valid
402
        JSSnapshotDeliverSubjectInvalidErr ErrorIdentifier = 10015
403

404
        // JSSourceConsumerSetupFailedErrF General source consumer setup failure string ({err})
405
        JSSourceConsumerSetupFailedErrF ErrorIdentifier = 10045
406

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

410
        // JSSourceInvalidStreamName sourced stream name is invalid
411
        JSSourceInvalidStreamName ErrorIdentifier = 10141
412

413
        // JSSourceInvalidSubjectFilter source transform source: {err}
414
        JSSourceInvalidSubjectFilter ErrorIdentifier = 10145
415

416
        // JSSourceInvalidTransformDestination source transform: {err}
417
        JSSourceInvalidTransformDestination ErrorIdentifier = 10146
418

419
        // JSSourceMaxMessageSizeTooBigErr stream source must have max message size >= target
420
        JSSourceMaxMessageSizeTooBigErr ErrorIdentifier = 10046
421

422
        // JSSourceMultipleFiltersNotAllowed source with multiple subject transforms cannot also have a single subject filter
423
        JSSourceMultipleFiltersNotAllowed ErrorIdentifier = 10144
424

425
        // JSSourceOverlappingSubjectFilters source filters can not overlap
426
        JSSourceOverlappingSubjectFilters ErrorIdentifier = 10147
427

428
        // JSSourceWithMsgSchedulesErr stream source can not also schedule messages
429
        JSSourceWithMsgSchedulesErr ErrorIdentifier = 10187
430

431
        // JSStorageResourcesExceededErr insufficient storage resources available
432
        JSStorageResourcesExceededErr ErrorIdentifier = 10047
433

434
        // JSStreamAssignmentErrF Generic stream assignment error string ({err})
435
        JSStreamAssignmentErrF ErrorIdentifier = 10048
436

437
        // JSStreamCreateErrF Generic stream creation error string ({err})
438
        JSStreamCreateErrF ErrorIdentifier = 10049
439

440
        // JSStreamDeleteErrF General stream deletion error string ({err})
441
        JSStreamDeleteErrF ErrorIdentifier = 10050
442

443
        // JSStreamDuplicateMessageConflict duplicate message id is in process
444
        JSStreamDuplicateMessageConflict ErrorIdentifier = 10158
445

446
        // JSStreamExpectedLastSeqPerSubjectInvalid missing sequence for expected last sequence per subject
447
        JSStreamExpectedLastSeqPerSubjectInvalid ErrorIdentifier = 10193
448

449
        // JSStreamExpectedLastSeqPerSubjectNotReady expected last sequence per subject temporarily unavailable
450
        JSStreamExpectedLastSeqPerSubjectNotReady ErrorIdentifier = 10163
451

452
        // JSStreamExternalApiOverlapErrF stream external api prefix {prefix} must not overlap with {subject}
453
        JSStreamExternalApiOverlapErrF ErrorIdentifier = 10021
454

455
        // JSStreamExternalDelPrefixOverlapsErrF stream external delivery prefix {prefix} overlaps with stream subject {subject}
456
        JSStreamExternalDelPrefixOverlapsErrF ErrorIdentifier = 10022
457

458
        // JSStreamGeneralErrorF General stream failure string ({err})
459
        JSStreamGeneralErrorF ErrorIdentifier = 10051
460

461
        // JSStreamHeaderExceedsMaximumErr header size exceeds maximum allowed of 64k
462
        JSStreamHeaderExceedsMaximumErr ErrorIdentifier = 10097
463

464
        // JSStreamInfoMaxSubjectsErr subject details would exceed maximum allowed
465
        JSStreamInfoMaxSubjectsErr ErrorIdentifier = 10117
466

467
        // JSStreamInvalidConfigF Stream configuration validation error string ({err})
468
        JSStreamInvalidConfigF ErrorIdentifier = 10052
469

470
        // JSStreamInvalidErr stream not valid
471
        JSStreamInvalidErr ErrorIdentifier = 10096
472

473
        // JSStreamInvalidExternalDeliverySubjErrF stream external delivery prefix {prefix} must not contain wildcards
474
        JSStreamInvalidExternalDeliverySubjErrF ErrorIdentifier = 10024
475

476
        // JSStreamLimitsErrF General stream limits exceeded error string ({err})
477
        JSStreamLimitsErrF ErrorIdentifier = 10053
478

479
        // JSStreamMaxBytesRequired account requires a stream config to have max bytes set
480
        JSStreamMaxBytesRequired ErrorIdentifier = 10113
481

482
        // JSStreamMaxStreamBytesExceeded stream max bytes exceeds account limit max stream bytes
483
        JSStreamMaxStreamBytesExceeded ErrorIdentifier = 10122
484

485
        // JSStreamMessageExceedsMaximumErr message size exceeds maximum allowed
486
        JSStreamMessageExceedsMaximumErr ErrorIdentifier = 10054
487

488
        // JSStreamMinLastSeqErr min last sequence
489
        JSStreamMinLastSeqErr ErrorIdentifier = 10180
490

491
        // JSStreamMirrorNotUpdatableErr stream mirror configuration can not be updated
492
        JSStreamMirrorNotUpdatableErr ErrorIdentifier = 10055
493

494
        // JSStreamMismatchErr stream name in subject does not match request
495
        JSStreamMismatchErr ErrorIdentifier = 10056
496

497
        // JSStreamMoveAndScaleErr can not move and scale a stream in a single update
498
        JSStreamMoveAndScaleErr ErrorIdentifier = 10123
499

500
        // JSStreamMoveInProgressF stream move already in progress: {msg}
501
        JSStreamMoveInProgressF ErrorIdentifier = 10124
502

503
        // JSStreamMoveNotInProgress stream move not in progress
504
        JSStreamMoveNotInProgress ErrorIdentifier = 10129
505

506
        // JSStreamMsgDeleteFailedF Generic message deletion failure error string ({err})
507
        JSStreamMsgDeleteFailedF ErrorIdentifier = 10057
508

509
        // JSStreamNameContainsPathSeparatorsErr Stream name can not contain path separators
510
        JSStreamNameContainsPathSeparatorsErr ErrorIdentifier = 10128
511

512
        // JSStreamNameExistErr stream name already in use with a different configuration
513
        JSStreamNameExistErr ErrorIdentifier = 10058
514

515
        // JSStreamNameExistRestoreFailedErr stream name already in use, cannot restore
516
        JSStreamNameExistRestoreFailedErr ErrorIdentifier = 10130
517

518
        // JSStreamNotFoundErr stream not found
519
        JSStreamNotFoundErr ErrorIdentifier = 10059
520

521
        // JSStreamNotMatchErr expected stream does not match
522
        JSStreamNotMatchErr ErrorIdentifier = 10060
523

524
        // JSStreamOfflineErr stream is offline
525
        JSStreamOfflineErr ErrorIdentifier = 10118
526

527
        // JSStreamOfflineReasonErrF stream is offline: {err}
528
        JSStreamOfflineReasonErrF ErrorIdentifier = 10194
529

530
        // JSStreamPurgeFailedF Generic stream purge failure error string ({err})
531
        JSStreamPurgeFailedF ErrorIdentifier = 10110
532

533
        // JSStreamReplicasNotSupportedErr replicas > 1 not supported in non-clustered mode
534
        JSStreamReplicasNotSupportedErr ErrorIdentifier = 10074
535

536
        // JSStreamReplicasNotUpdatableErr Replicas configuration can not be updated
537
        JSStreamReplicasNotUpdatableErr ErrorIdentifier = 10061
538

539
        // JSStreamRestoreErrF restore failed: {err}
540
        JSStreamRestoreErrF ErrorIdentifier = 10062
541

542
        // JSStreamRollupFailedF Generic stream rollup failure error string ({err})
543
        JSStreamRollupFailedF ErrorIdentifier = 10111
544

545
        // JSStreamSealedErr invalid operation on sealed stream
546
        JSStreamSealedErr ErrorIdentifier = 10109
547

548
        // JSStreamSequenceNotMatchErr expected stream sequence does not match
549
        JSStreamSequenceNotMatchErr ErrorIdentifier = 10063
550

551
        // JSStreamSnapshotErrF snapshot failed: {err}
552
        JSStreamSnapshotErrF ErrorIdentifier = 10064
553

554
        // JSStreamStoreFailedF Generic error when storing a message failed ({err})
555
        JSStreamStoreFailedF ErrorIdentifier = 10077
556

557
        // JSStreamSubjectOverlapErr subjects overlap with an existing stream
558
        JSStreamSubjectOverlapErr ErrorIdentifier = 10065
559

560
        // JSStreamTemplateCreateErrF Generic template creation failed string ({err})
561
        JSStreamTemplateCreateErrF ErrorIdentifier = 10066
562

563
        // JSStreamTemplateDeleteErrF Generic stream template deletion failed error string ({err})
564
        JSStreamTemplateDeleteErrF ErrorIdentifier = 10067
565

566
        // JSStreamTemplateNotFoundErr template not found
567
        JSStreamTemplateNotFoundErr ErrorIdentifier = 10068
568

569
        // JSStreamTooManyRequests too many requests
570
        JSStreamTooManyRequests ErrorIdentifier = 10167
571

572
        // JSStreamTransformInvalidDestination stream transform: {err}
573
        JSStreamTransformInvalidDestination ErrorIdentifier = 10156
574

575
        // JSStreamTransformInvalidSource stream transform source: {err}
576
        JSStreamTransformInvalidSource ErrorIdentifier = 10155
577

578
        // JSStreamUpdateErrF Generic stream update error string ({err})
579
        JSStreamUpdateErrF ErrorIdentifier = 10069
580

581
        // JSStreamWrongLastMsgIDErrF wrong last msg ID: {id}
582
        JSStreamWrongLastMsgIDErrF ErrorIdentifier = 10070
583

584
        // JSStreamWrongLastSequenceConstantErr wrong last sequence
585
        JSStreamWrongLastSequenceConstantErr ErrorIdentifier = 10164
586

587
        // JSStreamWrongLastSequenceErrF wrong last sequence: {seq}
588
        JSStreamWrongLastSequenceErrF ErrorIdentifier = 10071
589

590
        // JSTempStorageFailedErr JetStream unable to open temp storage for restore
591
        JSTempStorageFailedErr ErrorIdentifier = 10072
592

593
        // JSTemplateNameNotMatchSubjectErr template name in subject does not match request
594
        JSTemplateNameNotMatchSubjectErr ErrorIdentifier = 10073
595
)
596

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

820
// NewJSAccountResourcesExceededError creates a new JSAccountResourcesExceededErr error: "resource limits exceeded for account"
821
func NewJSAccountResourcesExceededError(opts ...ErrorOption) *ApiError {
20,057✔
822
        eopts := parseOpts(opts)
20,057✔
823
        if ae, ok := eopts.err.(*ApiError); ok {
20,057✔
824
                return ae
×
825
        }
×
826

827
        return ApiErrors[JSAccountResourcesExceededErr]
20,057✔
828
}
829

830
// NewJSAtomicPublishDisabledError creates a new JSAtomicPublishDisabledErr error: "atomic publish is disabled"
831
func NewJSAtomicPublishDisabledError(opts ...ErrorOption) *ApiError {
24✔
832
        eopts := parseOpts(opts)
24✔
833
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
834
                return ae
×
835
        }
×
836

837
        return ApiErrors[JSAtomicPublishDisabledErr]
24✔
838
}
839

840
// NewJSAtomicPublishIncompleteBatchError creates a new JSAtomicPublishIncompleteBatchErr error: "atomic publish batch is incomplete"
841
func NewJSAtomicPublishIncompleteBatchError(opts ...ErrorOption) *ApiError {
64✔
842
        eopts := parseOpts(opts)
64✔
843
        if ae, ok := eopts.err.(*ApiError); ok {
64✔
844
                return ae
×
845
        }
×
846

847
        return ApiErrors[JSAtomicPublishIncompleteBatchErr]
64✔
848
}
849

850
// NewJSAtomicPublishInvalidBatchIDError creates a new JSAtomicPublishInvalidBatchIDErr error: "atomic publish batch ID is invalid"
851
func NewJSAtomicPublishInvalidBatchIDError(opts ...ErrorOption) *ApiError {
4✔
852
        eopts := parseOpts(opts)
4✔
853
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
854
                return ae
×
855
        }
×
856

857
        return ApiErrors[JSAtomicPublishInvalidBatchIDErr]
4✔
858
}
859

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

867
        return ApiErrors[JSAtomicPublishMissingSeqErr]
24✔
868
}
869

870
// NewJSAtomicPublishUnsupportedHeaderBatchError creates a new JSAtomicPublishUnsupportedHeaderBatchErr error: "atomic publish unsupported header used: {header}"
871
func NewJSAtomicPublishUnsupportedHeaderBatchError(header interface{}, opts ...ErrorOption) *ApiError {
32✔
872
        eopts := parseOpts(opts)
32✔
873
        if ae, ok := eopts.err.(*ApiError); ok {
32✔
874
                return ae
×
875
        }
×
876

877
        e := ApiErrors[JSAtomicPublishUnsupportedHeaderBatchErr]
32✔
878
        args := e.toReplacerArgs([]interface{}{"{header}", header})
32✔
879
        return &ApiError{
32✔
880
                Code:        e.Code,
32✔
881
                ErrCode:     e.ErrCode,
32✔
882
                Description: strings.NewReplacer(args...).Replace(e.Description),
32✔
883
        }
32✔
884
}
885

886
// NewJSBadRequestError creates a new JSBadRequestErr error: "bad request"
887
func NewJSBadRequestError(opts ...ErrorOption) *ApiError {
10✔
888
        eopts := parseOpts(opts)
10✔
889
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
890
                return ae
×
891
        }
×
892

893
        return ApiErrors[JSBadRequestErr]
10✔
894
}
895

896
// NewJSClusterIncompleteError creates a new JSClusterIncompleteErr error: "incomplete results"
897
func NewJSClusterIncompleteError(opts ...ErrorOption) *ApiError {
×
898
        eopts := parseOpts(opts)
×
899
        if ae, ok := eopts.err.(*ApiError); ok {
×
900
                return ae
×
901
        }
×
902

903
        return ApiErrors[JSClusterIncompleteErr]
×
904
}
905

906
// NewJSClusterNoPeersError creates a new JSClusterNoPeersErrF error: "{err}"
907
func NewJSClusterNoPeersError(err error, opts ...ErrorOption) *ApiError {
59✔
908
        eopts := parseOpts(opts)
59✔
909
        if ae, ok := eopts.err.(*ApiError); ok {
59✔
910
                return ae
×
911
        }
×
912

913
        e := ApiErrors[JSClusterNoPeersErrF]
59✔
914
        args := e.toReplacerArgs([]interface{}{"{err}", err})
59✔
915
        return &ApiError{
59✔
916
                Code:        e.Code,
59✔
917
                ErrCode:     e.ErrCode,
59✔
918
                Description: strings.NewReplacer(args...).Replace(e.Description),
59✔
919
        }
59✔
920
}
921

922
// NewJSClusterNotActiveError creates a new JSClusterNotActiveErr error: "JetStream not in clustered mode"
923
func NewJSClusterNotActiveError(opts ...ErrorOption) *ApiError {
1✔
924
        eopts := parseOpts(opts)
1✔
925
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
926
                return ae
×
927
        }
×
928

929
        return ApiErrors[JSClusterNotActiveErr]
1✔
930
}
931

932
// NewJSClusterNotAssignedError creates a new JSClusterNotAssignedErr error: "JetStream cluster not assigned to this server"
933
func NewJSClusterNotAssignedError(opts ...ErrorOption) *ApiError {
30✔
934
        eopts := parseOpts(opts)
30✔
935
        if ae, ok := eopts.err.(*ApiError); ok {
30✔
936
                return ae
×
937
        }
×
938

939
        return ApiErrors[JSClusterNotAssignedErr]
30✔
940
}
941

942
// NewJSClusterNotAvailError creates a new JSClusterNotAvailErr error: "JetStream system temporarily unavailable"
943
func NewJSClusterNotAvailError(opts ...ErrorOption) *ApiError {
13✔
944
        eopts := parseOpts(opts)
13✔
945
        if ae, ok := eopts.err.(*ApiError); ok {
13✔
946
                return ae
×
947
        }
×
948

949
        return ApiErrors[JSClusterNotAvailErr]
13✔
950
}
951

952
// NewJSClusterNotLeaderError creates a new JSClusterNotLeaderErr error: "JetStream cluster can not handle request"
953
func NewJSClusterNotLeaderError(opts ...ErrorOption) *ApiError {
8✔
954
        eopts := parseOpts(opts)
8✔
955
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
956
                return ae
×
957
        }
×
958

959
        return ApiErrors[JSClusterNotLeaderErr]
8✔
960
}
961

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

969
        return ApiErrors[JSClusterPeerNotMemberErr]
1✔
970
}
971

972
// NewJSClusterRequiredError creates a new JSClusterRequiredErr error: "JetStream clustering support required"
973
func NewJSClusterRequiredError(opts ...ErrorOption) *ApiError {
×
974
        eopts := parseOpts(opts)
×
975
        if ae, ok := eopts.err.(*ApiError); ok {
×
976
                return ae
×
977
        }
×
978

979
        return ApiErrors[JSClusterRequiredErr]
×
980
}
981

982
// NewJSClusterServerNotMemberError creates a new JSClusterServerNotMemberErr error: "server is not a member of the cluster"
983
func NewJSClusterServerNotMemberError(opts ...ErrorOption) *ApiError {
3✔
984
        eopts := parseOpts(opts)
3✔
985
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
986
                return ae
×
987
        }
×
988

989
        return ApiErrors[JSClusterServerNotMemberErr]
3✔
990
}
991

992
// NewJSClusterTagsError creates a new JSClusterTagsErr error: "tags placement not supported for operation"
993
func NewJSClusterTagsError(opts ...ErrorOption) *ApiError {
×
994
        eopts := parseOpts(opts)
×
995
        if ae, ok := eopts.err.(*ApiError); ok {
×
996
                return ae
×
997
        }
×
998

999
        return ApiErrors[JSClusterTagsErr]
×
1000
}
1001

1002
// NewJSClusterUnSupportFeatureError creates a new JSClusterUnSupportFeatureErr error: "not currently supported in clustered mode"
1003
func NewJSClusterUnSupportFeatureError(opts ...ErrorOption) *ApiError {
6✔
1004
        eopts := parseOpts(opts)
6✔
1005
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1006
                return ae
×
1007
        }
×
1008

1009
        return ApiErrors[JSClusterUnSupportFeatureErr]
6✔
1010
}
1011

1012
// NewJSConsumerAckPolicyInvalidError creates a new JSConsumerAckPolicyInvalidErr error: "consumer ack policy invalid"
1013
func NewJSConsumerAckPolicyInvalidError(opts ...ErrorOption) *ApiError {
2✔
1014
        eopts := parseOpts(opts)
2✔
1015
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1016
                return ae
×
1017
        }
×
1018

1019
        return ApiErrors[JSConsumerAckPolicyInvalidErr]
2✔
1020
}
1021

1022
// NewJSConsumerAckWaitNegativeError creates a new JSConsumerAckWaitNegativeErr error: "consumer ack wait needs to be positive"
1023
func NewJSConsumerAckWaitNegativeError(opts ...ErrorOption) *ApiError {
2✔
1024
        eopts := parseOpts(opts)
2✔
1025
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1026
                return ae
×
1027
        }
×
1028

1029
        return ApiErrors[JSConsumerAckWaitNegativeErr]
2✔
1030
}
1031

1032
// NewJSConsumerAlreadyExistsError creates a new JSConsumerAlreadyExists error: "consumer already exists"
1033
func NewJSConsumerAlreadyExistsError(opts ...ErrorOption) *ApiError {
5✔
1034
        eopts := parseOpts(opts)
5✔
1035
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
1036
                return ae
×
1037
        }
×
1038

1039
        return ApiErrors[JSConsumerAlreadyExists]
5✔
1040
}
1041

1042
// NewJSConsumerBackOffNegativeError creates a new JSConsumerBackOffNegativeErr error: "consumer backoff needs to be positive"
1043
func NewJSConsumerBackOffNegativeError(opts ...ErrorOption) *ApiError {
2✔
1044
        eopts := parseOpts(opts)
2✔
1045
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1046
                return ae
×
1047
        }
×
1048

1049
        return ApiErrors[JSConsumerBackOffNegativeErr]
2✔
1050
}
1051

1052
// NewJSConsumerBadDurableNameError creates a new JSConsumerBadDurableNameErr error: "durable name can not contain '.', '*', '>'"
1053
func NewJSConsumerBadDurableNameError(opts ...ErrorOption) *ApiError {
×
1054
        eopts := parseOpts(opts)
×
1055
        if ae, ok := eopts.err.(*ApiError); ok {
×
1056
                return ae
×
1057
        }
×
1058

1059
        return ApiErrors[JSConsumerBadDurableNameErr]
×
1060
}
1061

1062
// NewJSConsumerConfigRequiredError creates a new JSConsumerConfigRequiredErr error: "consumer config required"
1063
func NewJSConsumerConfigRequiredError(opts ...ErrorOption) *ApiError {
2✔
1064
        eopts := parseOpts(opts)
2✔
1065
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1066
                return ae
×
1067
        }
×
1068

1069
        return ApiErrors[JSConsumerConfigRequiredErr]
2✔
1070
}
1071

1072
// NewJSConsumerCreateDurableAndNameMismatchError creates a new JSConsumerCreateDurableAndNameMismatch error: "Consumer Durable and Name have to be equal if both are provided"
1073
func NewJSConsumerCreateDurableAndNameMismatchError(opts ...ErrorOption) *ApiError {
1✔
1074
        eopts := parseOpts(opts)
1✔
1075
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1076
                return ae
×
1077
        }
×
1078

1079
        return ApiErrors[JSConsumerCreateDurableAndNameMismatch]
1✔
1080
}
1081

1082
// NewJSConsumerCreateError creates a new JSConsumerCreateErrF error: "{err}"
1083
func NewJSConsumerCreateError(err error, opts ...ErrorOption) *ApiError {
71✔
1084
        eopts := parseOpts(opts)
71✔
1085
        if ae, ok := eopts.err.(*ApiError); ok {
124✔
1086
                return ae
53✔
1087
        }
53✔
1088

1089
        e := ApiErrors[JSConsumerCreateErrF]
18✔
1090
        args := e.toReplacerArgs([]interface{}{"{err}", err})
18✔
1091
        return &ApiError{
18✔
1092
                Code:        e.Code,
18✔
1093
                ErrCode:     e.ErrCode,
18✔
1094
                Description: strings.NewReplacer(args...).Replace(e.Description),
18✔
1095
        }
18✔
1096
}
1097

1098
// NewJSConsumerCreateFilterSubjectMismatchError creates a new JSConsumerCreateFilterSubjectMismatchErr error: "Consumer create request did not match filtered subject from create subject"
1099
func NewJSConsumerCreateFilterSubjectMismatchError(opts ...ErrorOption) *ApiError {
2✔
1100
        eopts := parseOpts(opts)
2✔
1101
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1102
                return ae
×
1103
        }
×
1104

1105
        return ApiErrors[JSConsumerCreateFilterSubjectMismatchErr]
2✔
1106
}
1107

1108
// NewJSConsumerDeliverCycleError creates a new JSConsumerDeliverCycleErr error: "consumer deliver subject forms a cycle"
1109
func NewJSConsumerDeliverCycleError(opts ...ErrorOption) *ApiError {
4✔
1110
        eopts := parseOpts(opts)
4✔
1111
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1112
                return ae
×
1113
        }
×
1114

1115
        return ApiErrors[JSConsumerDeliverCycleErr]
4✔
1116
}
1117

1118
// NewJSConsumerDeliverToWildcardsError creates a new JSConsumerDeliverToWildcardsErr error: "consumer deliver subject has wildcards"
1119
func NewJSConsumerDeliverToWildcardsError(opts ...ErrorOption) *ApiError {
4✔
1120
        eopts := parseOpts(opts)
4✔
1121
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1122
                return ae
×
1123
        }
×
1124

1125
        return ApiErrors[JSConsumerDeliverToWildcardsErr]
4✔
1126
}
1127

1128
// NewJSConsumerDescriptionTooLongError creates a new JSConsumerDescriptionTooLongErrF error: "consumer description is too long, maximum allowed is {max}"
1129
func NewJSConsumerDescriptionTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
1✔
1130
        eopts := parseOpts(opts)
1✔
1131
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1132
                return ae
×
1133
        }
×
1134

1135
        e := ApiErrors[JSConsumerDescriptionTooLongErrF]
1✔
1136
        args := e.toReplacerArgs([]interface{}{"{max}", max})
1✔
1137
        return &ApiError{
1✔
1138
                Code:        e.Code,
1✔
1139
                ErrCode:     e.ErrCode,
1✔
1140
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1141
        }
1✔
1142
}
1143

1144
// NewJSConsumerDirectRequiresEphemeralError creates a new JSConsumerDirectRequiresEphemeralErr error: "consumer direct requires an ephemeral consumer"
1145
func NewJSConsumerDirectRequiresEphemeralError(opts ...ErrorOption) *ApiError {
×
1146
        eopts := parseOpts(opts)
×
1147
        if ae, ok := eopts.err.(*ApiError); ok {
×
1148
                return ae
×
1149
        }
×
1150

1151
        return ApiErrors[JSConsumerDirectRequiresEphemeralErr]
×
1152
}
1153

1154
// NewJSConsumerDirectRequiresPushError creates a new JSConsumerDirectRequiresPushErr error: "consumer direct requires a push based consumer"
1155
func NewJSConsumerDirectRequiresPushError(opts ...ErrorOption) *ApiError {
×
1156
        eopts := parseOpts(opts)
×
1157
        if ae, ok := eopts.err.(*ApiError); ok {
×
1158
                return ae
×
1159
        }
×
1160

1161
        return ApiErrors[JSConsumerDirectRequiresPushErr]
×
1162
}
1163

1164
// NewJSConsumerDoesNotExistError creates a new JSConsumerDoesNotExist error: "consumer does not exist"
1165
func NewJSConsumerDoesNotExistError(opts ...ErrorOption) *ApiError {
3✔
1166
        eopts := parseOpts(opts)
3✔
1167
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1168
                return ae
×
1169
        }
×
1170

1171
        return ApiErrors[JSConsumerDoesNotExist]
3✔
1172
}
1173

1174
// NewJSConsumerDuplicateFilterSubjectsError creates a new JSConsumerDuplicateFilterSubjects error: "consumer cannot have both FilterSubject and FilterSubjects specified"
1175
func NewJSConsumerDuplicateFilterSubjectsError(opts ...ErrorOption) *ApiError {
1✔
1176
        eopts := parseOpts(opts)
1✔
1177
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1178
                return ae
×
1179
        }
×
1180

1181
        return ApiErrors[JSConsumerDuplicateFilterSubjects]
1✔
1182
}
1183

1184
// NewJSConsumerDurableNameNotInSubjectError creates a new JSConsumerDurableNameNotInSubjectErr error: "consumer expected to be durable but no durable name set in subject"
1185
func NewJSConsumerDurableNameNotInSubjectError(opts ...ErrorOption) *ApiError {
×
1186
        eopts := parseOpts(opts)
×
1187
        if ae, ok := eopts.err.(*ApiError); ok {
×
1188
                return ae
×
1189
        }
×
1190

1191
        return ApiErrors[JSConsumerDurableNameNotInSubjectErr]
×
1192
}
1193

1194
// NewJSConsumerDurableNameNotMatchSubjectError creates a new JSConsumerDurableNameNotMatchSubjectErr error: "consumer name in subject does not match durable name in request"
1195
func NewJSConsumerDurableNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
×
1196
        eopts := parseOpts(opts)
×
1197
        if ae, ok := eopts.err.(*ApiError); ok {
×
1198
                return ae
×
1199
        }
×
1200

1201
        return ApiErrors[JSConsumerDurableNameNotMatchSubjectErr]
×
1202
}
1203

1204
// NewJSConsumerDurableNameNotSetError creates a new JSConsumerDurableNameNotSetErr error: "consumer expected to be durable but a durable name was not set"
1205
func NewJSConsumerDurableNameNotSetError(opts ...ErrorOption) *ApiError {
1✔
1206
        eopts := parseOpts(opts)
1✔
1207
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1208
                return ae
×
1209
        }
×
1210

1211
        return ApiErrors[JSConsumerDurableNameNotSetErr]
1✔
1212
}
1213

1214
// NewJSConsumerEmptyFilterError creates a new JSConsumerEmptyFilter error: "consumer filter in FilterSubjects cannot be empty"
1215
func NewJSConsumerEmptyFilterError(opts ...ErrorOption) *ApiError {
1✔
1216
        eopts := parseOpts(opts)
1✔
1217
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1218
                return ae
×
1219
        }
×
1220

1221
        return ApiErrors[JSConsumerEmptyFilter]
1✔
1222
}
1223

1224
// NewJSConsumerEmptyGroupNameError creates a new JSConsumerEmptyGroupName error: "Group name cannot be an empty string"
1225
func NewJSConsumerEmptyGroupNameError(opts ...ErrorOption) *ApiError {
4✔
1226
        eopts := parseOpts(opts)
4✔
1227
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1228
                return ae
×
1229
        }
×
1230

1231
        return ApiErrors[JSConsumerEmptyGroupName]
4✔
1232
}
1233

1234
// NewJSConsumerEphemeralWithDurableInSubjectError creates a new JSConsumerEphemeralWithDurableInSubjectErr error: "consumer expected to be ephemeral but detected a durable name set in subject"
1235
func NewJSConsumerEphemeralWithDurableInSubjectError(opts ...ErrorOption) *ApiError {
×
1236
        eopts := parseOpts(opts)
×
1237
        if ae, ok := eopts.err.(*ApiError); ok {
×
1238
                return ae
×
1239
        }
×
1240

1241
        return ApiErrors[JSConsumerEphemeralWithDurableInSubjectErr]
×
1242
}
1243

1244
// NewJSConsumerEphemeralWithDurableNameError creates a new JSConsumerEphemeralWithDurableNameErr error: "consumer expected to be ephemeral but a durable name was set in request"
1245
func NewJSConsumerEphemeralWithDurableNameError(opts ...ErrorOption) *ApiError {
3✔
1246
        eopts := parseOpts(opts)
3✔
1247
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1248
                return ae
×
1249
        }
×
1250

1251
        return ApiErrors[JSConsumerEphemeralWithDurableNameErr]
3✔
1252
}
1253

1254
// NewJSConsumerExistingActiveError creates a new JSConsumerExistingActiveErr error: "consumer already exists and is still active"
1255
func NewJSConsumerExistingActiveError(opts ...ErrorOption) *ApiError {
×
1256
        eopts := parseOpts(opts)
×
1257
        if ae, ok := eopts.err.(*ApiError); ok {
×
1258
                return ae
×
1259
        }
×
1260

1261
        return ApiErrors[JSConsumerExistingActiveErr]
×
1262
}
1263

1264
// NewJSConsumerFCRequiresPushError creates a new JSConsumerFCRequiresPushErr error: "consumer flow control requires a push based consumer"
1265
func NewJSConsumerFCRequiresPushError(opts ...ErrorOption) *ApiError {
×
1266
        eopts := parseOpts(opts)
×
1267
        if ae, ok := eopts.err.(*ApiError); ok {
×
1268
                return ae
×
1269
        }
×
1270

1271
        return ApiErrors[JSConsumerFCRequiresPushErr]
×
1272
}
1273

1274
// NewJSConsumerFilterNotSubsetError creates a new JSConsumerFilterNotSubsetErr error: "consumer filter subject is not a valid subset of the interest subjects"
1275
func NewJSConsumerFilterNotSubsetError(opts ...ErrorOption) *ApiError {
×
1276
        eopts := parseOpts(opts)
×
1277
        if ae, ok := eopts.err.(*ApiError); ok {
×
1278
                return ae
×
1279
        }
×
1280

1281
        return ApiErrors[JSConsumerFilterNotSubsetErr]
×
1282
}
1283

1284
// NewJSConsumerHBRequiresPushError creates a new JSConsumerHBRequiresPushErr error: "consumer idle heartbeat requires a push based consumer"
1285
func NewJSConsumerHBRequiresPushError(opts ...ErrorOption) *ApiError {
×
1286
        eopts := parseOpts(opts)
×
1287
        if ae, ok := eopts.err.(*ApiError); ok {
×
1288
                return ae
×
1289
        }
×
1290

1291
        return ApiErrors[JSConsumerHBRequiresPushErr]
×
1292
}
1293

1294
// NewJSConsumerInactiveThresholdExcessError creates a new JSConsumerInactiveThresholdExcess error: "consumer inactive threshold exceeds system limit of {limit}"
1295
func NewJSConsumerInactiveThresholdExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
2✔
1296
        eopts := parseOpts(opts)
2✔
1297
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1298
                return ae
×
1299
        }
×
1300

1301
        e := ApiErrors[JSConsumerInactiveThresholdExcess]
2✔
1302
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
2✔
1303
        return &ApiError{
2✔
1304
                Code:        e.Code,
2✔
1305
                ErrCode:     e.ErrCode,
2✔
1306
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1307
        }
2✔
1308
}
1309

1310
// NewJSConsumerInvalidDeliverSubjectError creates a new JSConsumerInvalidDeliverSubject error: "invalid push consumer deliver subject"
1311
func NewJSConsumerInvalidDeliverSubjectError(opts ...ErrorOption) *ApiError {
2✔
1312
        eopts := parseOpts(opts)
2✔
1313
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1314
                return ae
×
1315
        }
×
1316

1317
        return ApiErrors[JSConsumerInvalidDeliverSubject]
2✔
1318
}
1319

1320
// NewJSConsumerInvalidGroupNameError creates a new JSConsumerInvalidGroupNameErr error: "Valid priority group name must match A-Z, a-z, 0-9, -_/=)+ and may not exceed 16 characters"
1321
func NewJSConsumerInvalidGroupNameError(opts ...ErrorOption) *ApiError {
4✔
1322
        eopts := parseOpts(opts)
4✔
1323
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1324
                return ae
×
1325
        }
×
1326

1327
        return ApiErrors[JSConsumerInvalidGroupNameErr]
4✔
1328
}
1329

1330
// NewJSConsumerInvalidPolicyError creates a new JSConsumerInvalidPolicyErrF error: "{err}"
1331
func NewJSConsumerInvalidPolicyError(err error, opts ...ErrorOption) *ApiError {
10✔
1332
        eopts := parseOpts(opts)
10✔
1333
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1334
                return ae
×
1335
        }
×
1336

1337
        e := ApiErrors[JSConsumerInvalidPolicyErrF]
10✔
1338
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1339
        return &ApiError{
10✔
1340
                Code:        e.Code,
10✔
1341
                ErrCode:     e.ErrCode,
10✔
1342
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1343
        }
10✔
1344
}
1345

1346
// NewJSConsumerInvalidPriorityGroupError creates a new JSConsumerInvalidPriorityGroupErr error: "Provided priority group does not exist for this consumer"
1347
func NewJSConsumerInvalidPriorityGroupError(opts ...ErrorOption) *ApiError {
2✔
1348
        eopts := parseOpts(opts)
2✔
1349
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1350
                return ae
×
1351
        }
×
1352

1353
        return ApiErrors[JSConsumerInvalidPriorityGroupErr]
2✔
1354
}
1355

1356
// NewJSConsumerInvalidSamplingError creates a new JSConsumerInvalidSamplingErrF error: "failed to parse consumer sampling configuration: {err}"
1357
func NewJSConsumerInvalidSamplingError(err error, opts ...ErrorOption) *ApiError {
×
1358
        eopts := parseOpts(opts)
×
1359
        if ae, ok := eopts.err.(*ApiError); ok {
×
1360
                return ae
×
1361
        }
×
1362

1363
        e := ApiErrors[JSConsumerInvalidSamplingErrF]
×
1364
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1365
        return &ApiError{
×
1366
                Code:        e.Code,
×
1367
                ErrCode:     e.ErrCode,
×
1368
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1369
        }
×
1370
}
1371

1372
// NewJSConsumerMaxDeliverBackoffError creates a new JSConsumerMaxDeliverBackoffErr error: "max deliver is required to be > length of backoff values"
1373
func NewJSConsumerMaxDeliverBackoffError(opts ...ErrorOption) *ApiError {
3✔
1374
        eopts := parseOpts(opts)
3✔
1375
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1376
                return ae
×
1377
        }
×
1378

1379
        return ApiErrors[JSConsumerMaxDeliverBackoffErr]
3✔
1380
}
1381

1382
// NewJSConsumerMaxPendingAckExcessError creates a new JSConsumerMaxPendingAckExcessErrF error: "consumer max ack pending exceeds system limit of {limit}"
1383
func NewJSConsumerMaxPendingAckExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
12✔
1384
        eopts := parseOpts(opts)
12✔
1385
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
1386
                return ae
×
1387
        }
×
1388

1389
        e := ApiErrors[JSConsumerMaxPendingAckExcessErrF]
12✔
1390
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
12✔
1391
        return &ApiError{
12✔
1392
                Code:        e.Code,
12✔
1393
                ErrCode:     e.ErrCode,
12✔
1394
                Description: strings.NewReplacer(args...).Replace(e.Description),
12✔
1395
        }
12✔
1396
}
1397

1398
// NewJSConsumerMaxPendingAckPolicyRequiredError creates a new JSConsumerMaxPendingAckPolicyRequiredErr error: "consumer requires ack policy for max ack pending"
1399
func NewJSConsumerMaxPendingAckPolicyRequiredError(opts ...ErrorOption) *ApiError {
2✔
1400
        eopts := parseOpts(opts)
2✔
1401
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1402
                return ae
×
1403
        }
×
1404

1405
        return ApiErrors[JSConsumerMaxPendingAckPolicyRequiredErr]
2✔
1406
}
1407

1408
// NewJSConsumerMaxRequestBatchExceededError creates a new JSConsumerMaxRequestBatchExceededF error: "consumer max request batch exceeds server limit of {limit}"
1409
func NewJSConsumerMaxRequestBatchExceededError(limit interface{}, opts ...ErrorOption) *ApiError {
4✔
1410
        eopts := parseOpts(opts)
4✔
1411
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1412
                return ae
×
1413
        }
×
1414

1415
        e := ApiErrors[JSConsumerMaxRequestBatchExceededF]
4✔
1416
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
4✔
1417
        return &ApiError{
4✔
1418
                Code:        e.Code,
4✔
1419
                ErrCode:     e.ErrCode,
4✔
1420
                Description: strings.NewReplacer(args...).Replace(e.Description),
4✔
1421
        }
4✔
1422
}
1423

1424
// NewJSConsumerMaxRequestBatchNegativeError creates a new JSConsumerMaxRequestBatchNegativeErr error: "consumer max request batch needs to be > 0"
1425
func NewJSConsumerMaxRequestBatchNegativeError(opts ...ErrorOption) *ApiError {
×
1426
        eopts := parseOpts(opts)
×
1427
        if ae, ok := eopts.err.(*ApiError); ok {
×
1428
                return ae
×
1429
        }
×
1430

1431
        return ApiErrors[JSConsumerMaxRequestBatchNegativeErr]
×
1432
}
1433

1434
// NewJSConsumerMaxRequestExpiresTooSmallError creates a new JSConsumerMaxRequestExpiresTooSmall error: "consumer max request expires needs to be >= 1ms"
1435
func NewJSConsumerMaxRequestExpiresTooSmallError(opts ...ErrorOption) *ApiError {
×
1436
        eopts := parseOpts(opts)
×
1437
        if ae, ok := eopts.err.(*ApiError); ok {
×
1438
                return ae
×
1439
        }
×
1440

1441
        return ApiErrors[JSConsumerMaxRequestExpiresTooSmall]
×
1442
}
1443

1444
// NewJSConsumerMaxWaitingNegativeError creates a new JSConsumerMaxWaitingNegativeErr error: "consumer max waiting needs to be positive"
1445
func NewJSConsumerMaxWaitingNegativeError(opts ...ErrorOption) *ApiError {
×
1446
        eopts := parseOpts(opts)
×
1447
        if ae, ok := eopts.err.(*ApiError); ok {
×
1448
                return ae
×
1449
        }
×
1450

1451
        return ApiErrors[JSConsumerMaxWaitingNegativeErr]
×
1452
}
1453

1454
// NewJSConsumerMetadataLengthError creates a new JSConsumerMetadataLengthErrF error: "consumer metadata exceeds maximum size of {limit}"
1455
func NewJSConsumerMetadataLengthError(limit interface{}, opts ...ErrorOption) *ApiError {
1✔
1456
        eopts := parseOpts(opts)
1✔
1457
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1458
                return ae
×
1459
        }
×
1460

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

1470
// NewJSConsumerMultipleFiltersNotAllowedError creates a new JSConsumerMultipleFiltersNotAllowed error: "consumer with multiple subject filters cannot use subject based API"
1471
func NewJSConsumerMultipleFiltersNotAllowedError(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[JSConsumerMultipleFiltersNotAllowed]
1✔
1478
}
1479

1480
// NewJSConsumerNameContainsPathSeparatorsError creates a new JSConsumerNameContainsPathSeparatorsErr error: "Consumer name can not contain path separators"
1481
func NewJSConsumerNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
8✔
1482
        eopts := parseOpts(opts)
8✔
1483
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1484
                return ae
×
1485
        }
×
1486

1487
        return ApiErrors[JSConsumerNameContainsPathSeparatorsErr]
8✔
1488
}
1489

1490
// NewJSConsumerNameExistError creates a new JSConsumerNameExistErr error: "consumer name already in use"
1491
func NewJSConsumerNameExistError(opts ...ErrorOption) *ApiError {
2✔
1492
        eopts := parseOpts(opts)
2✔
1493
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1494
                return ae
×
1495
        }
×
1496

1497
        return ApiErrors[JSConsumerNameExistErr]
2✔
1498
}
1499

1500
// NewJSConsumerNameTooLongError creates a new JSConsumerNameTooLongErrF error: "consumer name is too long, maximum allowed is {max}"
1501
func NewJSConsumerNameTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
×
1502
        eopts := parseOpts(opts)
×
1503
        if ae, ok := eopts.err.(*ApiError); ok {
×
1504
                return ae
×
1505
        }
×
1506

1507
        e := ApiErrors[JSConsumerNameTooLongErrF]
×
1508
        args := e.toReplacerArgs([]interface{}{"{max}", max})
×
1509
        return &ApiError{
×
1510
                Code:        e.Code,
×
1511
                ErrCode:     e.ErrCode,
×
1512
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1513
        }
×
1514
}
1515

1516
// NewJSConsumerNotFoundError creates a new JSConsumerNotFoundErr error: "consumer not found"
1517
func NewJSConsumerNotFoundError(opts ...ErrorOption) *ApiError {
2,763✔
1518
        eopts := parseOpts(opts)
2,763✔
1519
        if ae, ok := eopts.err.(*ApiError); ok {
2,763✔
1520
                return ae
×
1521
        }
×
1522

1523
        return ApiErrors[JSConsumerNotFoundErr]
2,763✔
1524
}
1525

1526
// NewJSConsumerOfflineError creates a new JSConsumerOfflineErr error: "consumer is offline"
1527
func NewJSConsumerOfflineError(opts ...ErrorOption) *ApiError {
6✔
1528
        eopts := parseOpts(opts)
6✔
1529
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1530
                return ae
×
1531
        }
×
1532

1533
        return ApiErrors[JSConsumerOfflineErr]
6✔
1534
}
1535

1536
// NewJSConsumerOfflineReasonError creates a new JSConsumerOfflineReasonErrF error: "consumer is offline: {err}"
1537
func NewJSConsumerOfflineReasonError(err error, opts ...ErrorOption) *ApiError {
24✔
1538
        eopts := parseOpts(opts)
24✔
1539
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
1540
                return ae
×
1541
        }
×
1542

1543
        e := ApiErrors[JSConsumerOfflineReasonErrF]
24✔
1544
        args := e.toReplacerArgs([]interface{}{"{err}", err})
24✔
1545
        return &ApiError{
24✔
1546
                Code:        e.Code,
24✔
1547
                ErrCode:     e.ErrCode,
24✔
1548
                Description: strings.NewReplacer(args...).Replace(e.Description),
24✔
1549
        }
24✔
1550
}
1551

1552
// NewJSConsumerOnMappedError creates a new JSConsumerOnMappedErr error: "consumer direct on a mapped consumer"
1553
func NewJSConsumerOnMappedError(opts ...ErrorOption) *ApiError {
×
1554
        eopts := parseOpts(opts)
×
1555
        if ae, ok := eopts.err.(*ApiError); ok {
×
1556
                return ae
×
1557
        }
×
1558

1559
        return ApiErrors[JSConsumerOnMappedErr]
×
1560
}
1561

1562
// NewJSConsumerOverlappingSubjectFiltersError creates a new JSConsumerOverlappingSubjectFilters error: "consumer subject filters cannot overlap"
1563
func NewJSConsumerOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
1✔
1564
        eopts := parseOpts(opts)
1✔
1565
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1566
                return ae
×
1567
        }
×
1568

1569
        return ApiErrors[JSConsumerOverlappingSubjectFilters]
1✔
1570
}
1571

1572
// NewJSConsumerPinnedTTLWithoutPriorityPolicyNoneError creates a new JSConsumerPinnedTTLWithoutPriorityPolicyNone error: "PinnedTTL cannot be set when PriorityPolicy is none"
1573
func NewJSConsumerPinnedTTLWithoutPriorityPolicyNoneError(opts ...ErrorOption) *ApiError {
1✔
1574
        eopts := parseOpts(opts)
1✔
1575
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1576
                return ae
×
1577
        }
×
1578

1579
        return ApiErrors[JSConsumerPinnedTTLWithoutPriorityPolicyNone]
1✔
1580
}
1581

1582
// NewJSConsumerPriorityGroupWithPolicyNoneError creates a new JSConsumerPriorityGroupWithPolicyNone error: "consumer can not have priority groups when policy is none"
1583
func NewJSConsumerPriorityGroupWithPolicyNoneError(opts ...ErrorOption) *ApiError {
1✔
1584
        eopts := parseOpts(opts)
1✔
1585
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1586
                return ae
×
1587
        }
×
1588

1589
        return ApiErrors[JSConsumerPriorityGroupWithPolicyNone]
1✔
1590
}
1591

1592
// NewJSConsumerPriorityPolicyWithoutGroupError creates a new JSConsumerPriorityPolicyWithoutGroup error: "Setting PriorityPolicy requires at least one PriorityGroup to be set"
1593
func NewJSConsumerPriorityPolicyWithoutGroupError(opts ...ErrorOption) *ApiError {
4✔
1594
        eopts := parseOpts(opts)
4✔
1595
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1596
                return ae
×
1597
        }
×
1598

1599
        return ApiErrors[JSConsumerPriorityPolicyWithoutGroup]
4✔
1600
}
1601

1602
// NewJSConsumerPullNotDurableError creates a new JSConsumerPullNotDurableErr error: "consumer in pull mode requires a durable name"
1603
func NewJSConsumerPullNotDurableError(opts ...ErrorOption) *ApiError {
×
1604
        eopts := parseOpts(opts)
×
1605
        if ae, ok := eopts.err.(*ApiError); ok {
×
1606
                return ae
×
1607
        }
×
1608

1609
        return ApiErrors[JSConsumerPullNotDurableErr]
×
1610
}
1611

1612
// NewJSConsumerPullRequiresAckError creates a new JSConsumerPullRequiresAckErr error: "consumer in pull mode requires explicit ack policy on workqueue stream"
1613
func NewJSConsumerPullRequiresAckError(opts ...ErrorOption) *ApiError {
6✔
1614
        eopts := parseOpts(opts)
6✔
1615
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1616
                return ae
×
1617
        }
×
1618

1619
        return ApiErrors[JSConsumerPullRequiresAckErr]
6✔
1620
}
1621

1622
// NewJSConsumerPullWithRateLimitError creates a new JSConsumerPullWithRateLimitErr error: "consumer in pull mode can not have rate limit set"
1623
func NewJSConsumerPullWithRateLimitError(opts ...ErrorOption) *ApiError {
1✔
1624
        eopts := parseOpts(opts)
1✔
1625
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1626
                return ae
×
1627
        }
×
1628

1629
        return ApiErrors[JSConsumerPullWithRateLimitErr]
1✔
1630
}
1631

1632
// NewJSConsumerPushMaxWaitingError creates a new JSConsumerPushMaxWaitingErr error: "consumer in push mode can not set max waiting"
1633
func NewJSConsumerPushMaxWaitingError(opts ...ErrorOption) *ApiError {
3✔
1634
        eopts := parseOpts(opts)
3✔
1635
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1636
                return ae
×
1637
        }
×
1638

1639
        return ApiErrors[JSConsumerPushMaxWaitingErr]
3✔
1640
}
1641

1642
// NewJSConsumerPushWithPriorityGroupError creates a new JSConsumerPushWithPriorityGroupErr error: "priority groups can not be used with push consumers"
1643
func NewJSConsumerPushWithPriorityGroupError(opts ...ErrorOption) *ApiError {
1✔
1644
        eopts := parseOpts(opts)
1✔
1645
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1646
                return ae
×
1647
        }
×
1648

1649
        return ApiErrors[JSConsumerPushWithPriorityGroupErr]
1✔
1650
}
1651

1652
// NewJSConsumerReplacementWithDifferentNameError creates a new JSConsumerReplacementWithDifferentNameErr error: "consumer replacement durable config not the same"
1653
func NewJSConsumerReplacementWithDifferentNameError(opts ...ErrorOption) *ApiError {
×
1654
        eopts := parseOpts(opts)
×
1655
        if ae, ok := eopts.err.(*ApiError); ok {
×
1656
                return ae
×
1657
        }
×
1658

1659
        return ApiErrors[JSConsumerReplacementWithDifferentNameErr]
×
1660
}
1661

1662
// NewJSConsumerReplayPolicyInvalidError creates a new JSConsumerReplayPolicyInvalidErr error: "consumer replay policy invalid"
1663
func NewJSConsumerReplayPolicyInvalidError(opts ...ErrorOption) *ApiError {
2✔
1664
        eopts := parseOpts(opts)
2✔
1665
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1666
                return ae
×
1667
        }
×
1668

1669
        return ApiErrors[JSConsumerReplayPolicyInvalidErr]
2✔
1670
}
1671

1672
// NewJSConsumerReplicasExceedsStreamError creates a new JSConsumerReplicasExceedsStream error: "consumer config replica count exceeds parent stream"
1673
func NewJSConsumerReplicasExceedsStreamError(opts ...ErrorOption) *ApiError {
1✔
1674
        eopts := parseOpts(opts)
1✔
1675
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1676
                return ae
×
1677
        }
×
1678

1679
        return ApiErrors[JSConsumerReplicasExceedsStream]
1✔
1680
}
1681

1682
// NewJSConsumerReplicasShouldMatchStreamError creates a new JSConsumerReplicasShouldMatchStream error: "consumer config replicas must match interest retention stream's replicas"
1683
func NewJSConsumerReplicasShouldMatchStreamError(opts ...ErrorOption) *ApiError {
2✔
1684
        eopts := parseOpts(opts)
2✔
1685
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1686
                return ae
×
1687
        }
×
1688

1689
        return ApiErrors[JSConsumerReplicasShouldMatchStream]
2✔
1690
}
1691

1692
// NewJSConsumerSmallHeartbeatError creates a new JSConsumerSmallHeartbeatErr error: "consumer idle heartbeat needs to be >= 100ms"
1693
func NewJSConsumerSmallHeartbeatError(opts ...ErrorOption) *ApiError {
1✔
1694
        eopts := parseOpts(opts)
1✔
1695
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1696
                return ae
×
1697
        }
×
1698

1699
        return ApiErrors[JSConsumerSmallHeartbeatErr]
1✔
1700
}
1701

1702
// NewJSConsumerStoreFailedError creates a new JSConsumerStoreFailedErrF error: "error creating store for consumer: {err}"
1703
func NewJSConsumerStoreFailedError(err error, opts ...ErrorOption) *ApiError {
8✔
1704
        eopts := parseOpts(opts)
8✔
1705
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1706
                return ae
×
1707
        }
×
1708

1709
        e := ApiErrors[JSConsumerStoreFailedErrF]
8✔
1710
        args := e.toReplacerArgs([]interface{}{"{err}", err})
8✔
1711
        return &ApiError{
8✔
1712
                Code:        e.Code,
8✔
1713
                ErrCode:     e.ErrCode,
8✔
1714
                Description: strings.NewReplacer(args...).Replace(e.Description),
8✔
1715
        }
8✔
1716
}
1717

1718
// NewJSConsumerWQConsumerNotDeliverAllError creates a new JSConsumerWQConsumerNotDeliverAllErr error: "consumer must be deliver all on workqueue stream"
1719
func NewJSConsumerWQConsumerNotDeliverAllError(opts ...ErrorOption) *ApiError {
×
1720
        eopts := parseOpts(opts)
×
1721
        if ae, ok := eopts.err.(*ApiError); ok {
×
1722
                return ae
×
1723
        }
×
1724

1725
        return ApiErrors[JSConsumerWQConsumerNotDeliverAllErr]
×
1726
}
1727

1728
// NewJSConsumerWQConsumerNotUniqueError creates a new JSConsumerWQConsumerNotUniqueErr error: "filtered consumer not unique on workqueue stream"
1729
func NewJSConsumerWQConsumerNotUniqueError(opts ...ErrorOption) *ApiError {
11✔
1730
        eopts := parseOpts(opts)
11✔
1731
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
1732
                return ae
×
1733
        }
×
1734

1735
        return ApiErrors[JSConsumerWQConsumerNotUniqueErr]
11✔
1736
}
1737

1738
// NewJSConsumerWQMultipleUnfilteredError creates a new JSConsumerWQMultipleUnfilteredErr error: "multiple non-filtered consumers not allowed on workqueue stream"
1739
func NewJSConsumerWQMultipleUnfilteredError(opts ...ErrorOption) *ApiError {
2✔
1740
        eopts := parseOpts(opts)
2✔
1741
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1742
                return ae
×
1743
        }
×
1744

1745
        return ApiErrors[JSConsumerWQMultipleUnfilteredErr]
2✔
1746
}
1747

1748
// NewJSConsumerWQRequiresExplicitAckError creates a new JSConsumerWQRequiresExplicitAckErr error: "workqueue stream requires explicit ack"
1749
func NewJSConsumerWQRequiresExplicitAckError(opts ...ErrorOption) *ApiError {
×
1750
        eopts := parseOpts(opts)
×
1751
        if ae, ok := eopts.err.(*ApiError); ok {
×
1752
                return ae
×
1753
        }
×
1754

1755
        return ApiErrors[JSConsumerWQRequiresExplicitAckErr]
×
1756
}
1757

1758
// NewJSConsumerWithFlowControlNeedsHeartbeatsError creates a new JSConsumerWithFlowControlNeedsHeartbeats error: "consumer with flow control also needs heartbeats"
1759
func NewJSConsumerWithFlowControlNeedsHeartbeatsError(opts ...ErrorOption) *ApiError {
4✔
1760
        eopts := parseOpts(opts)
4✔
1761
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1762
                return ae
×
1763
        }
×
1764

1765
        return ApiErrors[JSConsumerWithFlowControlNeedsHeartbeats]
4✔
1766
}
1767

1768
// NewJSInsufficientResourcesError creates a new JSInsufficientResourcesErr error: "insufficient resources"
1769
func NewJSInsufficientResourcesError(opts ...ErrorOption) *ApiError {
11✔
1770
        eopts := parseOpts(opts)
11✔
1771
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
1772
                return ae
×
1773
        }
×
1774

1775
        return ApiErrors[JSInsufficientResourcesErr]
11✔
1776
}
1777

1778
// NewJSInvalidJSONError creates a new JSInvalidJSONErr error: "invalid JSON: {err}"
1779
func NewJSInvalidJSONError(err error, opts ...ErrorOption) *ApiError {
10✔
1780
        eopts := parseOpts(opts)
10✔
1781
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1782
                return ae
×
1783
        }
×
1784

1785
        e := ApiErrors[JSInvalidJSONErr]
10✔
1786
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1787
        return &ApiError{
10✔
1788
                Code:        e.Code,
10✔
1789
                ErrCode:     e.ErrCode,
10✔
1790
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1791
        }
10✔
1792
}
1793

1794
// NewJSMaximumConsumersLimitError creates a new JSMaximumConsumersLimitErr error: "maximum consumers limit reached"
1795
func NewJSMaximumConsumersLimitError(opts ...ErrorOption) *ApiError {
29✔
1796
        eopts := parseOpts(opts)
29✔
1797
        if ae, ok := eopts.err.(*ApiError); ok {
29✔
1798
                return ae
×
1799
        }
×
1800

1801
        return ApiErrors[JSMaximumConsumersLimitErr]
29✔
1802
}
1803

1804
// NewJSMaximumStreamsLimitError creates a new JSMaximumStreamsLimitErr error: "maximum number of streams reached"
1805
func NewJSMaximumStreamsLimitError(opts ...ErrorOption) *ApiError {
16✔
1806
        eopts := parseOpts(opts)
16✔
1807
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
1808
                return ae
×
1809
        }
×
1810

1811
        return ApiErrors[JSMaximumStreamsLimitErr]
16✔
1812
}
1813

1814
// NewJSMemoryResourcesExceededError creates a new JSMemoryResourcesExceededErr error: "insufficient memory resources available"
1815
func NewJSMemoryResourcesExceededError(opts ...ErrorOption) *ApiError {
4✔
1816
        eopts := parseOpts(opts)
4✔
1817
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1818
                return ae
×
1819
        }
×
1820

1821
        return ApiErrors[JSMemoryResourcesExceededErr]
4✔
1822
}
1823

1824
// NewJSMessageCounterBrokenError creates a new JSMessageCounterBrokenErr error: "message counter is broken"
1825
func NewJSMessageCounterBrokenError(opts ...ErrorOption) *ApiError {
4✔
1826
        eopts := parseOpts(opts)
4✔
1827
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1828
                return ae
×
1829
        }
×
1830

1831
        return ApiErrors[JSMessageCounterBrokenErr]
4✔
1832
}
1833

1834
// NewJSMessageIncrDisabledError creates a new JSMessageIncrDisabledErr error: "message counters is disabled"
1835
func NewJSMessageIncrDisabledError(opts ...ErrorOption) *ApiError {
4✔
1836
        eopts := parseOpts(opts)
4✔
1837
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1838
                return ae
×
1839
        }
×
1840

1841
        return ApiErrors[JSMessageIncrDisabledErr]
4✔
1842
}
1843

1844
// NewJSMessageIncrInvalidError creates a new JSMessageIncrInvalidErr error: "message counter increment is invalid"
1845
func NewJSMessageIncrInvalidError(opts ...ErrorOption) *ApiError {
24✔
1846
        eopts := parseOpts(opts)
24✔
1847
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
1848
                return ae
×
1849
        }
×
1850

1851
        return ApiErrors[JSMessageIncrInvalidErr]
24✔
1852
}
1853

1854
// NewJSMessageIncrMissingError creates a new JSMessageIncrMissingErr error: "message counter increment is missing"
1855
func NewJSMessageIncrMissingError(opts ...ErrorOption) *ApiError {
8✔
1856
        eopts := parseOpts(opts)
8✔
1857
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1858
                return ae
×
1859
        }
×
1860

1861
        return ApiErrors[JSMessageIncrMissingErr]
8✔
1862
}
1863

1864
// NewJSMessageIncrPayloadError creates a new JSMessageIncrPayloadErr error: "message counter has payload"
1865
func NewJSMessageIncrPayloadError(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[JSMessageIncrPayloadErr]
4✔
1872
}
1873

1874
// NewJSMessageSchedulesDisabledError creates a new JSMessageSchedulesDisabledErr error: "message schedules is disabled"
1875
func NewJSMessageSchedulesDisabledError(opts ...ErrorOption) *ApiError {
20✔
1876
        eopts := parseOpts(opts)
20✔
1877
        if ae, ok := eopts.err.(*ApiError); ok {
20✔
1878
                return ae
×
1879
        }
×
1880

1881
        return ApiErrors[JSMessageSchedulesDisabledErr]
20✔
1882
}
1883

1884
// NewJSMessageSchedulesPatternInvalidError creates a new JSMessageSchedulesPatternInvalidErr error: "message schedules pattern is invalid"
1885
func NewJSMessageSchedulesPatternInvalidError(opts ...ErrorOption) *ApiError {
15✔
1886
        eopts := parseOpts(opts)
15✔
1887
        if ae, ok := eopts.err.(*ApiError); ok {
15✔
1888
                return ae
×
1889
        }
×
1890

1891
        return ApiErrors[JSMessageSchedulesPatternInvalidErr]
15✔
1892
}
1893

1894
// NewJSMessageSchedulesRollupInvalidError creates a new JSMessageSchedulesRollupInvalidErr error: "message schedules invalid rollup"
1895
func NewJSMessageSchedulesRollupInvalidError(opts ...ErrorOption) *ApiError {
8✔
1896
        eopts := parseOpts(opts)
8✔
1897
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1898
                return ae
×
1899
        }
×
1900

1901
        return ApiErrors[JSMessageSchedulesRollupInvalidErr]
8✔
1902
}
1903

1904
// NewJSMessageSchedulesTTLInvalidError creates a new JSMessageSchedulesTTLInvalidErr error: "message schedules invalid per-message TTL"
1905
func NewJSMessageSchedulesTTLInvalidError(opts ...ErrorOption) *ApiError {
10✔
1906
        eopts := parseOpts(opts)
10✔
1907
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1908
                return ae
×
1909
        }
×
1910

1911
        return ApiErrors[JSMessageSchedulesTTLInvalidErr]
10✔
1912
}
1913

1914
// NewJSMessageSchedulesTargetInvalidError creates a new JSMessageSchedulesTargetInvalidErr error: "message schedules target is invalid"
1915
func NewJSMessageSchedulesTargetInvalidError(opts ...ErrorOption) *ApiError {
30✔
1916
        eopts := parseOpts(opts)
30✔
1917
        if ae, ok := eopts.err.(*ApiError); ok {
30✔
1918
                return ae
×
1919
        }
×
1920

1921
        return ApiErrors[JSMessageSchedulesTargetInvalidErr]
30✔
1922
}
1923

1924
// NewJSMessageTTLDisabledError creates a new JSMessageTTLDisabledErr error: "per-message TTL is disabled"
1925
func NewJSMessageTTLDisabledError(opts ...ErrorOption) *ApiError {
16✔
1926
        eopts := parseOpts(opts)
16✔
1927
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
1928
                return ae
×
1929
        }
×
1930

1931
        return ApiErrors[JSMessageTTLDisabledErr]
16✔
1932
}
1933

1934
// NewJSMessageTTLInvalidError creates a new JSMessageTTLInvalidErr error: "invalid per-message TTL"
1935
func NewJSMessageTTLInvalidError(opts ...ErrorOption) *ApiError {
23✔
1936
        eopts := parseOpts(opts)
23✔
1937
        if ae, ok := eopts.err.(*ApiError); ok {
23✔
1938
                return ae
×
1939
        }
×
1940

1941
        return ApiErrors[JSMessageTTLInvalidErr]
23✔
1942
}
1943

1944
// NewJSMirrorConsumerSetupFailedError creates a new JSMirrorConsumerSetupFailedErrF error: "{err}"
1945
func NewJSMirrorConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
1946
        eopts := parseOpts(opts)
×
1947
        if ae, ok := eopts.err.(*ApiError); ok {
×
1948
                return ae
×
1949
        }
×
1950

1951
        e := ApiErrors[JSMirrorConsumerSetupFailedErrF]
×
1952
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1953
        return &ApiError{
×
1954
                Code:        e.Code,
×
1955
                ErrCode:     e.ErrCode,
×
1956
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1957
        }
×
1958
}
1959

1960
// NewJSMirrorInvalidStreamNameError creates a new JSMirrorInvalidStreamName error: "mirrored stream name is invalid"
1961
func NewJSMirrorInvalidStreamNameError(opts ...ErrorOption) *ApiError {
×
1962
        eopts := parseOpts(opts)
×
1963
        if ae, ok := eopts.err.(*ApiError); ok {
×
1964
                return ae
×
1965
        }
×
1966

1967
        return ApiErrors[JSMirrorInvalidStreamName]
×
1968
}
1969

1970
// NewJSMirrorInvalidSubjectFilterError creates a new JSMirrorInvalidSubjectFilter error: "mirror transform source: {err}"
1971
func NewJSMirrorInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
2✔
1972
        eopts := parseOpts(opts)
2✔
1973
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1974
                return ae
×
1975
        }
×
1976

1977
        e := ApiErrors[JSMirrorInvalidSubjectFilter]
2✔
1978
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2✔
1979
        return &ApiError{
2✔
1980
                Code:        e.Code,
2✔
1981
                ErrCode:     e.ErrCode,
2✔
1982
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1983
        }
2✔
1984
}
1985

1986
// NewJSMirrorInvalidTransformDestinationError creates a new JSMirrorInvalidTransformDestination error: "mirror transform: {err}"
1987
func NewJSMirrorInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
2✔
1988
        eopts := parseOpts(opts)
2✔
1989
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1990
                return ae
×
1991
        }
×
1992

1993
        e := ApiErrors[JSMirrorInvalidTransformDestination]
2✔
1994
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2✔
1995
        return &ApiError{
2✔
1996
                Code:        e.Code,
2✔
1997
                ErrCode:     e.ErrCode,
2✔
1998
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1999
        }
2✔
2000
}
2001

2002
// NewJSMirrorMaxMessageSizeTooBigError creates a new JSMirrorMaxMessageSizeTooBigErr error: "stream mirror must have max message size >= source"
2003
func NewJSMirrorMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
2004
        eopts := parseOpts(opts)
×
2005
        if ae, ok := eopts.err.(*ApiError); ok {
×
2006
                return ae
×
2007
        }
×
2008

2009
        return ApiErrors[JSMirrorMaxMessageSizeTooBigErr]
×
2010
}
2011

2012
// NewJSMirrorMultipleFiltersNotAllowedError creates a new JSMirrorMultipleFiltersNotAllowed error: "mirror with multiple subject transforms cannot also have a single subject filter"
2013
func NewJSMirrorMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
2014
        eopts := parseOpts(opts)
1✔
2015
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2016
                return ae
×
2017
        }
×
2018

2019
        return ApiErrors[JSMirrorMultipleFiltersNotAllowed]
1✔
2020
}
2021

2022
// NewJSMirrorOverlappingSubjectFiltersError creates a new JSMirrorOverlappingSubjectFilters error: "mirror subject filters can not overlap"
2023
func NewJSMirrorOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
2✔
2024
        eopts := parseOpts(opts)
2✔
2025
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2026
                return ae
×
2027
        }
×
2028

2029
        return ApiErrors[JSMirrorOverlappingSubjectFilters]
2✔
2030
}
2031

2032
// NewJSMirrorWithCountersError creates a new JSMirrorWithCountersErr error: "stream mirrors can not also calculate counters"
2033
func NewJSMirrorWithCountersError(opts ...ErrorOption) *ApiError {
4✔
2034
        eopts := parseOpts(opts)
4✔
2035
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2036
                return ae
×
2037
        }
×
2038

2039
        return ApiErrors[JSMirrorWithCountersErr]
4✔
2040
}
2041

2042
// NewJSMirrorWithFirstSeqError creates a new JSMirrorWithFirstSeqErr error: "stream mirrors can not have first sequence configured"
2043
func NewJSMirrorWithFirstSeqError(opts ...ErrorOption) *ApiError {
2✔
2044
        eopts := parseOpts(opts)
2✔
2045
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2046
                return ae
×
2047
        }
×
2048

2049
        return ApiErrors[JSMirrorWithFirstSeqErr]
2✔
2050
}
2051

2052
// NewJSMirrorWithMsgSchedulesError creates a new JSMirrorWithMsgSchedulesErr error: "stream mirrors can not also schedule messages"
2053
func NewJSMirrorWithMsgSchedulesError(opts ...ErrorOption) *ApiError {
2✔
2054
        eopts := parseOpts(opts)
2✔
2055
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2056
                return ae
×
2057
        }
×
2058

2059
        return ApiErrors[JSMirrorWithMsgSchedulesErr]
2✔
2060
}
2061

2062
// NewJSMirrorWithSourcesError creates a new JSMirrorWithSourcesErr error: "stream mirrors can not also contain other sources"
2063
func NewJSMirrorWithSourcesError(opts ...ErrorOption) *ApiError {
×
2064
        eopts := parseOpts(opts)
×
2065
        if ae, ok := eopts.err.(*ApiError); ok {
×
2066
                return ae
×
2067
        }
×
2068

2069
        return ApiErrors[JSMirrorWithSourcesErr]
×
2070
}
2071

2072
// NewJSMirrorWithStartSeqAndTimeError creates a new JSMirrorWithStartSeqAndTimeErr error: "stream mirrors can not have both start seq and start time configured"
2073
func NewJSMirrorWithStartSeqAndTimeError(opts ...ErrorOption) *ApiError {
×
2074
        eopts := parseOpts(opts)
×
2075
        if ae, ok := eopts.err.(*ApiError); ok {
×
2076
                return ae
×
2077
        }
×
2078

2079
        return ApiErrors[JSMirrorWithStartSeqAndTimeErr]
×
2080
}
2081

2082
// NewJSMirrorWithSubjectFiltersError creates a new JSMirrorWithSubjectFiltersErr error: "stream mirrors can not contain filtered subjects"
2083
func NewJSMirrorWithSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
2084
        eopts := parseOpts(opts)
×
2085
        if ae, ok := eopts.err.(*ApiError); ok {
×
2086
                return ae
×
2087
        }
×
2088

2089
        return ApiErrors[JSMirrorWithSubjectFiltersErr]
×
2090
}
2091

2092
// NewJSMirrorWithSubjectsError creates a new JSMirrorWithSubjectsErr error: "stream mirrors can not contain subjects"
2093
func NewJSMirrorWithSubjectsError(opts ...ErrorOption) *ApiError {
2✔
2094
        eopts := parseOpts(opts)
2✔
2095
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2096
                return ae
×
2097
        }
×
2098

2099
        return ApiErrors[JSMirrorWithSubjectsErr]
2✔
2100
}
2101

2102
// NewJSNoAccountError creates a new JSNoAccountErr error: "account not found"
2103
func NewJSNoAccountError(opts ...ErrorOption) *ApiError {
1✔
2104
        eopts := parseOpts(opts)
1✔
2105
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2106
                return ae
×
2107
        }
×
2108

2109
        return ApiErrors[JSNoAccountErr]
1✔
2110
}
2111

2112
// NewJSNoLimitsError creates a new JSNoLimitsErr error: "no JetStream default or applicable tiered limit present"
2113
func NewJSNoLimitsError(opts ...ErrorOption) *ApiError {
4✔
2114
        eopts := parseOpts(opts)
4✔
2115
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2116
                return ae
×
2117
        }
×
2118

2119
        return ApiErrors[JSNoLimitsErr]
4✔
2120
}
2121

2122
// NewJSNoMessageFoundError creates a new JSNoMessageFoundErr error: "no message found"
2123
func NewJSNoMessageFoundError(opts ...ErrorOption) *ApiError {
467✔
2124
        eopts := parseOpts(opts)
467✔
2125
        if ae, ok := eopts.err.(*ApiError); ok {
467✔
2126
                return ae
×
2127
        }
×
2128

2129
        return ApiErrors[JSNoMessageFoundErr]
467✔
2130
}
2131

2132
// NewJSNotEmptyRequestError creates a new JSNotEmptyRequestErr error: "expected an empty request payload"
2133
func NewJSNotEmptyRequestError(opts ...ErrorOption) *ApiError {
3✔
2134
        eopts := parseOpts(opts)
3✔
2135
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2136
                return ae
×
2137
        }
×
2138

2139
        return ApiErrors[JSNotEmptyRequestErr]
3✔
2140
}
2141

2142
// NewJSNotEnabledError creates a new JSNotEnabledErr error: "JetStream not enabled"
2143
func NewJSNotEnabledError(opts ...ErrorOption) *ApiError {
10✔
2144
        eopts := parseOpts(opts)
10✔
2145
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2146
                return ae
×
2147
        }
×
2148

2149
        return ApiErrors[JSNotEnabledErr]
10✔
2150
}
2151

2152
// NewJSNotEnabledForAccountError creates a new JSNotEnabledForAccountErr error: "JetStream not enabled for account"
2153
func NewJSNotEnabledForAccountError(opts ...ErrorOption) *ApiError {
321✔
2154
        eopts := parseOpts(opts)
321✔
2155
        if ae, ok := eopts.err.(*ApiError); ok {
321✔
2156
                return ae
×
2157
        }
×
2158

2159
        return ApiErrors[JSNotEnabledForAccountErr]
321✔
2160
}
2161

2162
// NewJSPedanticError creates a new JSPedanticErrF error: "pedantic mode: {err}"
2163
func NewJSPedanticError(err error, opts ...ErrorOption) *ApiError {
36✔
2164
        eopts := parseOpts(opts)
36✔
2165
        if ae, ok := eopts.err.(*ApiError); ok {
36✔
2166
                return ae
×
2167
        }
×
2168

2169
        e := ApiErrors[JSPedanticErrF]
36✔
2170
        args := e.toReplacerArgs([]interface{}{"{err}", err})
36✔
2171
        return &ApiError{
36✔
2172
                Code:        e.Code,
36✔
2173
                ErrCode:     e.ErrCode,
36✔
2174
                Description: strings.NewReplacer(args...).Replace(e.Description),
36✔
2175
        }
36✔
2176
}
2177

2178
// NewJSPeerRemapError creates a new JSPeerRemapErr error: "peer remap failed"
2179
func NewJSPeerRemapError(opts ...ErrorOption) *ApiError {
5✔
2180
        eopts := parseOpts(opts)
5✔
2181
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2182
                return ae
1✔
2183
        }
1✔
2184

2185
        return ApiErrors[JSPeerRemapErr]
4✔
2186
}
2187

2188
// NewJSRaftGeneralError creates a new JSRaftGeneralErrF error: "{err}"
2189
func NewJSRaftGeneralError(err error, opts ...ErrorOption) *ApiError {
×
2190
        eopts := parseOpts(opts)
×
2191
        if ae, ok := eopts.err.(*ApiError); ok {
×
2192
                return ae
×
2193
        }
×
2194

2195
        e := ApiErrors[JSRaftGeneralErrF]
×
2196
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2197
        return &ApiError{
×
2198
                Code:        e.Code,
×
2199
                ErrCode:     e.ErrCode,
×
2200
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2201
        }
×
2202
}
2203

2204
// NewJSReplicasCountCannotBeNegativeError creates a new JSReplicasCountCannotBeNegative error: "replicas count cannot be negative"
2205
func NewJSReplicasCountCannotBeNegativeError(opts ...ErrorOption) *ApiError {
16✔
2206
        eopts := parseOpts(opts)
16✔
2207
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2208
                return ae
×
2209
        }
×
2210

2211
        return ApiErrors[JSReplicasCountCannotBeNegative]
16✔
2212
}
2213

2214
// NewJSRequiredApiLevelError creates a new JSRequiredApiLevelErr error: "JetStream minimum api level required"
2215
func NewJSRequiredApiLevelError(opts ...ErrorOption) *ApiError {
56✔
2216
        eopts := parseOpts(opts)
56✔
2217
        if ae, ok := eopts.err.(*ApiError); ok {
56✔
2218
                return ae
×
2219
        }
×
2220

2221
        return ApiErrors[JSRequiredApiLevelErr]
56✔
2222
}
2223

2224
// NewJSRestoreSubscribeFailedError creates a new JSRestoreSubscribeFailedErrF error: "JetStream unable to subscribe to restore snapshot {subject}: {err}"
2225
func NewJSRestoreSubscribeFailedError(err error, subject interface{}, opts ...ErrorOption) *ApiError {
1✔
2226
        eopts := parseOpts(opts)
1✔
2227
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2228
                return ae
×
2229
        }
×
2230

2231
        e := ApiErrors[JSRestoreSubscribeFailedErrF]
1✔
2232
        args := e.toReplacerArgs([]interface{}{"{err}", err, "{subject}", subject})
1✔
2233
        return &ApiError{
1✔
2234
                Code:        e.Code,
1✔
2235
                ErrCode:     e.ErrCode,
1✔
2236
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2237
        }
1✔
2238
}
2239

2240
// NewJSSequenceNotFoundError creates a new JSSequenceNotFoundErrF error: "sequence {seq} not found"
2241
func NewJSSequenceNotFoundError(seq uint64, opts ...ErrorOption) *ApiError {
×
2242
        eopts := parseOpts(opts)
×
2243
        if ae, ok := eopts.err.(*ApiError); ok {
×
2244
                return ae
×
2245
        }
×
2246

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

2256
// NewJSSnapshotDeliverSubjectInvalidError creates a new JSSnapshotDeliverSubjectInvalidErr error: "deliver subject not valid"
2257
func NewJSSnapshotDeliverSubjectInvalidError(opts ...ErrorOption) *ApiError {
1✔
2258
        eopts := parseOpts(opts)
1✔
2259
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2260
                return ae
×
2261
        }
×
2262

2263
        return ApiErrors[JSSnapshotDeliverSubjectInvalidErr]
1✔
2264
}
2265

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

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

2282
// NewJSSourceDuplicateDetectedError creates a new JSSourceDuplicateDetected error: "duplicate source configuration detected"
2283
func NewJSSourceDuplicateDetectedError(opts ...ErrorOption) *ApiError {
×
2284
        eopts := parseOpts(opts)
×
2285
        if ae, ok := eopts.err.(*ApiError); ok {
×
2286
                return ae
×
2287
        }
×
2288

2289
        return ApiErrors[JSSourceDuplicateDetected]
×
2290
}
2291

2292
// NewJSSourceInvalidStreamNameError creates a new JSSourceInvalidStreamName error: "sourced stream name is invalid"
2293
func NewJSSourceInvalidStreamNameError(opts ...ErrorOption) *ApiError {
1✔
2294
        eopts := parseOpts(opts)
1✔
2295
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2296
                return ae
×
2297
        }
×
2298

2299
        return ApiErrors[JSSourceInvalidStreamName]
1✔
2300
}
2301

2302
// NewJSSourceInvalidSubjectFilterError creates a new JSSourceInvalidSubjectFilter error: "source transform source: {err}"
2303
func NewJSSourceInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
1✔
2304
        eopts := parseOpts(opts)
1✔
2305
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2306
                return ae
×
2307
        }
×
2308

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

2318
// NewJSSourceInvalidTransformDestinationError creates a new JSSourceInvalidTransformDestination error: "source transform: {err}"
2319
func NewJSSourceInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
2320
        eopts := parseOpts(opts)
1✔
2321
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2322
                return ae
×
2323
        }
×
2324

2325
        e := ApiErrors[JSSourceInvalidTransformDestination]
1✔
2326
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2327
        return &ApiError{
1✔
2328
                Code:        e.Code,
1✔
2329
                ErrCode:     e.ErrCode,
1✔
2330
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2331
        }
1✔
2332
}
2333

2334
// NewJSSourceMaxMessageSizeTooBigError creates a new JSSourceMaxMessageSizeTooBigErr error: "stream source must have max message size >= target"
2335
func NewJSSourceMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
2336
        eopts := parseOpts(opts)
×
2337
        if ae, ok := eopts.err.(*ApiError); ok {
×
2338
                return ae
×
2339
        }
×
2340

2341
        return ApiErrors[JSSourceMaxMessageSizeTooBigErr]
×
2342
}
2343

2344
// NewJSSourceMultipleFiltersNotAllowedError creates a new JSSourceMultipleFiltersNotAllowed error: "source with multiple subject transforms cannot also have a single subject filter"
2345
func NewJSSourceMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
×
2346
        eopts := parseOpts(opts)
×
2347
        if ae, ok := eopts.err.(*ApiError); ok {
×
2348
                return ae
×
2349
        }
×
2350

2351
        return ApiErrors[JSSourceMultipleFiltersNotAllowed]
×
2352
}
2353

2354
// NewJSSourceOverlappingSubjectFiltersError creates a new JSSourceOverlappingSubjectFilters error: "source filters can not overlap"
2355
func NewJSSourceOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
2356
        eopts := parseOpts(opts)
×
2357
        if ae, ok := eopts.err.(*ApiError); ok {
×
2358
                return ae
×
2359
        }
×
2360

2361
        return ApiErrors[JSSourceOverlappingSubjectFilters]
×
2362
}
2363

2364
// NewJSSourceWithMsgSchedulesError creates a new JSSourceWithMsgSchedulesErr error: "stream source can not also schedule messages"
2365
func NewJSSourceWithMsgSchedulesError(opts ...ErrorOption) *ApiError {
2✔
2366
        eopts := parseOpts(opts)
2✔
2367
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2368
                return ae
×
2369
        }
×
2370

2371
        return ApiErrors[JSSourceWithMsgSchedulesErr]
2✔
2372
}
2373

2374
// NewJSStorageResourcesExceededError creates a new JSStorageResourcesExceededErr error: "insufficient storage resources available"
2375
func NewJSStorageResourcesExceededError(opts ...ErrorOption) *ApiError {
25✔
2376
        eopts := parseOpts(opts)
25✔
2377
        if ae, ok := eopts.err.(*ApiError); ok {
25✔
2378
                return ae
×
2379
        }
×
2380

2381
        return ApiErrors[JSStorageResourcesExceededErr]
25✔
2382
}
2383

2384
// NewJSStreamAssignmentError creates a new JSStreamAssignmentErrF error: "{err}"
2385
func NewJSStreamAssignmentError(err error, opts ...ErrorOption) *ApiError {
×
2386
        eopts := parseOpts(opts)
×
2387
        if ae, ok := eopts.err.(*ApiError); ok {
×
2388
                return ae
×
2389
        }
×
2390

2391
        e := ApiErrors[JSStreamAssignmentErrF]
×
2392
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2393
        return &ApiError{
×
2394
                Code:        e.Code,
×
2395
                ErrCode:     e.ErrCode,
×
2396
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2397
        }
×
2398
}
2399

2400
// NewJSStreamCreateError creates a new JSStreamCreateErrF error: "{err}"
2401
func NewJSStreamCreateError(err error, opts ...ErrorOption) *ApiError {
84✔
2402
        eopts := parseOpts(opts)
84✔
2403
        if ae, ok := eopts.err.(*ApiError); ok {
165✔
2404
                return ae
81✔
2405
        }
81✔
2406

2407
        e := ApiErrors[JSStreamCreateErrF]
3✔
2408
        args := e.toReplacerArgs([]interface{}{"{err}", err})
3✔
2409
        return &ApiError{
3✔
2410
                Code:        e.Code,
3✔
2411
                ErrCode:     e.ErrCode,
3✔
2412
                Description: strings.NewReplacer(args...).Replace(e.Description),
3✔
2413
        }
3✔
2414
}
2415

2416
// NewJSStreamDeleteError creates a new JSStreamDeleteErrF error: "{err}"
2417
func NewJSStreamDeleteError(err error, opts ...ErrorOption) *ApiError {
×
2418
        eopts := parseOpts(opts)
×
2419
        if ae, ok := eopts.err.(*ApiError); ok {
×
2420
                return ae
×
2421
        }
×
2422

2423
        e := ApiErrors[JSStreamDeleteErrF]
×
2424
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2425
        return &ApiError{
×
2426
                Code:        e.Code,
×
2427
                ErrCode:     e.ErrCode,
×
2428
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2429
        }
×
2430
}
2431

2432
// NewJSStreamDuplicateMessageConflictError creates a new JSStreamDuplicateMessageConflict error: "duplicate message id is in process"
2433
func NewJSStreamDuplicateMessageConflictError(opts ...ErrorOption) *ApiError {
65✔
2434
        eopts := parseOpts(opts)
65✔
2435
        if ae, ok := eopts.err.(*ApiError); ok {
65✔
2436
                return ae
×
2437
        }
×
2438

2439
        return ApiErrors[JSStreamDuplicateMessageConflict]
65✔
2440
}
2441

2442
// NewJSStreamExpectedLastSeqPerSubjectInvalidError creates a new JSStreamExpectedLastSeqPerSubjectInvalid error: "missing sequence for expected last sequence per subject"
2443
func NewJSStreamExpectedLastSeqPerSubjectInvalidError(opts ...ErrorOption) *ApiError {
8✔
2444
        eopts := parseOpts(opts)
8✔
2445
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
2446
                return ae
×
2447
        }
×
2448

2449
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectInvalid]
8✔
2450
}
2451

2452
// NewJSStreamExpectedLastSeqPerSubjectNotReadyError creates a new JSStreamExpectedLastSeqPerSubjectNotReady error: "expected last sequence per subject temporarily unavailable"
2453
func NewJSStreamExpectedLastSeqPerSubjectNotReadyError(opts ...ErrorOption) *ApiError {
×
2454
        eopts := parseOpts(opts)
×
2455
        if ae, ok := eopts.err.(*ApiError); ok {
×
2456
                return ae
×
2457
        }
×
2458

2459
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectNotReady]
×
2460
}
2461

2462
// NewJSStreamExternalApiOverlapError creates a new JSStreamExternalApiOverlapErrF error: "stream external api prefix {prefix} must not overlap with {subject}"
2463
func NewJSStreamExternalApiOverlapError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
2✔
2464
        eopts := parseOpts(opts)
2✔
2465
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2466
                return ae
×
2467
        }
×
2468

2469
        e := ApiErrors[JSStreamExternalApiOverlapErrF]
2✔
2470
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
2✔
2471
        return &ApiError{
2✔
2472
                Code:        e.Code,
2✔
2473
                ErrCode:     e.ErrCode,
2✔
2474
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2475
        }
2✔
2476
}
2477

2478
// NewJSStreamExternalDelPrefixOverlapsError creates a new JSStreamExternalDelPrefixOverlapsErrF error: "stream external delivery prefix {prefix} overlaps with stream subject {subject}"
2479
func NewJSStreamExternalDelPrefixOverlapsError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
×
2480
        eopts := parseOpts(opts)
×
2481
        if ae, ok := eopts.err.(*ApiError); ok {
×
2482
                return ae
×
2483
        }
×
2484

2485
        e := ApiErrors[JSStreamExternalDelPrefixOverlapsErrF]
×
2486
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
×
2487
        return &ApiError{
×
2488
                Code:        e.Code,
×
2489
                ErrCode:     e.ErrCode,
×
2490
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2491
        }
×
2492
}
2493

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

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

2510
// NewJSStreamHeaderExceedsMaximumError creates a new JSStreamHeaderExceedsMaximumErr error: "header size exceeds maximum allowed of 64k"
2511
func NewJSStreamHeaderExceedsMaximumError(opts ...ErrorOption) *ApiError {
1✔
2512
        eopts := parseOpts(opts)
1✔
2513
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2514
                return ae
×
2515
        }
×
2516

2517
        return ApiErrors[JSStreamHeaderExceedsMaximumErr]
1✔
2518
}
2519

2520
// NewJSStreamInfoMaxSubjectsError creates a new JSStreamInfoMaxSubjectsErr error: "subject details would exceed maximum allowed"
2521
func NewJSStreamInfoMaxSubjectsError(opts ...ErrorOption) *ApiError {
×
2522
        eopts := parseOpts(opts)
×
2523
        if ae, ok := eopts.err.(*ApiError); ok {
×
2524
                return ae
×
2525
        }
×
2526

2527
        return ApiErrors[JSStreamInfoMaxSubjectsErr]
×
2528
}
2529

2530
// NewJSStreamInvalidConfigError creates a new JSStreamInvalidConfigF error: "{err}"
2531
func NewJSStreamInvalidConfigError(err error, opts ...ErrorOption) *ApiError {
148✔
2532
        eopts := parseOpts(opts)
148✔
2533
        if ae, ok := eopts.err.(*ApiError); ok {
170✔
2534
                return ae
22✔
2535
        }
22✔
2536

2537
        e := ApiErrors[JSStreamInvalidConfigF]
126✔
2538
        args := e.toReplacerArgs([]interface{}{"{err}", err})
126✔
2539
        return &ApiError{
126✔
2540
                Code:        e.Code,
126✔
2541
                ErrCode:     e.ErrCode,
126✔
2542
                Description: strings.NewReplacer(args...).Replace(e.Description),
126✔
2543
        }
126✔
2544
}
2545

2546
// NewJSStreamInvalidError creates a new JSStreamInvalidErr error: "stream not valid"
2547
func NewJSStreamInvalidError(opts ...ErrorOption) *ApiError {
×
2548
        eopts := parseOpts(opts)
×
2549
        if ae, ok := eopts.err.(*ApiError); ok {
×
2550
                return ae
×
2551
        }
×
2552

2553
        return ApiErrors[JSStreamInvalidErr]
×
2554
}
2555

2556
// NewJSStreamInvalidExternalDeliverySubjError creates a new JSStreamInvalidExternalDeliverySubjErrF error: "stream external delivery prefix {prefix} must not contain wildcards"
2557
func NewJSStreamInvalidExternalDeliverySubjError(prefix interface{}, opts ...ErrorOption) *ApiError {
×
2558
        eopts := parseOpts(opts)
×
2559
        if ae, ok := eopts.err.(*ApiError); ok {
×
2560
                return ae
×
2561
        }
×
2562

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

2572
// NewJSStreamLimitsError creates a new JSStreamLimitsErrF error: "{err}"
2573
func NewJSStreamLimitsError(err error, opts ...ErrorOption) *ApiError {
8✔
2574
        eopts := parseOpts(opts)
8✔
2575
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2576
                return ae
8✔
2577
        }
8✔
2578

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

2588
// NewJSStreamMaxBytesRequiredError creates a new JSStreamMaxBytesRequired error: "account requires a stream config to have max bytes set"
2589
func NewJSStreamMaxBytesRequiredError(opts ...ErrorOption) *ApiError {
3✔
2590
        eopts := parseOpts(opts)
3✔
2591
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2592
                return ae
×
2593
        }
×
2594

2595
        return ApiErrors[JSStreamMaxBytesRequired]
3✔
2596
}
2597

2598
// NewJSStreamMaxStreamBytesExceededError creates a new JSStreamMaxStreamBytesExceeded error: "stream max bytes exceeds account limit max stream bytes"
2599
func NewJSStreamMaxStreamBytesExceededError(opts ...ErrorOption) *ApiError {
2✔
2600
        eopts := parseOpts(opts)
2✔
2601
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2602
                return ae
×
2603
        }
×
2604

2605
        return ApiErrors[JSStreamMaxStreamBytesExceeded]
2✔
2606
}
2607

2608
// NewJSStreamMessageExceedsMaximumError creates a new JSStreamMessageExceedsMaximumErr error: "message size exceeds maximum allowed"
2609
func NewJSStreamMessageExceedsMaximumError(opts ...ErrorOption) *ApiError {
19✔
2610
        eopts := parseOpts(opts)
19✔
2611
        if ae, ok := eopts.err.(*ApiError); ok {
19✔
2612
                return ae
×
2613
        }
×
2614

2615
        return ApiErrors[JSStreamMessageExceedsMaximumErr]
19✔
2616
}
2617

2618
// NewJSStreamMinLastSeqError creates a new JSStreamMinLastSeqErr error: "min last sequence"
2619
func NewJSStreamMinLastSeqError(opts ...ErrorOption) *ApiError {
×
2620
        eopts := parseOpts(opts)
×
2621
        if ae, ok := eopts.err.(*ApiError); ok {
×
2622
                return ae
×
2623
        }
×
2624

2625
        return ApiErrors[JSStreamMinLastSeqErr]
×
2626
}
2627

2628
// NewJSStreamMirrorNotUpdatableError creates a new JSStreamMirrorNotUpdatableErr error: "stream mirror configuration can not be updated"
2629
func NewJSStreamMirrorNotUpdatableError(opts ...ErrorOption) *ApiError {
2✔
2630
        eopts := parseOpts(opts)
2✔
2631
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2632
                return ae
×
2633
        }
×
2634

2635
        return ApiErrors[JSStreamMirrorNotUpdatableErr]
2✔
2636
}
2637

2638
// NewJSStreamMismatchError creates a new JSStreamMismatchErr error: "stream name in subject does not match request"
2639
func NewJSStreamMismatchError(opts ...ErrorOption) *ApiError {
3✔
2640
        eopts := parseOpts(opts)
3✔
2641
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2642
                return ae
×
2643
        }
×
2644

2645
        return ApiErrors[JSStreamMismatchErr]
3✔
2646
}
2647

2648
// NewJSStreamMoveAndScaleError creates a new JSStreamMoveAndScaleErr error: "can not move and scale a stream in a single update"
2649
func NewJSStreamMoveAndScaleError(opts ...ErrorOption) *ApiError {
4✔
2650
        eopts := parseOpts(opts)
4✔
2651
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2652
                return ae
×
2653
        }
×
2654

2655
        return ApiErrors[JSStreamMoveAndScaleErr]
4✔
2656
}
2657

2658
// NewJSStreamMoveInProgressError creates a new JSStreamMoveInProgressF error: "stream move already in progress: {msg}"
2659
func NewJSStreamMoveInProgressError(msg interface{}, opts ...ErrorOption) *ApiError {
2✔
2660
        eopts := parseOpts(opts)
2✔
2661
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2662
                return ae
×
2663
        }
×
2664

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

2674
// NewJSStreamMoveNotInProgressError creates a new JSStreamMoveNotInProgress error: "stream move not in progress"
2675
func NewJSStreamMoveNotInProgressError(opts ...ErrorOption) *ApiError {
×
2676
        eopts := parseOpts(opts)
×
2677
        if ae, ok := eopts.err.(*ApiError); ok {
×
2678
                return ae
×
2679
        }
×
2680

2681
        return ApiErrors[JSStreamMoveNotInProgress]
×
2682
}
2683

2684
// NewJSStreamMsgDeleteFailedError creates a new JSStreamMsgDeleteFailedF error: "{err}"
2685
func NewJSStreamMsgDeleteFailedError(err error, opts ...ErrorOption) *ApiError {
1✔
2686
        eopts := parseOpts(opts)
1✔
2687
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2688
                return ae
×
2689
        }
×
2690

2691
        e := ApiErrors[JSStreamMsgDeleteFailedF]
1✔
2692
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2693
        return &ApiError{
1✔
2694
                Code:        e.Code,
1✔
2695
                ErrCode:     e.ErrCode,
1✔
2696
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2697
        }
1✔
2698
}
2699

2700
// NewJSStreamNameContainsPathSeparatorsError creates a new JSStreamNameContainsPathSeparatorsErr error: "Stream name can not contain path separators"
2701
func NewJSStreamNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
6✔
2702
        eopts := parseOpts(opts)
6✔
2703
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2704
                return ae
×
2705
        }
×
2706

2707
        return ApiErrors[JSStreamNameContainsPathSeparatorsErr]
6✔
2708
}
2709

2710
// NewJSStreamNameExistError creates a new JSStreamNameExistErr error: "stream name already in use with a different configuration"
2711
func NewJSStreamNameExistError(opts ...ErrorOption) *ApiError {
10✔
2712
        eopts := parseOpts(opts)
10✔
2713
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2714
                return ae
×
2715
        }
×
2716

2717
        return ApiErrors[JSStreamNameExistErr]
10✔
2718
}
2719

2720
// NewJSStreamNameExistRestoreFailedError creates a new JSStreamNameExistRestoreFailedErr error: "stream name already in use, cannot restore"
2721
func NewJSStreamNameExistRestoreFailedError(opts ...ErrorOption) *ApiError {
3✔
2722
        eopts := parseOpts(opts)
3✔
2723
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2724
                return ae
×
2725
        }
×
2726

2727
        return ApiErrors[JSStreamNameExistRestoreFailedErr]
3✔
2728
}
2729

2730
// NewJSStreamNotFoundError creates a new JSStreamNotFoundErr error: "stream not found"
2731
func NewJSStreamNotFoundError(opts ...ErrorOption) *ApiError {
25,452✔
2732
        eopts := parseOpts(opts)
25,452✔
2733
        if ae, ok := eopts.err.(*ApiError); ok {
26,117✔
2734
                return ae
665✔
2735
        }
665✔
2736

2737
        return ApiErrors[JSStreamNotFoundErr]
24,787✔
2738
}
2739

2740
// NewJSStreamNotMatchError creates a new JSStreamNotMatchErr error: "expected stream does not match"
2741
func NewJSStreamNotMatchError(opts ...ErrorOption) *ApiError {
5✔
2742
        eopts := parseOpts(opts)
5✔
2743
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2744
                return ae
×
2745
        }
×
2746

2747
        return ApiErrors[JSStreamNotMatchErr]
5✔
2748
}
2749

2750
// NewJSStreamOfflineError creates a new JSStreamOfflineErr error: "stream is offline"
2751
func NewJSStreamOfflineError(opts ...ErrorOption) *ApiError {
6✔
2752
        eopts := parseOpts(opts)
6✔
2753
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2754
                return ae
×
2755
        }
×
2756

2757
        return ApiErrors[JSStreamOfflineErr]
6✔
2758
}
2759

2760
// NewJSStreamOfflineReasonError creates a new JSStreamOfflineReasonErrF error: "stream is offline: {err}"
2761
func NewJSStreamOfflineReasonError(err error, opts ...ErrorOption) *ApiError {
40✔
2762
        eopts := parseOpts(opts)
40✔
2763
        if ae, ok := eopts.err.(*ApiError); ok {
40✔
2764
                return ae
×
2765
        }
×
2766

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

2776
// NewJSStreamPurgeFailedError creates a new JSStreamPurgeFailedF error: "{err}"
2777
func NewJSStreamPurgeFailedError(err error, opts ...ErrorOption) *ApiError {
1✔
2778
        eopts := parseOpts(opts)
1✔
2779
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2780
                return ae
×
2781
        }
×
2782

2783
        e := ApiErrors[JSStreamPurgeFailedF]
1✔
2784
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2785
        return &ApiError{
1✔
2786
                Code:        e.Code,
1✔
2787
                ErrCode:     e.ErrCode,
1✔
2788
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2789
        }
1✔
2790
}
2791

2792
// NewJSStreamReplicasNotSupportedError creates a new JSStreamReplicasNotSupportedErr error: "replicas > 1 not supported in non-clustered mode"
2793
func NewJSStreamReplicasNotSupportedError(opts ...ErrorOption) *ApiError {
1✔
2794
        eopts := parseOpts(opts)
1✔
2795
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2796
                return ae
×
2797
        }
×
2798

2799
        return ApiErrors[JSStreamReplicasNotSupportedErr]
1✔
2800
}
2801

2802
// NewJSStreamReplicasNotUpdatableError creates a new JSStreamReplicasNotUpdatableErr error: "Replicas configuration can not be updated"
2803
func NewJSStreamReplicasNotUpdatableError(opts ...ErrorOption) *ApiError {
×
2804
        eopts := parseOpts(opts)
×
2805
        if ae, ok := eopts.err.(*ApiError); ok {
×
2806
                return ae
×
2807
        }
×
2808

2809
        return ApiErrors[JSStreamReplicasNotUpdatableErr]
×
2810
}
2811

2812
// NewJSStreamRestoreError creates a new JSStreamRestoreErrF error: "restore failed: {err}"
2813
func NewJSStreamRestoreError(err error, opts ...ErrorOption) *ApiError {
7✔
2814
        eopts := parseOpts(opts)
7✔
2815
        if ae, ok := eopts.err.(*ApiError); ok {
9✔
2816
                return ae
2✔
2817
        }
2✔
2818

2819
        e := ApiErrors[JSStreamRestoreErrF]
5✔
2820
        args := e.toReplacerArgs([]interface{}{"{err}", err})
5✔
2821
        return &ApiError{
5✔
2822
                Code:        e.Code,
5✔
2823
                ErrCode:     e.ErrCode,
5✔
2824
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
2825
        }
5✔
2826
}
2827

2828
// NewJSStreamRollupFailedError creates a new JSStreamRollupFailedF error: "{err}"
2829
func NewJSStreamRollupFailedError(err error, opts ...ErrorOption) *ApiError {
13✔
2830
        eopts := parseOpts(opts)
13✔
2831
        if ae, ok := eopts.err.(*ApiError); ok {
13✔
2832
                return ae
×
2833
        }
×
2834

2835
        e := ApiErrors[JSStreamRollupFailedF]
13✔
2836
        args := e.toReplacerArgs([]interface{}{"{err}", err})
13✔
2837
        return &ApiError{
13✔
2838
                Code:        e.Code,
13✔
2839
                ErrCode:     e.ErrCode,
13✔
2840
                Description: strings.NewReplacer(args...).Replace(e.Description),
13✔
2841
        }
13✔
2842
}
2843

2844
// NewJSStreamSealedError creates a new JSStreamSealedErr error: "invalid operation on sealed stream"
2845
func NewJSStreamSealedError(opts ...ErrorOption) *ApiError {
10✔
2846
        eopts := parseOpts(opts)
10✔
2847
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2848
                return ae
×
2849
        }
×
2850

2851
        return ApiErrors[JSStreamSealedErr]
10✔
2852
}
2853

2854
// NewJSStreamSequenceNotMatchError creates a new JSStreamSequenceNotMatchErr error: "expected stream sequence does not match"
2855
func NewJSStreamSequenceNotMatchError(opts ...ErrorOption) *ApiError {
×
2856
        eopts := parseOpts(opts)
×
2857
        if ae, ok := eopts.err.(*ApiError); ok {
×
2858
                return ae
×
2859
        }
×
2860

2861
        return ApiErrors[JSStreamSequenceNotMatchErr]
×
2862
}
2863

2864
// NewJSStreamSnapshotError creates a new JSStreamSnapshotErrF error: "snapshot failed: {err}"
2865
func NewJSStreamSnapshotError(err error, opts ...ErrorOption) *ApiError {
×
2866
        eopts := parseOpts(opts)
×
2867
        if ae, ok := eopts.err.(*ApiError); ok {
×
2868
                return ae
×
2869
        }
×
2870

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

2880
// NewJSStreamStoreFailedError creates a new JSStreamStoreFailedF error: "{err}"
2881
func NewJSStreamStoreFailedError(err error, opts ...ErrorOption) *ApiError {
1,513✔
2882
        eopts := parseOpts(opts)
1,513✔
2883
        if ae, ok := eopts.err.(*ApiError); ok {
1,513✔
2884
                return ae
×
2885
        }
×
2886

2887
        e := ApiErrors[JSStreamStoreFailedF]
1,513✔
2888
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1,513✔
2889
        return &ApiError{
1,513✔
2890
                Code:        e.Code,
1,513✔
2891
                ErrCode:     e.ErrCode,
1,513✔
2892
                Description: strings.NewReplacer(args...).Replace(e.Description),
1,513✔
2893
        }
1,513✔
2894
}
2895

2896
// NewJSStreamSubjectOverlapError creates a new JSStreamSubjectOverlapErr error: "subjects overlap with an existing stream"
2897
func NewJSStreamSubjectOverlapError(opts ...ErrorOption) *ApiError {
43✔
2898
        eopts := parseOpts(opts)
43✔
2899
        if ae, ok := eopts.err.(*ApiError); ok {
43✔
2900
                return ae
×
2901
        }
×
2902

2903
        return ApiErrors[JSStreamSubjectOverlapErr]
43✔
2904
}
2905

2906
// NewJSStreamTemplateCreateError creates a new JSStreamTemplateCreateErrF error: "{err}"
2907
func NewJSStreamTemplateCreateError(err error, opts ...ErrorOption) *ApiError {
×
2908
        eopts := parseOpts(opts)
×
2909
        if ae, ok := eopts.err.(*ApiError); ok {
×
2910
                return ae
×
2911
        }
×
2912

2913
        e := ApiErrors[JSStreamTemplateCreateErrF]
×
2914
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2915
        return &ApiError{
×
2916
                Code:        e.Code,
×
2917
                ErrCode:     e.ErrCode,
×
2918
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2919
        }
×
2920
}
2921

2922
// NewJSStreamTemplateDeleteError creates a new JSStreamTemplateDeleteErrF error: "{err}"
2923
func NewJSStreamTemplateDeleteError(err error, opts ...ErrorOption) *ApiError {
1✔
2924
        eopts := parseOpts(opts)
1✔
2925
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2926
                return ae
1✔
2927
        }
1✔
2928

2929
        e := ApiErrors[JSStreamTemplateDeleteErrF]
×
2930
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2931
        return &ApiError{
×
2932
                Code:        e.Code,
×
2933
                ErrCode:     e.ErrCode,
×
2934
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2935
        }
×
2936
}
2937

2938
// NewJSStreamTemplateNotFoundError creates a new JSStreamTemplateNotFoundErr error: "template not found"
2939
func NewJSStreamTemplateNotFoundError(opts ...ErrorOption) *ApiError {
4✔
2940
        eopts := parseOpts(opts)
4✔
2941
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2942
                return ae
×
2943
        }
×
2944

2945
        return ApiErrors[JSStreamTemplateNotFoundErr]
4✔
2946
}
2947

2948
// NewJSStreamTooManyRequestsError creates a new JSStreamTooManyRequests error: "too many requests"
2949
func NewJSStreamTooManyRequestsError(opts ...ErrorOption) *ApiError {
291✔
2950
        eopts := parseOpts(opts)
291✔
2951
        if ae, ok := eopts.err.(*ApiError); ok {
291✔
2952
                return ae
×
2953
        }
×
2954

2955
        return ApiErrors[JSStreamTooManyRequests]
291✔
2956
}
2957

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

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

2974
// NewJSStreamTransformInvalidSourceError creates a new JSStreamTransformInvalidSource error: "stream transform source: {err}"
2975
func NewJSStreamTransformInvalidSourceError(err error, opts ...ErrorOption) *ApiError {
1✔
2976
        eopts := parseOpts(opts)
1✔
2977
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2978
                return ae
×
2979
        }
×
2980

2981
        e := ApiErrors[JSStreamTransformInvalidSource]
1✔
2982
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2983
        return &ApiError{
1✔
2984
                Code:        e.Code,
1✔
2985
                ErrCode:     e.ErrCode,
1✔
2986
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2987
        }
1✔
2988
}
2989

2990
// NewJSStreamUpdateError creates a new JSStreamUpdateErrF error: "{err}"
2991
func NewJSStreamUpdateError(err error, opts ...ErrorOption) *ApiError {
24✔
2992
        eopts := parseOpts(opts)
24✔
2993
        if ae, ok := eopts.err.(*ApiError); ok {
42✔
2994
                return ae
18✔
2995
        }
18✔
2996

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

3006
// NewJSStreamWrongLastMsgIDError creates a new JSStreamWrongLastMsgIDErrF error: "wrong last msg ID: {id}"
3007
func NewJSStreamWrongLastMsgIDError(id interface{}, opts ...ErrorOption) *ApiError {
5✔
3008
        eopts := parseOpts(opts)
5✔
3009
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
3010
                return ae
×
3011
        }
×
3012

3013
        e := ApiErrors[JSStreamWrongLastMsgIDErrF]
5✔
3014
        args := e.toReplacerArgs([]interface{}{"{id}", id})
5✔
3015
        return &ApiError{
5✔
3016
                Code:        e.Code,
5✔
3017
                ErrCode:     e.ErrCode,
5✔
3018
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
3019
        }
5✔
3020
}
3021

3022
// NewJSStreamWrongLastSequenceConstantError creates a new JSStreamWrongLastSequenceConstantErr error: "wrong last sequence"
3023
func NewJSStreamWrongLastSequenceConstantError(opts ...ErrorOption) *ApiError {
24✔
3024
        eopts := parseOpts(opts)
24✔
3025
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
3026
                return ae
×
3027
        }
×
3028

3029
        return ApiErrors[JSStreamWrongLastSequenceConstantErr]
24✔
3030
}
3031

3032
// NewJSStreamWrongLastSequenceError creates a new JSStreamWrongLastSequenceErrF error: "wrong last sequence: {seq}"
3033
func NewJSStreamWrongLastSequenceError(seq uint64, opts ...ErrorOption) *ApiError {
94✔
3034
        eopts := parseOpts(opts)
94✔
3035
        if ae, ok := eopts.err.(*ApiError); ok {
94✔
3036
                return ae
×
3037
        }
×
3038

3039
        e := ApiErrors[JSStreamWrongLastSequenceErrF]
94✔
3040
        args := e.toReplacerArgs([]interface{}{"{seq}", seq})
94✔
3041
        return &ApiError{
94✔
3042
                Code:        e.Code,
94✔
3043
                ErrCode:     e.ErrCode,
94✔
3044
                Description: strings.NewReplacer(args...).Replace(e.Description),
94✔
3045
        }
94✔
3046
}
3047

3048
// NewJSTempStorageFailedError creates a new JSTempStorageFailedErr error: "JetStream unable to open temp storage for restore"
3049
func NewJSTempStorageFailedError(opts ...ErrorOption) *ApiError {
×
3050
        eopts := parseOpts(opts)
×
3051
        if ae, ok := eopts.err.(*ApiError); ok {
×
3052
                return ae
×
3053
        }
×
3054

3055
        return ApiErrors[JSTempStorageFailedErr]
×
3056
}
3057

3058
// NewJSTemplateNameNotMatchSubjectError creates a new JSTemplateNameNotMatchSubjectErr error: "template name in subject does not match request"
3059
func NewJSTemplateNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
1✔
3060
        eopts := parseOpts(opts)
1✔
3061
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3062
                return ae
×
3063
        }
×
3064

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