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

nats-io / nats-server / 17935978632

22 Sep 2025 02:31PM UTC coverage: 86.036% (-0.08%) from 86.111%
17935978632

push

github

web-flow
[IMPROVED] Fix small typos for leafnode.go (#7337)

Some typo fixes in comments for leafnode.go

[skip ci]

Signed-off-by: Yoonseo Han  yooncer00@gmail.com
(github id: yoonseo-han)

74268 of 86322 relevant lines covered (86.04%)

336118.93 hits per line

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

54.72
/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
        // JSAtomicPublishTooLargeBatchErrF atomic publish batch is too large: {size}
24
        JSAtomicPublishTooLargeBatchErrF ErrorIdentifier = 10199
25

26
        // JSAtomicPublishUnsupportedHeaderBatchErr atomic publish unsupported header used: {header}
27
        JSAtomicPublishUnsupportedHeaderBatchErr ErrorIdentifier = 10177
28

29
        // JSBadRequestErr bad request
30
        JSBadRequestErr ErrorIdentifier = 10003
31

32
        // JSClusterIncompleteErr incomplete results
33
        JSClusterIncompleteErr ErrorIdentifier = 10004
34

35
        // JSClusterNoPeersErrF Error causing no peers to be available ({err})
36
        JSClusterNoPeersErrF ErrorIdentifier = 10005
37

38
        // JSClusterNotActiveErr JetStream not in clustered mode
39
        JSClusterNotActiveErr ErrorIdentifier = 10006
40

41
        // JSClusterNotAssignedErr JetStream cluster not assigned to this server
42
        JSClusterNotAssignedErr ErrorIdentifier = 10007
43

44
        // JSClusterNotAvailErr JetStream system temporarily unavailable
45
        JSClusterNotAvailErr ErrorIdentifier = 10008
46

47
        // JSClusterNotLeaderErr JetStream cluster can not handle request
48
        JSClusterNotLeaderErr ErrorIdentifier = 10009
49

50
        // JSClusterPeerNotMemberErr peer not a member
51
        JSClusterPeerNotMemberErr ErrorIdentifier = 10040
52

53
        // JSClusterRequiredErr JetStream clustering support required
54
        JSClusterRequiredErr ErrorIdentifier = 10010
55

56
        // JSClusterServerNotMemberErr server is not a member of the cluster
57
        JSClusterServerNotMemberErr ErrorIdentifier = 10044
58

59
        // JSClusterTagsErr tags placement not supported for operation
60
        JSClusterTagsErr ErrorIdentifier = 10011
61

62
        // JSClusterUnSupportFeatureErr not currently supported in clustered mode
63
        JSClusterUnSupportFeatureErr ErrorIdentifier = 10036
64

65
        // JSConsumerAckPolicyInvalidErr consumer ack policy invalid
66
        JSConsumerAckPolicyInvalidErr ErrorIdentifier = 10181
67

68
        // JSConsumerAckWaitNegativeErr consumer ack wait needs to be positive
69
        JSConsumerAckWaitNegativeErr ErrorIdentifier = 10183
70

71
        // JSConsumerAlreadyExists action CREATE is used for a existing consumer with a different config (consumer already exists)
72
        JSConsumerAlreadyExists ErrorIdentifier = 10148
73

74
        // JSConsumerBackOffNegativeErr consumer backoff needs to be positive
75
        JSConsumerBackOffNegativeErr ErrorIdentifier = 10184
76

77
        // JSConsumerBadDurableNameErr durable name can not contain '.', '*', '>'
78
        JSConsumerBadDurableNameErr ErrorIdentifier = 10103
79

80
        // JSConsumerConfigRequiredErr consumer config required
81
        JSConsumerConfigRequiredErr ErrorIdentifier = 10078
82

83
        // JSConsumerCreateDurableAndNameMismatch Consumer Durable and Name have to be equal if both are provided
84
        JSConsumerCreateDurableAndNameMismatch ErrorIdentifier = 10132
85

86
        // JSConsumerCreateErrF General consumer creation failure string ({err})
87
        JSConsumerCreateErrF ErrorIdentifier = 10012
88

89
        // JSConsumerCreateFilterSubjectMismatchErr Consumer create request did not match filtered subject from create subject
90
        JSConsumerCreateFilterSubjectMismatchErr ErrorIdentifier = 10131
91

92
        // JSConsumerDeliverCycleErr consumer deliver subject forms a cycle
93
        JSConsumerDeliverCycleErr ErrorIdentifier = 10081
94

95
        // JSConsumerDeliverToWildcardsErr consumer deliver subject has wildcards
96
        JSConsumerDeliverToWildcardsErr ErrorIdentifier = 10079
97

98
        // JSConsumerDescriptionTooLongErrF consumer description is too long, maximum allowed is {max}
99
        JSConsumerDescriptionTooLongErrF ErrorIdentifier = 10107
100

101
        // JSConsumerDirectRequiresEphemeralErr consumer direct requires an ephemeral consumer
102
        JSConsumerDirectRequiresEphemeralErr ErrorIdentifier = 10091
103

104
        // JSConsumerDirectRequiresPushErr consumer direct requires a push based consumer
105
        JSConsumerDirectRequiresPushErr ErrorIdentifier = 10090
106

107
        // JSConsumerDoesNotExist action UPDATE is used for a nonexisting consumer (consumer does not exist)
108
        JSConsumerDoesNotExist ErrorIdentifier = 10149
109

110
        // JSConsumerDuplicateFilterSubjects consumer cannot have both FilterSubject and FilterSubjects specified
111
        JSConsumerDuplicateFilterSubjects ErrorIdentifier = 10136
112

113
        // JSConsumerDurableNameNotInSubjectErr consumer expected to be durable but no durable name set in subject
114
        JSConsumerDurableNameNotInSubjectErr ErrorIdentifier = 10016
115

116
        // JSConsumerDurableNameNotMatchSubjectErr consumer name in subject does not match durable name in request
117
        JSConsumerDurableNameNotMatchSubjectErr ErrorIdentifier = 10017
118

119
        // JSConsumerDurableNameNotSetErr consumer expected to be durable but a durable name was not set
120
        JSConsumerDurableNameNotSetErr ErrorIdentifier = 10018
121

122
        // JSConsumerEmptyFilter consumer filter in FilterSubjects cannot be empty
123
        JSConsumerEmptyFilter ErrorIdentifier = 10139
124

125
        // JSConsumerEmptyGroupName Group name cannot be an empty string
126
        JSConsumerEmptyGroupName ErrorIdentifier = 10161
127

128
        // JSConsumerEphemeralWithDurableInSubjectErr consumer expected to be ephemeral but detected a durable name set in subject
129
        JSConsumerEphemeralWithDurableInSubjectErr ErrorIdentifier = 10019
130

131
        // JSConsumerEphemeralWithDurableNameErr consumer expected to be ephemeral but a durable name was set in request
132
        JSConsumerEphemeralWithDurableNameErr ErrorIdentifier = 10020
133

134
        // JSConsumerExistingActiveErr consumer already exists and is still active
135
        JSConsumerExistingActiveErr ErrorIdentifier = 10105
136

137
        // JSConsumerFCRequiresPushErr consumer flow control requires a push based consumer
138
        JSConsumerFCRequiresPushErr ErrorIdentifier = 10089
139

140
        // JSConsumerFilterNotSubsetErr consumer filter subject is not a valid subset of the interest subjects
141
        JSConsumerFilterNotSubsetErr ErrorIdentifier = 10093
142

143
        // JSConsumerHBRequiresPushErr consumer idle heartbeat requires a push based consumer
144
        JSConsumerHBRequiresPushErr ErrorIdentifier = 10088
145

146
        // JSConsumerInactiveThresholdExcess consumer inactive threshold exceeds system limit of {limit}
147
        JSConsumerInactiveThresholdExcess ErrorIdentifier = 10153
148

149
        // JSConsumerInvalidDeliverSubject invalid push consumer deliver subject
150
        JSConsumerInvalidDeliverSubject ErrorIdentifier = 10112
151

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

155
        // JSConsumerInvalidPolicyErrF Generic delivery policy error ({err})
156
        JSConsumerInvalidPolicyErrF ErrorIdentifier = 10094
157

158
        // JSConsumerInvalidPriorityGroupErr Provided priority group does not exist for this consumer
159
        JSConsumerInvalidPriorityGroupErr ErrorIdentifier = 10160
160

161
        // JSConsumerInvalidSamplingErrF failed to parse consumer sampling configuration: {err}
162
        JSConsumerInvalidSamplingErrF ErrorIdentifier = 10095
163

164
        // JSConsumerMaxDeliverBackoffErr max deliver is required to be > length of backoff values
165
        JSConsumerMaxDeliverBackoffErr ErrorIdentifier = 10116
166

167
        // JSConsumerMaxPendingAckExcessErrF consumer max ack pending exceeds system limit of {limit}
168
        JSConsumerMaxPendingAckExcessErrF ErrorIdentifier = 10121
169

170
        // JSConsumerMaxPendingAckPolicyRequiredErr consumer requires ack policy for max ack pending
171
        JSConsumerMaxPendingAckPolicyRequiredErr ErrorIdentifier = 10082
172

173
        // JSConsumerMaxRequestBatchExceededF consumer max request batch exceeds server limit of {limit}
174
        JSConsumerMaxRequestBatchExceededF ErrorIdentifier = 10125
175

176
        // JSConsumerMaxRequestBatchNegativeErr consumer max request batch needs to be > 0
177
        JSConsumerMaxRequestBatchNegativeErr ErrorIdentifier = 10114
178

179
        // JSConsumerMaxRequestExpiresTooSmall consumer max request expires needs to be >= 1ms
180
        JSConsumerMaxRequestExpiresTooSmall ErrorIdentifier = 10115
181

182
        // JSConsumerMaxWaitingNegativeErr consumer max waiting needs to be positive
183
        JSConsumerMaxWaitingNegativeErr ErrorIdentifier = 10087
184

185
        // JSConsumerMetadataLengthErrF consumer metadata exceeds maximum size of {limit}
186
        JSConsumerMetadataLengthErrF ErrorIdentifier = 10135
187

188
        // JSConsumerMultipleFiltersNotAllowed consumer with multiple subject filters cannot use subject based API
189
        JSConsumerMultipleFiltersNotAllowed ErrorIdentifier = 10137
190

191
        // JSConsumerNameContainsPathSeparatorsErr Consumer name can not contain path separators
192
        JSConsumerNameContainsPathSeparatorsErr ErrorIdentifier = 10127
193

194
        // JSConsumerNameExistErr consumer name already in use
195
        JSConsumerNameExistErr ErrorIdentifier = 10013
196

197
        // JSConsumerNameTooLongErrF consumer name is too long, maximum allowed is {max}
198
        JSConsumerNameTooLongErrF ErrorIdentifier = 10102
199

200
        // JSConsumerNotFoundErr consumer not found
201
        JSConsumerNotFoundErr ErrorIdentifier = 10014
202

203
        // JSConsumerOfflineErr consumer is offline
204
        JSConsumerOfflineErr ErrorIdentifier = 10119
205

206
        // JSConsumerOfflineReasonErrF consumer is offline: {err}
207
        JSConsumerOfflineReasonErrF ErrorIdentifier = 10195
208

209
        // JSConsumerOnMappedErr consumer direct on a mapped consumer
210
        JSConsumerOnMappedErr ErrorIdentifier = 10092
211

212
        // JSConsumerOverlappingSubjectFilters consumer subject filters cannot overlap
213
        JSConsumerOverlappingSubjectFilters ErrorIdentifier = 10138
214

215
        // JSConsumerPinnedTTLWithoutPriorityPolicyNone PinnedTTL cannot be set when PriorityPolicy is none
216
        JSConsumerPinnedTTLWithoutPriorityPolicyNone ErrorIdentifier = 10197
217

218
        // JSConsumerPriorityGroupWithPolicyNone consumer can not have priority groups when policy is none
219
        JSConsumerPriorityGroupWithPolicyNone ErrorIdentifier = 10196
220

221
        // JSConsumerPriorityPolicyWithoutGroup Setting PriorityPolicy requires at least one PriorityGroup to be set
222
        JSConsumerPriorityPolicyWithoutGroup ErrorIdentifier = 10159
223

224
        // JSConsumerPullNotDurableErr consumer in pull mode requires a durable name
225
        JSConsumerPullNotDurableErr ErrorIdentifier = 10085
226

227
        // JSConsumerPullRequiresAckErr consumer in pull mode requires explicit ack policy on workqueue stream
228
        JSConsumerPullRequiresAckErr ErrorIdentifier = 10084
229

230
        // JSConsumerPullWithRateLimitErr consumer in pull mode can not have rate limit set
231
        JSConsumerPullWithRateLimitErr ErrorIdentifier = 10086
232

233
        // JSConsumerPushMaxWaitingErr consumer in push mode can not set max waiting
234
        JSConsumerPushMaxWaitingErr ErrorIdentifier = 10080
235

236
        // JSConsumerPushWithPriorityGroupErr priority groups can not be used with push consumers
237
        JSConsumerPushWithPriorityGroupErr ErrorIdentifier = 10178
238

239
        // JSConsumerReplacementWithDifferentNameErr consumer replacement durable config not the same
240
        JSConsumerReplacementWithDifferentNameErr ErrorIdentifier = 10106
241

242
        // JSConsumerReplayPolicyInvalidErr consumer replay policy invalid
243
        JSConsumerReplayPolicyInvalidErr ErrorIdentifier = 10182
244

245
        // JSConsumerReplicasExceedsStream consumer config replica count exceeds parent stream
246
        JSConsumerReplicasExceedsStream ErrorIdentifier = 10126
247

248
        // JSConsumerReplicasShouldMatchStream consumer config replicas must match interest retention stream's replicas
249
        JSConsumerReplicasShouldMatchStream ErrorIdentifier = 10134
250

251
        // JSConsumerSmallHeartbeatErr consumer idle heartbeat needs to be >= 100ms
252
        JSConsumerSmallHeartbeatErr ErrorIdentifier = 10083
253

254
        // JSConsumerStoreFailedErrF error creating store for consumer: {err}
255
        JSConsumerStoreFailedErrF ErrorIdentifier = 10104
256

257
        // JSConsumerWQConsumerNotDeliverAllErr consumer must be deliver all on workqueue stream
258
        JSConsumerWQConsumerNotDeliverAllErr ErrorIdentifier = 10101
259

260
        // JSConsumerWQConsumerNotUniqueErr filtered consumer not unique on workqueue stream
261
        JSConsumerWQConsumerNotUniqueErr ErrorIdentifier = 10100
262

263
        // JSConsumerWQMultipleUnfilteredErr multiple non-filtered consumers not allowed on workqueue stream
264
        JSConsumerWQMultipleUnfilteredErr ErrorIdentifier = 10099
265

266
        // JSConsumerWQRequiresExplicitAckErr workqueue stream requires explicit ack
267
        JSConsumerWQRequiresExplicitAckErr ErrorIdentifier = 10098
268

269
        // JSConsumerWithFlowControlNeedsHeartbeats consumer with flow control also needs heartbeats
270
        JSConsumerWithFlowControlNeedsHeartbeats ErrorIdentifier = 10108
271

272
        // JSInsufficientResourcesErr insufficient resources
273
        JSInsufficientResourcesErr ErrorIdentifier = 10023
274

275
        // JSInvalidJSONErr invalid JSON: {err}
276
        JSInvalidJSONErr ErrorIdentifier = 10025
277

278
        // JSMaximumConsumersLimitErr maximum consumers limit reached
279
        JSMaximumConsumersLimitErr ErrorIdentifier = 10026
280

281
        // JSMaximumStreamsLimitErr maximum number of streams reached
282
        JSMaximumStreamsLimitErr ErrorIdentifier = 10027
283

284
        // JSMemoryResourcesExceededErr insufficient memory resources available
285
        JSMemoryResourcesExceededErr ErrorIdentifier = 10028
286

287
        // JSMessageCounterBrokenErr message counter is broken
288
        JSMessageCounterBrokenErr ErrorIdentifier = 10172
289

290
        // JSMessageIncrDisabledErr message counters is disabled
291
        JSMessageIncrDisabledErr ErrorIdentifier = 10168
292

293
        // JSMessageIncrInvalidErr message counter increment is invalid
294
        JSMessageIncrInvalidErr ErrorIdentifier = 10171
295

296
        // JSMessageIncrMissingErr message counter increment is missing
297
        JSMessageIncrMissingErr ErrorIdentifier = 10169
298

299
        // JSMessageIncrPayloadErr message counter has payload
300
        JSMessageIncrPayloadErr ErrorIdentifier = 10170
301

302
        // JSMessageSchedulesDisabledErr message schedules is disabled
303
        JSMessageSchedulesDisabledErr ErrorIdentifier = 10188
304

305
        // JSMessageSchedulesPatternInvalidErr message schedules pattern is invalid
306
        JSMessageSchedulesPatternInvalidErr ErrorIdentifier = 10189
307

308
        // JSMessageSchedulesRollupInvalidErr message schedules invalid rollup
309
        JSMessageSchedulesRollupInvalidErr ErrorIdentifier = 10192
310

311
        // JSMessageSchedulesTTLInvalidErr message schedules invalid per-message TTL
312
        JSMessageSchedulesTTLInvalidErr ErrorIdentifier = 10191
313

314
        // JSMessageSchedulesTargetInvalidErr message schedules target is invalid
315
        JSMessageSchedulesTargetInvalidErr ErrorIdentifier = 10190
316

317
        // JSMessageTTLDisabledErr per-message TTL is disabled
318
        JSMessageTTLDisabledErr ErrorIdentifier = 10166
319

320
        // JSMessageTTLInvalidErr invalid per-message TTL
321
        JSMessageTTLInvalidErr ErrorIdentifier = 10165
322

323
        // JSMirrorConsumerSetupFailedErrF generic mirror consumer setup failure string ({err})
324
        JSMirrorConsumerSetupFailedErrF ErrorIdentifier = 10029
325

326
        // JSMirrorInvalidStreamName mirrored stream name is invalid
327
        JSMirrorInvalidStreamName ErrorIdentifier = 10142
328

329
        // JSMirrorInvalidSubjectFilter mirror transform source: {err}
330
        JSMirrorInvalidSubjectFilter ErrorIdentifier = 10151
331

332
        // JSMirrorInvalidTransformDestination mirror transform: {err}
333
        JSMirrorInvalidTransformDestination ErrorIdentifier = 10154
334

335
        // JSMirrorMaxMessageSizeTooBigErr stream mirror must have max message size >= source
336
        JSMirrorMaxMessageSizeTooBigErr ErrorIdentifier = 10030
337

338
        // JSMirrorMultipleFiltersNotAllowed mirror with multiple subject transforms cannot also have a single subject filter
339
        JSMirrorMultipleFiltersNotAllowed ErrorIdentifier = 10150
340

341
        // JSMirrorOverlappingSubjectFilters mirror subject filters can not overlap
342
        JSMirrorOverlappingSubjectFilters ErrorIdentifier = 10152
343

344
        // JSMirrorWithAtomicPublishErr stream mirrors can not also use atomic publishing
345
        JSMirrorWithAtomicPublishErr ErrorIdentifier = 10198
346

347
        // JSMirrorWithCountersErr stream mirrors can not also calculate counters
348
        JSMirrorWithCountersErr ErrorIdentifier = 10173
349

350
        // JSMirrorWithFirstSeqErr stream mirrors can not have first sequence configured
351
        JSMirrorWithFirstSeqErr ErrorIdentifier = 10143
352

353
        // JSMirrorWithMsgSchedulesErr stream mirrors can not also schedule messages
354
        JSMirrorWithMsgSchedulesErr ErrorIdentifier = 10186
355

356
        // JSMirrorWithSourcesErr stream mirrors can not also contain other sources
357
        JSMirrorWithSourcesErr ErrorIdentifier = 10031
358

359
        // JSMirrorWithStartSeqAndTimeErr stream mirrors can not have both start seq and start time configured
360
        JSMirrorWithStartSeqAndTimeErr ErrorIdentifier = 10032
361

362
        // JSMirrorWithSubjectFiltersErr stream mirrors can not contain filtered subjects
363
        JSMirrorWithSubjectFiltersErr ErrorIdentifier = 10033
364

365
        // JSMirrorWithSubjectsErr stream mirrors can not contain subjects
366
        JSMirrorWithSubjectsErr ErrorIdentifier = 10034
367

368
        // JSNoAccountErr account not found
369
        JSNoAccountErr ErrorIdentifier = 10035
370

371
        // JSNoLimitsErr no JetStream default or applicable tiered limit present
372
        JSNoLimitsErr ErrorIdentifier = 10120
373

374
        // JSNoMessageFoundErr no message found
375
        JSNoMessageFoundErr ErrorIdentifier = 10037
376

377
        // JSNotEmptyRequestErr expected an empty request payload
378
        JSNotEmptyRequestErr ErrorIdentifier = 10038
379

380
        // JSNotEnabledErr JetStream not enabled
381
        JSNotEnabledErr ErrorIdentifier = 10076
382

383
        // JSNotEnabledForAccountErr JetStream not enabled for account
384
        JSNotEnabledForAccountErr ErrorIdentifier = 10039
385

386
        // JSPedanticErrF pedantic mode: {err}
387
        JSPedanticErrF ErrorIdentifier = 10157
388

389
        // JSPeerRemapErr peer remap failed
390
        JSPeerRemapErr ErrorIdentifier = 10075
391

392
        // JSRaftGeneralErrF General RAFT error string ({err})
393
        JSRaftGeneralErrF ErrorIdentifier = 10041
394

395
        // JSReplicasCountCannotBeNegative replicas count cannot be negative
396
        JSReplicasCountCannotBeNegative ErrorIdentifier = 10133
397

398
        // JSRequiredApiLevelErr JetStream minimum api level required
399
        JSRequiredApiLevelErr ErrorIdentifier = 10185
400

401
        // JSRestoreSubscribeFailedErrF JetStream unable to subscribe to restore snapshot {subject}: {err}
402
        JSRestoreSubscribeFailedErrF ErrorIdentifier = 10042
403

404
        // JSSequenceNotFoundErrF sequence {seq} not found
405
        JSSequenceNotFoundErrF ErrorIdentifier = 10043
406

407
        // JSSnapshotDeliverSubjectInvalidErr deliver subject not valid
408
        JSSnapshotDeliverSubjectInvalidErr ErrorIdentifier = 10015
409

410
        // JSSourceConsumerSetupFailedErrF General source consumer setup failure string ({err})
411
        JSSourceConsumerSetupFailedErrF ErrorIdentifier = 10045
412

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

416
        // JSSourceInvalidStreamName sourced stream name is invalid
417
        JSSourceInvalidStreamName ErrorIdentifier = 10141
418

419
        // JSSourceInvalidSubjectFilter source transform source: {err}
420
        JSSourceInvalidSubjectFilter ErrorIdentifier = 10145
421

422
        // JSSourceInvalidTransformDestination source transform: {err}
423
        JSSourceInvalidTransformDestination ErrorIdentifier = 10146
424

425
        // JSSourceMaxMessageSizeTooBigErr stream source must have max message size >= target
426
        JSSourceMaxMessageSizeTooBigErr ErrorIdentifier = 10046
427

428
        // JSSourceMultipleFiltersNotAllowed source with multiple subject transforms cannot also have a single subject filter
429
        JSSourceMultipleFiltersNotAllowed ErrorIdentifier = 10144
430

431
        // JSSourceOverlappingSubjectFilters source filters can not overlap
432
        JSSourceOverlappingSubjectFilters ErrorIdentifier = 10147
433

434
        // JSSourceWithMsgSchedulesErr stream source can not also schedule messages
435
        JSSourceWithMsgSchedulesErr ErrorIdentifier = 10187
436

437
        // JSStorageResourcesExceededErr insufficient storage resources available
438
        JSStorageResourcesExceededErr ErrorIdentifier = 10047
439

440
        // JSStreamAssignmentErrF Generic stream assignment error string ({err})
441
        JSStreamAssignmentErrF ErrorIdentifier = 10048
442

443
        // JSStreamCreateErrF Generic stream creation error string ({err})
444
        JSStreamCreateErrF ErrorIdentifier = 10049
445

446
        // JSStreamDeleteErrF General stream deletion error string ({err})
447
        JSStreamDeleteErrF ErrorIdentifier = 10050
448

449
        // JSStreamDuplicateMessageConflict duplicate message id is in process
450
        JSStreamDuplicateMessageConflict ErrorIdentifier = 10158
451

452
        // JSStreamExpectedLastSeqPerSubjectInvalid missing sequence for expected last sequence per subject
453
        JSStreamExpectedLastSeqPerSubjectInvalid ErrorIdentifier = 10193
454

455
        // JSStreamExpectedLastSeqPerSubjectNotReady expected last sequence per subject temporarily unavailable
456
        JSStreamExpectedLastSeqPerSubjectNotReady ErrorIdentifier = 10163
457

458
        // JSStreamExternalApiOverlapErrF stream external api prefix {prefix} must not overlap with {subject}
459
        JSStreamExternalApiOverlapErrF ErrorIdentifier = 10021
460

461
        // JSStreamExternalDelPrefixOverlapsErrF stream external delivery prefix {prefix} overlaps with stream subject {subject}
462
        JSStreamExternalDelPrefixOverlapsErrF ErrorIdentifier = 10022
463

464
        // JSStreamGeneralErrorF General stream failure string ({err})
465
        JSStreamGeneralErrorF ErrorIdentifier = 10051
466

467
        // JSStreamHeaderExceedsMaximumErr header size exceeds maximum allowed of 64k
468
        JSStreamHeaderExceedsMaximumErr ErrorIdentifier = 10097
469

470
        // JSStreamInfoMaxSubjectsErr subject details would exceed maximum allowed
471
        JSStreamInfoMaxSubjectsErr ErrorIdentifier = 10117
472

473
        // JSStreamInvalidConfigF Stream configuration validation error string ({err})
474
        JSStreamInvalidConfigF ErrorIdentifier = 10052
475

476
        // JSStreamInvalidErr stream not valid
477
        JSStreamInvalidErr ErrorIdentifier = 10096
478

479
        // JSStreamInvalidExternalDeliverySubjErrF stream external delivery prefix {prefix} must not contain wildcards
480
        JSStreamInvalidExternalDeliverySubjErrF ErrorIdentifier = 10024
481

482
        // JSStreamLimitsErrF General stream limits exceeded error string ({err})
483
        JSStreamLimitsErrF ErrorIdentifier = 10053
484

485
        // JSStreamMaxBytesRequired account requires a stream config to have max bytes set
486
        JSStreamMaxBytesRequired ErrorIdentifier = 10113
487

488
        // JSStreamMaxStreamBytesExceeded stream max bytes exceeds account limit max stream bytes
489
        JSStreamMaxStreamBytesExceeded ErrorIdentifier = 10122
490

491
        // JSStreamMessageExceedsMaximumErr message size exceeds maximum allowed
492
        JSStreamMessageExceedsMaximumErr ErrorIdentifier = 10054
493

494
        // JSStreamMinLastSeqErr min last sequence
495
        JSStreamMinLastSeqErr ErrorIdentifier = 10180
496

497
        // JSStreamMirrorNotUpdatableErr stream mirror configuration can not be updated
498
        JSStreamMirrorNotUpdatableErr ErrorIdentifier = 10055
499

500
        // JSStreamMismatchErr stream name in subject does not match request
501
        JSStreamMismatchErr ErrorIdentifier = 10056
502

503
        // JSStreamMoveAndScaleErr can not move and scale a stream in a single update
504
        JSStreamMoveAndScaleErr ErrorIdentifier = 10123
505

506
        // JSStreamMoveInProgressF stream move already in progress: {msg}
507
        JSStreamMoveInProgressF ErrorIdentifier = 10124
508

509
        // JSStreamMoveNotInProgress stream move not in progress
510
        JSStreamMoveNotInProgress ErrorIdentifier = 10129
511

512
        // JSStreamMsgDeleteFailedF Generic message deletion failure error string ({err})
513
        JSStreamMsgDeleteFailedF ErrorIdentifier = 10057
514

515
        // JSStreamNameContainsPathSeparatorsErr Stream name can not contain path separators
516
        JSStreamNameContainsPathSeparatorsErr ErrorIdentifier = 10128
517

518
        // JSStreamNameExistErr stream name already in use with a different configuration
519
        JSStreamNameExistErr ErrorIdentifier = 10058
520

521
        // JSStreamNameExistRestoreFailedErr stream name already in use, cannot restore
522
        JSStreamNameExistRestoreFailedErr ErrorIdentifier = 10130
523

524
        // JSStreamNotFoundErr stream not found
525
        JSStreamNotFoundErr ErrorIdentifier = 10059
526

527
        // JSStreamNotMatchErr expected stream does not match
528
        JSStreamNotMatchErr ErrorIdentifier = 10060
529

530
        // JSStreamOfflineErr stream is offline
531
        JSStreamOfflineErr ErrorIdentifier = 10118
532

533
        // JSStreamOfflineReasonErrF stream is offline: {err}
534
        JSStreamOfflineReasonErrF ErrorIdentifier = 10194
535

536
        // JSStreamPurgeFailedF Generic stream purge failure error string ({err})
537
        JSStreamPurgeFailedF ErrorIdentifier = 10110
538

539
        // JSStreamReplicasNotSupportedErr replicas > 1 not supported in non-clustered mode
540
        JSStreamReplicasNotSupportedErr ErrorIdentifier = 10074
541

542
        // JSStreamReplicasNotUpdatableErr Replicas configuration can not be updated
543
        JSStreamReplicasNotUpdatableErr ErrorIdentifier = 10061
544

545
        // JSStreamRestoreErrF restore failed: {err}
546
        JSStreamRestoreErrF ErrorIdentifier = 10062
547

548
        // JSStreamRollupFailedF Generic stream rollup failure error string ({err})
549
        JSStreamRollupFailedF ErrorIdentifier = 10111
550

551
        // JSStreamSealedErr invalid operation on sealed stream
552
        JSStreamSealedErr ErrorIdentifier = 10109
553

554
        // JSStreamSequenceNotMatchErr expected stream sequence does not match
555
        JSStreamSequenceNotMatchErr ErrorIdentifier = 10063
556

557
        // JSStreamSnapshotErrF snapshot failed: {err}
558
        JSStreamSnapshotErrF ErrorIdentifier = 10064
559

560
        // JSStreamStoreFailedF Generic error when storing a message failed ({err})
561
        JSStreamStoreFailedF ErrorIdentifier = 10077
562

563
        // JSStreamSubjectOverlapErr subjects overlap with an existing stream
564
        JSStreamSubjectOverlapErr ErrorIdentifier = 10065
565

566
        // JSStreamTemplateCreateErrF Generic template creation failed string ({err})
567
        JSStreamTemplateCreateErrF ErrorIdentifier = 10066
568

569
        // JSStreamTemplateDeleteErrF Generic stream template deletion failed error string ({err})
570
        JSStreamTemplateDeleteErrF ErrorIdentifier = 10067
571

572
        // JSStreamTemplateNotFoundErr template not found
573
        JSStreamTemplateNotFoundErr ErrorIdentifier = 10068
574

575
        // JSStreamTooManyRequests too many requests
576
        JSStreamTooManyRequests ErrorIdentifier = 10167
577

578
        // JSStreamTransformInvalidDestination stream transform: {err}
579
        JSStreamTransformInvalidDestination ErrorIdentifier = 10156
580

581
        // JSStreamTransformInvalidSource stream transform source: {err}
582
        JSStreamTransformInvalidSource ErrorIdentifier = 10155
583

584
        // JSStreamUpdateErrF Generic stream update error string ({err})
585
        JSStreamUpdateErrF ErrorIdentifier = 10069
586

587
        // JSStreamWrongLastMsgIDErrF wrong last msg ID: {id}
588
        JSStreamWrongLastMsgIDErrF ErrorIdentifier = 10070
589

590
        // JSStreamWrongLastSequenceConstantErr wrong last sequence
591
        JSStreamWrongLastSequenceConstantErr ErrorIdentifier = 10164
592

593
        // JSStreamWrongLastSequenceErrF wrong last sequence: {seq}
594
        JSStreamWrongLastSequenceErrF ErrorIdentifier = 10071
595

596
        // JSTempStorageFailedErr JetStream unable to open temp storage for restore
597
        JSTempStorageFailedErr ErrorIdentifier = 10072
598

599
        // JSTemplateNameNotMatchSubjectErr template name in subject does not match request
600
        JSTemplateNameNotMatchSubjectErr ErrorIdentifier = 10073
601
)
602

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

828
// NewJSAccountResourcesExceededError creates a new JSAccountResourcesExceededErr error: "resource limits exceeded for account"
829
func NewJSAccountResourcesExceededError(opts ...ErrorOption) *ApiError {
20,057✔
830
        eopts := parseOpts(opts)
20,057✔
831
        if ae, ok := eopts.err.(*ApiError); ok {
20,057✔
832
                return ae
×
833
        }
×
834

835
        return ApiErrors[JSAccountResourcesExceededErr]
20,057✔
836
}
837

838
// NewJSAtomicPublishDisabledError creates a new JSAtomicPublishDisabledErr error: "atomic publish is disabled"
839
func NewJSAtomicPublishDisabledError(opts ...ErrorOption) *ApiError {
24✔
840
        eopts := parseOpts(opts)
24✔
841
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
842
                return ae
×
843
        }
×
844

845
        return ApiErrors[JSAtomicPublishDisabledErr]
24✔
846
}
847

848
// NewJSAtomicPublishIncompleteBatchError creates a new JSAtomicPublishIncompleteBatchErr error: "atomic publish batch is incomplete"
849
func NewJSAtomicPublishIncompleteBatchError(opts ...ErrorOption) *ApiError {
62✔
850
        eopts := parseOpts(opts)
62✔
851
        if ae, ok := eopts.err.(*ApiError); ok {
62✔
852
                return ae
×
853
        }
×
854

855
        return ApiErrors[JSAtomicPublishIncompleteBatchErr]
62✔
856
}
857

858
// NewJSAtomicPublishInvalidBatchIDError creates a new JSAtomicPublishInvalidBatchIDErr error: "atomic publish batch ID is invalid"
859
func NewJSAtomicPublishInvalidBatchIDError(opts ...ErrorOption) *ApiError {
4✔
860
        eopts := parseOpts(opts)
4✔
861
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
862
                return ae
×
863
        }
×
864

865
        return ApiErrors[JSAtomicPublishInvalidBatchIDErr]
4✔
866
}
867

868
// NewJSAtomicPublishMissingSeqError creates a new JSAtomicPublishMissingSeqErr error: "atomic publish sequence is missing"
869
func NewJSAtomicPublishMissingSeqError(opts ...ErrorOption) *ApiError {
24✔
870
        eopts := parseOpts(opts)
24✔
871
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
872
                return ae
×
873
        }
×
874

875
        return ApiErrors[JSAtomicPublishMissingSeqErr]
24✔
876
}
877

878
// NewJSAtomicPublishTooLargeBatchError creates a new JSAtomicPublishTooLargeBatchErrF error: "atomic publish batch is too large: {size}"
879
func NewJSAtomicPublishTooLargeBatchError(size interface{}, opts ...ErrorOption) *ApiError {
10✔
880
        eopts := parseOpts(opts)
10✔
881
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
882
                return ae
×
883
        }
×
884

885
        e := ApiErrors[JSAtomicPublishTooLargeBatchErrF]
10✔
886
        args := e.toReplacerArgs([]interface{}{"{size}", size})
10✔
887
        return &ApiError{
10✔
888
                Code:        e.Code,
10✔
889
                ErrCode:     e.ErrCode,
10✔
890
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
891
        }
10✔
892
}
893

894
// NewJSAtomicPublishUnsupportedHeaderBatchError creates a new JSAtomicPublishUnsupportedHeaderBatchErr error: "atomic publish unsupported header used: {header}"
895
func NewJSAtomicPublishUnsupportedHeaderBatchError(header interface{}, opts ...ErrorOption) *ApiError {
32✔
896
        eopts := parseOpts(opts)
32✔
897
        if ae, ok := eopts.err.(*ApiError); ok {
32✔
898
                return ae
×
899
        }
×
900

901
        e := ApiErrors[JSAtomicPublishUnsupportedHeaderBatchErr]
32✔
902
        args := e.toReplacerArgs([]interface{}{"{header}", header})
32✔
903
        return &ApiError{
32✔
904
                Code:        e.Code,
32✔
905
                ErrCode:     e.ErrCode,
32✔
906
                Description: strings.NewReplacer(args...).Replace(e.Description),
32✔
907
        }
32✔
908
}
909

910
// NewJSBadRequestError creates a new JSBadRequestErr error: "bad request"
911
func NewJSBadRequestError(opts ...ErrorOption) *ApiError {
10✔
912
        eopts := parseOpts(opts)
10✔
913
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
914
                return ae
×
915
        }
×
916

917
        return ApiErrors[JSBadRequestErr]
10✔
918
}
919

920
// NewJSClusterIncompleteError creates a new JSClusterIncompleteErr error: "incomplete results"
921
func NewJSClusterIncompleteError(opts ...ErrorOption) *ApiError {
×
922
        eopts := parseOpts(opts)
×
923
        if ae, ok := eopts.err.(*ApiError); ok {
×
924
                return ae
×
925
        }
×
926

927
        return ApiErrors[JSClusterIncompleteErr]
×
928
}
929

930
// NewJSClusterNoPeersError creates a new JSClusterNoPeersErrF error: "{err}"
931
func NewJSClusterNoPeersError(err error, opts ...ErrorOption) *ApiError {
59✔
932
        eopts := parseOpts(opts)
59✔
933
        if ae, ok := eopts.err.(*ApiError); ok {
59✔
934
                return ae
×
935
        }
×
936

937
        e := ApiErrors[JSClusterNoPeersErrF]
59✔
938
        args := e.toReplacerArgs([]interface{}{"{err}", err})
59✔
939
        return &ApiError{
59✔
940
                Code:        e.Code,
59✔
941
                ErrCode:     e.ErrCode,
59✔
942
                Description: strings.NewReplacer(args...).Replace(e.Description),
59✔
943
        }
59✔
944
}
945

946
// NewJSClusterNotActiveError creates a new JSClusterNotActiveErr error: "JetStream not in clustered mode"
947
func NewJSClusterNotActiveError(opts ...ErrorOption) *ApiError {
1✔
948
        eopts := parseOpts(opts)
1✔
949
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
950
                return ae
×
951
        }
×
952

953
        return ApiErrors[JSClusterNotActiveErr]
1✔
954
}
955

956
// NewJSClusterNotAssignedError creates a new JSClusterNotAssignedErr error: "JetStream cluster not assigned to this server"
957
func NewJSClusterNotAssignedError(opts ...ErrorOption) *ApiError {
20✔
958
        eopts := parseOpts(opts)
20✔
959
        if ae, ok := eopts.err.(*ApiError); ok {
20✔
960
                return ae
×
961
        }
×
962

963
        return ApiErrors[JSClusterNotAssignedErr]
20✔
964
}
965

966
// NewJSClusterNotAvailError creates a new JSClusterNotAvailErr error: "JetStream system temporarily unavailable"
967
func NewJSClusterNotAvailError(opts ...ErrorOption) *ApiError {
13✔
968
        eopts := parseOpts(opts)
13✔
969
        if ae, ok := eopts.err.(*ApiError); ok {
13✔
970
                return ae
×
971
        }
×
972

973
        return ApiErrors[JSClusterNotAvailErr]
13✔
974
}
975

976
// NewJSClusterNotLeaderError creates a new JSClusterNotLeaderErr error: "JetStream cluster can not handle request"
977
func NewJSClusterNotLeaderError(opts ...ErrorOption) *ApiError {
443✔
978
        eopts := parseOpts(opts)
443✔
979
        if ae, ok := eopts.err.(*ApiError); ok {
443✔
980
                return ae
×
981
        }
×
982

983
        return ApiErrors[JSClusterNotLeaderErr]
443✔
984
}
985

986
// NewJSClusterPeerNotMemberError creates a new JSClusterPeerNotMemberErr error: "peer not a member"
987
func NewJSClusterPeerNotMemberError(opts ...ErrorOption) *ApiError {
1✔
988
        eopts := parseOpts(opts)
1✔
989
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
990
                return ae
×
991
        }
×
992

993
        return ApiErrors[JSClusterPeerNotMemberErr]
1✔
994
}
995

996
// NewJSClusterRequiredError creates a new JSClusterRequiredErr error: "JetStream clustering support required"
997
func NewJSClusterRequiredError(opts ...ErrorOption) *ApiError {
×
998
        eopts := parseOpts(opts)
×
999
        if ae, ok := eopts.err.(*ApiError); ok {
×
1000
                return ae
×
1001
        }
×
1002

1003
        return ApiErrors[JSClusterRequiredErr]
×
1004
}
1005

1006
// NewJSClusterServerNotMemberError creates a new JSClusterServerNotMemberErr error: "server is not a member of the cluster"
1007
func NewJSClusterServerNotMemberError(opts ...ErrorOption) *ApiError {
3✔
1008
        eopts := parseOpts(opts)
3✔
1009
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1010
                return ae
×
1011
        }
×
1012

1013
        return ApiErrors[JSClusterServerNotMemberErr]
3✔
1014
}
1015

1016
// NewJSClusterTagsError creates a new JSClusterTagsErr error: "tags placement not supported for operation"
1017
func NewJSClusterTagsError(opts ...ErrorOption) *ApiError {
×
1018
        eopts := parseOpts(opts)
×
1019
        if ae, ok := eopts.err.(*ApiError); ok {
×
1020
                return ae
×
1021
        }
×
1022

1023
        return ApiErrors[JSClusterTagsErr]
×
1024
}
1025

1026
// NewJSClusterUnSupportFeatureError creates a new JSClusterUnSupportFeatureErr error: "not currently supported in clustered mode"
1027
func NewJSClusterUnSupportFeatureError(opts ...ErrorOption) *ApiError {
6✔
1028
        eopts := parseOpts(opts)
6✔
1029
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1030
                return ae
×
1031
        }
×
1032

1033
        return ApiErrors[JSClusterUnSupportFeatureErr]
6✔
1034
}
1035

1036
// NewJSConsumerAckPolicyInvalidError creates a new JSConsumerAckPolicyInvalidErr error: "consumer ack policy invalid"
1037
func NewJSConsumerAckPolicyInvalidError(opts ...ErrorOption) *ApiError {
2✔
1038
        eopts := parseOpts(opts)
2✔
1039
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1040
                return ae
×
1041
        }
×
1042

1043
        return ApiErrors[JSConsumerAckPolicyInvalidErr]
2✔
1044
}
1045

1046
// NewJSConsumerAckWaitNegativeError creates a new JSConsumerAckWaitNegativeErr error: "consumer ack wait needs to be positive"
1047
func NewJSConsumerAckWaitNegativeError(opts ...ErrorOption) *ApiError {
2✔
1048
        eopts := parseOpts(opts)
2✔
1049
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1050
                return ae
×
1051
        }
×
1052

1053
        return ApiErrors[JSConsumerAckWaitNegativeErr]
2✔
1054
}
1055

1056
// NewJSConsumerAlreadyExistsError creates a new JSConsumerAlreadyExists error: "consumer already exists"
1057
func NewJSConsumerAlreadyExistsError(opts ...ErrorOption) *ApiError {
5✔
1058
        eopts := parseOpts(opts)
5✔
1059
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
1060
                return ae
×
1061
        }
×
1062

1063
        return ApiErrors[JSConsumerAlreadyExists]
5✔
1064
}
1065

1066
// NewJSConsumerBackOffNegativeError creates a new JSConsumerBackOffNegativeErr error: "consumer backoff needs to be positive"
1067
func NewJSConsumerBackOffNegativeError(opts ...ErrorOption) *ApiError {
2✔
1068
        eopts := parseOpts(opts)
2✔
1069
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1070
                return ae
×
1071
        }
×
1072

1073
        return ApiErrors[JSConsumerBackOffNegativeErr]
2✔
1074
}
1075

1076
// NewJSConsumerBadDurableNameError creates a new JSConsumerBadDurableNameErr error: "durable name can not contain '.', '*', '>'"
1077
func NewJSConsumerBadDurableNameError(opts ...ErrorOption) *ApiError {
×
1078
        eopts := parseOpts(opts)
×
1079
        if ae, ok := eopts.err.(*ApiError); ok {
×
1080
                return ae
×
1081
        }
×
1082

1083
        return ApiErrors[JSConsumerBadDurableNameErr]
×
1084
}
1085

1086
// NewJSConsumerConfigRequiredError creates a new JSConsumerConfigRequiredErr error: "consumer config required"
1087
func NewJSConsumerConfigRequiredError(opts ...ErrorOption) *ApiError {
2✔
1088
        eopts := parseOpts(opts)
2✔
1089
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1090
                return ae
×
1091
        }
×
1092

1093
        return ApiErrors[JSConsumerConfigRequiredErr]
2✔
1094
}
1095

1096
// NewJSConsumerCreateDurableAndNameMismatchError creates a new JSConsumerCreateDurableAndNameMismatch error: "Consumer Durable and Name have to be equal if both are provided"
1097
func NewJSConsumerCreateDurableAndNameMismatchError(opts ...ErrorOption) *ApiError {
1✔
1098
        eopts := parseOpts(opts)
1✔
1099
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1100
                return ae
×
1101
        }
×
1102

1103
        return ApiErrors[JSConsumerCreateDurableAndNameMismatch]
1✔
1104
}
1105

1106
// NewJSConsumerCreateError creates a new JSConsumerCreateErrF error: "{err}"
1107
func NewJSConsumerCreateError(err error, opts ...ErrorOption) *ApiError {
71✔
1108
        eopts := parseOpts(opts)
71✔
1109
        if ae, ok := eopts.err.(*ApiError); ok {
124✔
1110
                return ae
53✔
1111
        }
53✔
1112

1113
        e := ApiErrors[JSConsumerCreateErrF]
18✔
1114
        args := e.toReplacerArgs([]interface{}{"{err}", err})
18✔
1115
        return &ApiError{
18✔
1116
                Code:        e.Code,
18✔
1117
                ErrCode:     e.ErrCode,
18✔
1118
                Description: strings.NewReplacer(args...).Replace(e.Description),
18✔
1119
        }
18✔
1120
}
1121

1122
// NewJSConsumerCreateFilterSubjectMismatchError creates a new JSConsumerCreateFilterSubjectMismatchErr error: "Consumer create request did not match filtered subject from create subject"
1123
func NewJSConsumerCreateFilterSubjectMismatchError(opts ...ErrorOption) *ApiError {
2✔
1124
        eopts := parseOpts(opts)
2✔
1125
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1126
                return ae
×
1127
        }
×
1128

1129
        return ApiErrors[JSConsumerCreateFilterSubjectMismatchErr]
2✔
1130
}
1131

1132
// NewJSConsumerDeliverCycleError creates a new JSConsumerDeliverCycleErr error: "consumer deliver subject forms a cycle"
1133
func NewJSConsumerDeliverCycleError(opts ...ErrorOption) *ApiError {
4✔
1134
        eopts := parseOpts(opts)
4✔
1135
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1136
                return ae
×
1137
        }
×
1138

1139
        return ApiErrors[JSConsumerDeliverCycleErr]
4✔
1140
}
1141

1142
// NewJSConsumerDeliverToWildcardsError creates a new JSConsumerDeliverToWildcardsErr error: "consumer deliver subject has wildcards"
1143
func NewJSConsumerDeliverToWildcardsError(opts ...ErrorOption) *ApiError {
4✔
1144
        eopts := parseOpts(opts)
4✔
1145
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1146
                return ae
×
1147
        }
×
1148

1149
        return ApiErrors[JSConsumerDeliverToWildcardsErr]
4✔
1150
}
1151

1152
// NewJSConsumerDescriptionTooLongError creates a new JSConsumerDescriptionTooLongErrF error: "consumer description is too long, maximum allowed is {max}"
1153
func NewJSConsumerDescriptionTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
1✔
1154
        eopts := parseOpts(opts)
1✔
1155
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1156
                return ae
×
1157
        }
×
1158

1159
        e := ApiErrors[JSConsumerDescriptionTooLongErrF]
1✔
1160
        args := e.toReplacerArgs([]interface{}{"{max}", max})
1✔
1161
        return &ApiError{
1✔
1162
                Code:        e.Code,
1✔
1163
                ErrCode:     e.ErrCode,
1✔
1164
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1165
        }
1✔
1166
}
1167

1168
// NewJSConsumerDirectRequiresEphemeralError creates a new JSConsumerDirectRequiresEphemeralErr error: "consumer direct requires an ephemeral consumer"
1169
func NewJSConsumerDirectRequiresEphemeralError(opts ...ErrorOption) *ApiError {
×
1170
        eopts := parseOpts(opts)
×
1171
        if ae, ok := eopts.err.(*ApiError); ok {
×
1172
                return ae
×
1173
        }
×
1174

1175
        return ApiErrors[JSConsumerDirectRequiresEphemeralErr]
×
1176
}
1177

1178
// NewJSConsumerDirectRequiresPushError creates a new JSConsumerDirectRequiresPushErr error: "consumer direct requires a push based consumer"
1179
func NewJSConsumerDirectRequiresPushError(opts ...ErrorOption) *ApiError {
×
1180
        eopts := parseOpts(opts)
×
1181
        if ae, ok := eopts.err.(*ApiError); ok {
×
1182
                return ae
×
1183
        }
×
1184

1185
        return ApiErrors[JSConsumerDirectRequiresPushErr]
×
1186
}
1187

1188
// NewJSConsumerDoesNotExistError creates a new JSConsumerDoesNotExist error: "consumer does not exist"
1189
func NewJSConsumerDoesNotExistError(opts ...ErrorOption) *ApiError {
3✔
1190
        eopts := parseOpts(opts)
3✔
1191
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1192
                return ae
×
1193
        }
×
1194

1195
        return ApiErrors[JSConsumerDoesNotExist]
3✔
1196
}
1197

1198
// NewJSConsumerDuplicateFilterSubjectsError creates a new JSConsumerDuplicateFilterSubjects error: "consumer cannot have both FilterSubject and FilterSubjects specified"
1199
func NewJSConsumerDuplicateFilterSubjectsError(opts ...ErrorOption) *ApiError {
1✔
1200
        eopts := parseOpts(opts)
1✔
1201
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1202
                return ae
×
1203
        }
×
1204

1205
        return ApiErrors[JSConsumerDuplicateFilterSubjects]
1✔
1206
}
1207

1208
// NewJSConsumerDurableNameNotInSubjectError creates a new JSConsumerDurableNameNotInSubjectErr error: "consumer expected to be durable but no durable name set in subject"
1209
func NewJSConsumerDurableNameNotInSubjectError(opts ...ErrorOption) *ApiError {
×
1210
        eopts := parseOpts(opts)
×
1211
        if ae, ok := eopts.err.(*ApiError); ok {
×
1212
                return ae
×
1213
        }
×
1214

1215
        return ApiErrors[JSConsumerDurableNameNotInSubjectErr]
×
1216
}
1217

1218
// NewJSConsumerDurableNameNotMatchSubjectError creates a new JSConsumerDurableNameNotMatchSubjectErr error: "consumer name in subject does not match durable name in request"
1219
func NewJSConsumerDurableNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
×
1220
        eopts := parseOpts(opts)
×
1221
        if ae, ok := eopts.err.(*ApiError); ok {
×
1222
                return ae
×
1223
        }
×
1224

1225
        return ApiErrors[JSConsumerDurableNameNotMatchSubjectErr]
×
1226
}
1227

1228
// NewJSConsumerDurableNameNotSetError creates a new JSConsumerDurableNameNotSetErr error: "consumer expected to be durable but a durable name was not set"
1229
func NewJSConsumerDurableNameNotSetError(opts ...ErrorOption) *ApiError {
1✔
1230
        eopts := parseOpts(opts)
1✔
1231
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1232
                return ae
×
1233
        }
×
1234

1235
        return ApiErrors[JSConsumerDurableNameNotSetErr]
1✔
1236
}
1237

1238
// NewJSConsumerEmptyFilterError creates a new JSConsumerEmptyFilter error: "consumer filter in FilterSubjects cannot be empty"
1239
func NewJSConsumerEmptyFilterError(opts ...ErrorOption) *ApiError {
1✔
1240
        eopts := parseOpts(opts)
1✔
1241
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1242
                return ae
×
1243
        }
×
1244

1245
        return ApiErrors[JSConsumerEmptyFilter]
1✔
1246
}
1247

1248
// NewJSConsumerEmptyGroupNameError creates a new JSConsumerEmptyGroupName error: "Group name cannot be an empty string"
1249
func NewJSConsumerEmptyGroupNameError(opts ...ErrorOption) *ApiError {
4✔
1250
        eopts := parseOpts(opts)
4✔
1251
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1252
                return ae
×
1253
        }
×
1254

1255
        return ApiErrors[JSConsumerEmptyGroupName]
4✔
1256
}
1257

1258
// NewJSConsumerEphemeralWithDurableInSubjectError creates a new JSConsumerEphemeralWithDurableInSubjectErr error: "consumer expected to be ephemeral but detected a durable name set in subject"
1259
func NewJSConsumerEphemeralWithDurableInSubjectError(opts ...ErrorOption) *ApiError {
×
1260
        eopts := parseOpts(opts)
×
1261
        if ae, ok := eopts.err.(*ApiError); ok {
×
1262
                return ae
×
1263
        }
×
1264

1265
        return ApiErrors[JSConsumerEphemeralWithDurableInSubjectErr]
×
1266
}
1267

1268
// NewJSConsumerEphemeralWithDurableNameError creates a new JSConsumerEphemeralWithDurableNameErr error: "consumer expected to be ephemeral but a durable name was set in request"
1269
func NewJSConsumerEphemeralWithDurableNameError(opts ...ErrorOption) *ApiError {
3✔
1270
        eopts := parseOpts(opts)
3✔
1271
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1272
                return ae
×
1273
        }
×
1274

1275
        return ApiErrors[JSConsumerEphemeralWithDurableNameErr]
3✔
1276
}
1277

1278
// NewJSConsumerExistingActiveError creates a new JSConsumerExistingActiveErr error: "consumer already exists and is still active"
1279
func NewJSConsumerExistingActiveError(opts ...ErrorOption) *ApiError {
×
1280
        eopts := parseOpts(opts)
×
1281
        if ae, ok := eopts.err.(*ApiError); ok {
×
1282
                return ae
×
1283
        }
×
1284

1285
        return ApiErrors[JSConsumerExistingActiveErr]
×
1286
}
1287

1288
// NewJSConsumerFCRequiresPushError creates a new JSConsumerFCRequiresPushErr error: "consumer flow control requires a push based consumer"
1289
func NewJSConsumerFCRequiresPushError(opts ...ErrorOption) *ApiError {
×
1290
        eopts := parseOpts(opts)
×
1291
        if ae, ok := eopts.err.(*ApiError); ok {
×
1292
                return ae
×
1293
        }
×
1294

1295
        return ApiErrors[JSConsumerFCRequiresPushErr]
×
1296
}
1297

1298
// NewJSConsumerFilterNotSubsetError creates a new JSConsumerFilterNotSubsetErr error: "consumer filter subject is not a valid subset of the interest subjects"
1299
func NewJSConsumerFilterNotSubsetError(opts ...ErrorOption) *ApiError {
×
1300
        eopts := parseOpts(opts)
×
1301
        if ae, ok := eopts.err.(*ApiError); ok {
×
1302
                return ae
×
1303
        }
×
1304

1305
        return ApiErrors[JSConsumerFilterNotSubsetErr]
×
1306
}
1307

1308
// NewJSConsumerHBRequiresPushError creates a new JSConsumerHBRequiresPushErr error: "consumer idle heartbeat requires a push based consumer"
1309
func NewJSConsumerHBRequiresPushError(opts ...ErrorOption) *ApiError {
×
1310
        eopts := parseOpts(opts)
×
1311
        if ae, ok := eopts.err.(*ApiError); ok {
×
1312
                return ae
×
1313
        }
×
1314

1315
        return ApiErrors[JSConsumerHBRequiresPushErr]
×
1316
}
1317

1318
// NewJSConsumerInactiveThresholdExcessError creates a new JSConsumerInactiveThresholdExcess error: "consumer inactive threshold exceeds system limit of {limit}"
1319
func NewJSConsumerInactiveThresholdExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
2✔
1320
        eopts := parseOpts(opts)
2✔
1321
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1322
                return ae
×
1323
        }
×
1324

1325
        e := ApiErrors[JSConsumerInactiveThresholdExcess]
2✔
1326
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
2✔
1327
        return &ApiError{
2✔
1328
                Code:        e.Code,
2✔
1329
                ErrCode:     e.ErrCode,
2✔
1330
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1331
        }
2✔
1332
}
1333

1334
// NewJSConsumerInvalidDeliverSubjectError creates a new JSConsumerInvalidDeliverSubject error: "invalid push consumer deliver subject"
1335
func NewJSConsumerInvalidDeliverSubjectError(opts ...ErrorOption) *ApiError {
2✔
1336
        eopts := parseOpts(opts)
2✔
1337
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1338
                return ae
×
1339
        }
×
1340

1341
        return ApiErrors[JSConsumerInvalidDeliverSubject]
2✔
1342
}
1343

1344
// NewJSConsumerInvalidGroupNameError creates a new JSConsumerInvalidGroupNameErr error: "Valid priority group name must match A-Z, a-z, 0-9, -_/=)+ and may not exceed 16 characters"
1345
func NewJSConsumerInvalidGroupNameError(opts ...ErrorOption) *ApiError {
4✔
1346
        eopts := parseOpts(opts)
4✔
1347
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1348
                return ae
×
1349
        }
×
1350

1351
        return ApiErrors[JSConsumerInvalidGroupNameErr]
4✔
1352
}
1353

1354
// NewJSConsumerInvalidPolicyError creates a new JSConsumerInvalidPolicyErrF error: "{err}"
1355
func NewJSConsumerInvalidPolicyError(err error, opts ...ErrorOption) *ApiError {
10✔
1356
        eopts := parseOpts(opts)
10✔
1357
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1358
                return ae
×
1359
        }
×
1360

1361
        e := ApiErrors[JSConsumerInvalidPolicyErrF]
10✔
1362
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1363
        return &ApiError{
10✔
1364
                Code:        e.Code,
10✔
1365
                ErrCode:     e.ErrCode,
10✔
1366
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1367
        }
10✔
1368
}
1369

1370
// NewJSConsumerInvalidPriorityGroupError creates a new JSConsumerInvalidPriorityGroupErr error: "Provided priority group does not exist for this consumer"
1371
func NewJSConsumerInvalidPriorityGroupError(opts ...ErrorOption) *ApiError {
2✔
1372
        eopts := parseOpts(opts)
2✔
1373
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1374
                return ae
×
1375
        }
×
1376

1377
        return ApiErrors[JSConsumerInvalidPriorityGroupErr]
2✔
1378
}
1379

1380
// NewJSConsumerInvalidSamplingError creates a new JSConsumerInvalidSamplingErrF error: "failed to parse consumer sampling configuration: {err}"
1381
func NewJSConsumerInvalidSamplingError(err error, opts ...ErrorOption) *ApiError {
×
1382
        eopts := parseOpts(opts)
×
1383
        if ae, ok := eopts.err.(*ApiError); ok {
×
1384
                return ae
×
1385
        }
×
1386

1387
        e := ApiErrors[JSConsumerInvalidSamplingErrF]
×
1388
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1389
        return &ApiError{
×
1390
                Code:        e.Code,
×
1391
                ErrCode:     e.ErrCode,
×
1392
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1393
        }
×
1394
}
1395

1396
// NewJSConsumerMaxDeliverBackoffError creates a new JSConsumerMaxDeliverBackoffErr error: "max deliver is required to be > length of backoff values"
1397
func NewJSConsumerMaxDeliverBackoffError(opts ...ErrorOption) *ApiError {
3✔
1398
        eopts := parseOpts(opts)
3✔
1399
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1400
                return ae
×
1401
        }
×
1402

1403
        return ApiErrors[JSConsumerMaxDeliverBackoffErr]
3✔
1404
}
1405

1406
// NewJSConsumerMaxPendingAckExcessError creates a new JSConsumerMaxPendingAckExcessErrF error: "consumer max ack pending exceeds system limit of {limit}"
1407
func NewJSConsumerMaxPendingAckExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
12✔
1408
        eopts := parseOpts(opts)
12✔
1409
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
1410
                return ae
×
1411
        }
×
1412

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

1422
// NewJSConsumerMaxPendingAckPolicyRequiredError creates a new JSConsumerMaxPendingAckPolicyRequiredErr error: "consumer requires ack policy for max ack pending"
1423
func NewJSConsumerMaxPendingAckPolicyRequiredError(opts ...ErrorOption) *ApiError {
2✔
1424
        eopts := parseOpts(opts)
2✔
1425
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1426
                return ae
×
1427
        }
×
1428

1429
        return ApiErrors[JSConsumerMaxPendingAckPolicyRequiredErr]
2✔
1430
}
1431

1432
// NewJSConsumerMaxRequestBatchExceededError creates a new JSConsumerMaxRequestBatchExceededF error: "consumer max request batch exceeds server limit of {limit}"
1433
func NewJSConsumerMaxRequestBatchExceededError(limit interface{}, opts ...ErrorOption) *ApiError {
4✔
1434
        eopts := parseOpts(opts)
4✔
1435
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1436
                return ae
×
1437
        }
×
1438

1439
        e := ApiErrors[JSConsumerMaxRequestBatchExceededF]
4✔
1440
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
4✔
1441
        return &ApiError{
4✔
1442
                Code:        e.Code,
4✔
1443
                ErrCode:     e.ErrCode,
4✔
1444
                Description: strings.NewReplacer(args...).Replace(e.Description),
4✔
1445
        }
4✔
1446
}
1447

1448
// NewJSConsumerMaxRequestBatchNegativeError creates a new JSConsumerMaxRequestBatchNegativeErr error: "consumer max request batch needs to be > 0"
1449
func NewJSConsumerMaxRequestBatchNegativeError(opts ...ErrorOption) *ApiError {
×
1450
        eopts := parseOpts(opts)
×
1451
        if ae, ok := eopts.err.(*ApiError); ok {
×
1452
                return ae
×
1453
        }
×
1454

1455
        return ApiErrors[JSConsumerMaxRequestBatchNegativeErr]
×
1456
}
1457

1458
// NewJSConsumerMaxRequestExpiresTooSmallError creates a new JSConsumerMaxRequestExpiresTooSmall error: "consumer max request expires needs to be >= 1ms"
1459
func NewJSConsumerMaxRequestExpiresTooSmallError(opts ...ErrorOption) *ApiError {
×
1460
        eopts := parseOpts(opts)
×
1461
        if ae, ok := eopts.err.(*ApiError); ok {
×
1462
                return ae
×
1463
        }
×
1464

1465
        return ApiErrors[JSConsumerMaxRequestExpiresTooSmall]
×
1466
}
1467

1468
// NewJSConsumerMaxWaitingNegativeError creates a new JSConsumerMaxWaitingNegativeErr error: "consumer max waiting needs to be positive"
1469
func NewJSConsumerMaxWaitingNegativeError(opts ...ErrorOption) *ApiError {
×
1470
        eopts := parseOpts(opts)
×
1471
        if ae, ok := eopts.err.(*ApiError); ok {
×
1472
                return ae
×
1473
        }
×
1474

1475
        return ApiErrors[JSConsumerMaxWaitingNegativeErr]
×
1476
}
1477

1478
// NewJSConsumerMetadataLengthError creates a new JSConsumerMetadataLengthErrF error: "consumer metadata exceeds maximum size of {limit}"
1479
func NewJSConsumerMetadataLengthError(limit interface{}, opts ...ErrorOption) *ApiError {
1✔
1480
        eopts := parseOpts(opts)
1✔
1481
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1482
                return ae
×
1483
        }
×
1484

1485
        e := ApiErrors[JSConsumerMetadataLengthErrF]
1✔
1486
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
1✔
1487
        return &ApiError{
1✔
1488
                Code:        e.Code,
1✔
1489
                ErrCode:     e.ErrCode,
1✔
1490
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1491
        }
1✔
1492
}
1493

1494
// NewJSConsumerMultipleFiltersNotAllowedError creates a new JSConsumerMultipleFiltersNotAllowed error: "consumer with multiple subject filters cannot use subject based API"
1495
func NewJSConsumerMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
1496
        eopts := parseOpts(opts)
1✔
1497
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1498
                return ae
×
1499
        }
×
1500

1501
        return ApiErrors[JSConsumerMultipleFiltersNotAllowed]
1✔
1502
}
1503

1504
// NewJSConsumerNameContainsPathSeparatorsError creates a new JSConsumerNameContainsPathSeparatorsErr error: "Consumer name can not contain path separators"
1505
func NewJSConsumerNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
8✔
1506
        eopts := parseOpts(opts)
8✔
1507
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1508
                return ae
×
1509
        }
×
1510

1511
        return ApiErrors[JSConsumerNameContainsPathSeparatorsErr]
8✔
1512
}
1513

1514
// NewJSConsumerNameExistError creates a new JSConsumerNameExistErr error: "consumer name already in use"
1515
func NewJSConsumerNameExistError(opts ...ErrorOption) *ApiError {
2✔
1516
        eopts := parseOpts(opts)
2✔
1517
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1518
                return ae
×
1519
        }
×
1520

1521
        return ApiErrors[JSConsumerNameExistErr]
2✔
1522
}
1523

1524
// NewJSConsumerNameTooLongError creates a new JSConsumerNameTooLongErrF error: "consumer name is too long, maximum allowed is {max}"
1525
func NewJSConsumerNameTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
×
1526
        eopts := parseOpts(opts)
×
1527
        if ae, ok := eopts.err.(*ApiError); ok {
×
1528
                return ae
×
1529
        }
×
1530

1531
        e := ApiErrors[JSConsumerNameTooLongErrF]
×
1532
        args := e.toReplacerArgs([]interface{}{"{max}", max})
×
1533
        return &ApiError{
×
1534
                Code:        e.Code,
×
1535
                ErrCode:     e.ErrCode,
×
1536
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1537
        }
×
1538
}
1539

1540
// NewJSConsumerNotFoundError creates a new JSConsumerNotFoundErr error: "consumer not found"
1541
func NewJSConsumerNotFoundError(opts ...ErrorOption) *ApiError {
2,770✔
1542
        eopts := parseOpts(opts)
2,770✔
1543
        if ae, ok := eopts.err.(*ApiError); ok {
2,770✔
1544
                return ae
×
1545
        }
×
1546

1547
        return ApiErrors[JSConsumerNotFoundErr]
2,770✔
1548
}
1549

1550
// NewJSConsumerOfflineError creates a new JSConsumerOfflineErr error: "consumer is offline"
1551
func NewJSConsumerOfflineError(opts ...ErrorOption) *ApiError {
6✔
1552
        eopts := parseOpts(opts)
6✔
1553
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1554
                return ae
×
1555
        }
×
1556

1557
        return ApiErrors[JSConsumerOfflineErr]
6✔
1558
}
1559

1560
// NewJSConsumerOfflineReasonError creates a new JSConsumerOfflineReasonErrF error: "consumer is offline: {err}"
1561
func NewJSConsumerOfflineReasonError(err error, opts ...ErrorOption) *ApiError {
24✔
1562
        eopts := parseOpts(opts)
24✔
1563
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
1564
                return ae
×
1565
        }
×
1566

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

1576
// NewJSConsumerOnMappedError creates a new JSConsumerOnMappedErr error: "consumer direct on a mapped consumer"
1577
func NewJSConsumerOnMappedError(opts ...ErrorOption) *ApiError {
×
1578
        eopts := parseOpts(opts)
×
1579
        if ae, ok := eopts.err.(*ApiError); ok {
×
1580
                return ae
×
1581
        }
×
1582

1583
        return ApiErrors[JSConsumerOnMappedErr]
×
1584
}
1585

1586
// NewJSConsumerOverlappingSubjectFiltersError creates a new JSConsumerOverlappingSubjectFilters error: "consumer subject filters cannot overlap"
1587
func NewJSConsumerOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
1✔
1588
        eopts := parseOpts(opts)
1✔
1589
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1590
                return ae
×
1591
        }
×
1592

1593
        return ApiErrors[JSConsumerOverlappingSubjectFilters]
1✔
1594
}
1595

1596
// NewJSConsumerPinnedTTLWithoutPriorityPolicyNoneError creates a new JSConsumerPinnedTTLWithoutPriorityPolicyNone error: "PinnedTTL cannot be set when PriorityPolicy is none"
1597
func NewJSConsumerPinnedTTLWithoutPriorityPolicyNoneError(opts ...ErrorOption) *ApiError {
1✔
1598
        eopts := parseOpts(opts)
1✔
1599
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1600
                return ae
×
1601
        }
×
1602

1603
        return ApiErrors[JSConsumerPinnedTTLWithoutPriorityPolicyNone]
1✔
1604
}
1605

1606
// NewJSConsumerPriorityGroupWithPolicyNoneError creates a new JSConsumerPriorityGroupWithPolicyNone error: "consumer can not have priority groups when policy is none"
1607
func NewJSConsumerPriorityGroupWithPolicyNoneError(opts ...ErrorOption) *ApiError {
1✔
1608
        eopts := parseOpts(opts)
1✔
1609
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1610
                return ae
×
1611
        }
×
1612

1613
        return ApiErrors[JSConsumerPriorityGroupWithPolicyNone]
1✔
1614
}
1615

1616
// NewJSConsumerPriorityPolicyWithoutGroupError creates a new JSConsumerPriorityPolicyWithoutGroup error: "Setting PriorityPolicy requires at least one PriorityGroup to be set"
1617
func NewJSConsumerPriorityPolicyWithoutGroupError(opts ...ErrorOption) *ApiError {
4✔
1618
        eopts := parseOpts(opts)
4✔
1619
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1620
                return ae
×
1621
        }
×
1622

1623
        return ApiErrors[JSConsumerPriorityPolicyWithoutGroup]
4✔
1624
}
1625

1626
// NewJSConsumerPullNotDurableError creates a new JSConsumerPullNotDurableErr error: "consumer in pull mode requires a durable name"
1627
func NewJSConsumerPullNotDurableError(opts ...ErrorOption) *ApiError {
×
1628
        eopts := parseOpts(opts)
×
1629
        if ae, ok := eopts.err.(*ApiError); ok {
×
1630
                return ae
×
1631
        }
×
1632

1633
        return ApiErrors[JSConsumerPullNotDurableErr]
×
1634
}
1635

1636
// NewJSConsumerPullRequiresAckError creates a new JSConsumerPullRequiresAckErr error: "consumer in pull mode requires explicit ack policy on workqueue stream"
1637
func NewJSConsumerPullRequiresAckError(opts ...ErrorOption) *ApiError {
6✔
1638
        eopts := parseOpts(opts)
6✔
1639
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1640
                return ae
×
1641
        }
×
1642

1643
        return ApiErrors[JSConsumerPullRequiresAckErr]
6✔
1644
}
1645

1646
// NewJSConsumerPullWithRateLimitError creates a new JSConsumerPullWithRateLimitErr error: "consumer in pull mode can not have rate limit set"
1647
func NewJSConsumerPullWithRateLimitError(opts ...ErrorOption) *ApiError {
1✔
1648
        eopts := parseOpts(opts)
1✔
1649
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1650
                return ae
×
1651
        }
×
1652

1653
        return ApiErrors[JSConsumerPullWithRateLimitErr]
1✔
1654
}
1655

1656
// NewJSConsumerPushMaxWaitingError creates a new JSConsumerPushMaxWaitingErr error: "consumer in push mode can not set max waiting"
1657
func NewJSConsumerPushMaxWaitingError(opts ...ErrorOption) *ApiError {
3✔
1658
        eopts := parseOpts(opts)
3✔
1659
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1660
                return ae
×
1661
        }
×
1662

1663
        return ApiErrors[JSConsumerPushMaxWaitingErr]
3✔
1664
}
1665

1666
// NewJSConsumerPushWithPriorityGroupError creates a new JSConsumerPushWithPriorityGroupErr error: "priority groups can not be used with push consumers"
1667
func NewJSConsumerPushWithPriorityGroupError(opts ...ErrorOption) *ApiError {
1✔
1668
        eopts := parseOpts(opts)
1✔
1669
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1670
                return ae
×
1671
        }
×
1672

1673
        return ApiErrors[JSConsumerPushWithPriorityGroupErr]
1✔
1674
}
1675

1676
// NewJSConsumerReplacementWithDifferentNameError creates a new JSConsumerReplacementWithDifferentNameErr error: "consumer replacement durable config not the same"
1677
func NewJSConsumerReplacementWithDifferentNameError(opts ...ErrorOption) *ApiError {
×
1678
        eopts := parseOpts(opts)
×
1679
        if ae, ok := eopts.err.(*ApiError); ok {
×
1680
                return ae
×
1681
        }
×
1682

1683
        return ApiErrors[JSConsumerReplacementWithDifferentNameErr]
×
1684
}
1685

1686
// NewJSConsumerReplayPolicyInvalidError creates a new JSConsumerReplayPolicyInvalidErr error: "consumer replay policy invalid"
1687
func NewJSConsumerReplayPolicyInvalidError(opts ...ErrorOption) *ApiError {
2✔
1688
        eopts := parseOpts(opts)
2✔
1689
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1690
                return ae
×
1691
        }
×
1692

1693
        return ApiErrors[JSConsumerReplayPolicyInvalidErr]
2✔
1694
}
1695

1696
// NewJSConsumerReplicasExceedsStreamError creates a new JSConsumerReplicasExceedsStream error: "consumer config replica count exceeds parent stream"
1697
func NewJSConsumerReplicasExceedsStreamError(opts ...ErrorOption) *ApiError {
1✔
1698
        eopts := parseOpts(opts)
1✔
1699
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1700
                return ae
×
1701
        }
×
1702

1703
        return ApiErrors[JSConsumerReplicasExceedsStream]
1✔
1704
}
1705

1706
// NewJSConsumerReplicasShouldMatchStreamError creates a new JSConsumerReplicasShouldMatchStream error: "consumer config replicas must match interest retention stream's replicas"
1707
func NewJSConsumerReplicasShouldMatchStreamError(opts ...ErrorOption) *ApiError {
2✔
1708
        eopts := parseOpts(opts)
2✔
1709
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1710
                return ae
×
1711
        }
×
1712

1713
        return ApiErrors[JSConsumerReplicasShouldMatchStream]
2✔
1714
}
1715

1716
// NewJSConsumerSmallHeartbeatError creates a new JSConsumerSmallHeartbeatErr error: "consumer idle heartbeat needs to be >= 100ms"
1717
func NewJSConsumerSmallHeartbeatError(opts ...ErrorOption) *ApiError {
1✔
1718
        eopts := parseOpts(opts)
1✔
1719
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1720
                return ae
×
1721
        }
×
1722

1723
        return ApiErrors[JSConsumerSmallHeartbeatErr]
1✔
1724
}
1725

1726
// NewJSConsumerStoreFailedError creates a new JSConsumerStoreFailedErrF error: "error creating store for consumer: {err}"
1727
func NewJSConsumerStoreFailedError(err error, opts ...ErrorOption) *ApiError {
8✔
1728
        eopts := parseOpts(opts)
8✔
1729
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1730
                return ae
×
1731
        }
×
1732

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

1742
// NewJSConsumerWQConsumerNotDeliverAllError creates a new JSConsumerWQConsumerNotDeliverAllErr error: "consumer must be deliver all on workqueue stream"
1743
func NewJSConsumerWQConsumerNotDeliverAllError(opts ...ErrorOption) *ApiError {
×
1744
        eopts := parseOpts(opts)
×
1745
        if ae, ok := eopts.err.(*ApiError); ok {
×
1746
                return ae
×
1747
        }
×
1748

1749
        return ApiErrors[JSConsumerWQConsumerNotDeliverAllErr]
×
1750
}
1751

1752
// NewJSConsumerWQConsumerNotUniqueError creates a new JSConsumerWQConsumerNotUniqueErr error: "filtered consumer not unique on workqueue stream"
1753
func NewJSConsumerWQConsumerNotUniqueError(opts ...ErrorOption) *ApiError {
11✔
1754
        eopts := parseOpts(opts)
11✔
1755
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
1756
                return ae
×
1757
        }
×
1758

1759
        return ApiErrors[JSConsumerWQConsumerNotUniqueErr]
11✔
1760
}
1761

1762
// NewJSConsumerWQMultipleUnfilteredError creates a new JSConsumerWQMultipleUnfilteredErr error: "multiple non-filtered consumers not allowed on workqueue stream"
1763
func NewJSConsumerWQMultipleUnfilteredError(opts ...ErrorOption) *ApiError {
2✔
1764
        eopts := parseOpts(opts)
2✔
1765
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1766
                return ae
×
1767
        }
×
1768

1769
        return ApiErrors[JSConsumerWQMultipleUnfilteredErr]
2✔
1770
}
1771

1772
// NewJSConsumerWQRequiresExplicitAckError creates a new JSConsumerWQRequiresExplicitAckErr error: "workqueue stream requires explicit ack"
1773
func NewJSConsumerWQRequiresExplicitAckError(opts ...ErrorOption) *ApiError {
×
1774
        eopts := parseOpts(opts)
×
1775
        if ae, ok := eopts.err.(*ApiError); ok {
×
1776
                return ae
×
1777
        }
×
1778

1779
        return ApiErrors[JSConsumerWQRequiresExplicitAckErr]
×
1780
}
1781

1782
// NewJSConsumerWithFlowControlNeedsHeartbeatsError creates a new JSConsumerWithFlowControlNeedsHeartbeats error: "consumer with flow control also needs heartbeats"
1783
func NewJSConsumerWithFlowControlNeedsHeartbeatsError(opts ...ErrorOption) *ApiError {
4✔
1784
        eopts := parseOpts(opts)
4✔
1785
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1786
                return ae
×
1787
        }
×
1788

1789
        return ApiErrors[JSConsumerWithFlowControlNeedsHeartbeats]
4✔
1790
}
1791

1792
// NewJSInsufficientResourcesError creates a new JSInsufficientResourcesErr error: "insufficient resources"
1793
func NewJSInsufficientResourcesError(opts ...ErrorOption) *ApiError {
11✔
1794
        eopts := parseOpts(opts)
11✔
1795
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
1796
                return ae
×
1797
        }
×
1798

1799
        return ApiErrors[JSInsufficientResourcesErr]
11✔
1800
}
1801

1802
// NewJSInvalidJSONError creates a new JSInvalidJSONErr error: "invalid JSON: {err}"
1803
func NewJSInvalidJSONError(err error, opts ...ErrorOption) *ApiError {
10✔
1804
        eopts := parseOpts(opts)
10✔
1805
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1806
                return ae
×
1807
        }
×
1808

1809
        e := ApiErrors[JSInvalidJSONErr]
10✔
1810
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1811
        return &ApiError{
10✔
1812
                Code:        e.Code,
10✔
1813
                ErrCode:     e.ErrCode,
10✔
1814
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1815
        }
10✔
1816
}
1817

1818
// NewJSMaximumConsumersLimitError creates a new JSMaximumConsumersLimitErr error: "maximum consumers limit reached"
1819
func NewJSMaximumConsumersLimitError(opts ...ErrorOption) *ApiError {
29✔
1820
        eopts := parseOpts(opts)
29✔
1821
        if ae, ok := eopts.err.(*ApiError); ok {
29✔
1822
                return ae
×
1823
        }
×
1824

1825
        return ApiErrors[JSMaximumConsumersLimitErr]
29✔
1826
}
1827

1828
// NewJSMaximumStreamsLimitError creates a new JSMaximumStreamsLimitErr error: "maximum number of streams reached"
1829
func NewJSMaximumStreamsLimitError(opts ...ErrorOption) *ApiError {
16✔
1830
        eopts := parseOpts(opts)
16✔
1831
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
1832
                return ae
×
1833
        }
×
1834

1835
        return ApiErrors[JSMaximumStreamsLimitErr]
16✔
1836
}
1837

1838
// NewJSMemoryResourcesExceededError creates a new JSMemoryResourcesExceededErr error: "insufficient memory resources available"
1839
func NewJSMemoryResourcesExceededError(opts ...ErrorOption) *ApiError {
4✔
1840
        eopts := parseOpts(opts)
4✔
1841
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1842
                return ae
×
1843
        }
×
1844

1845
        return ApiErrors[JSMemoryResourcesExceededErr]
4✔
1846
}
1847

1848
// NewJSMessageCounterBrokenError creates a new JSMessageCounterBrokenErr error: "message counter is broken"
1849
func NewJSMessageCounterBrokenError(opts ...ErrorOption) *ApiError {
4✔
1850
        eopts := parseOpts(opts)
4✔
1851
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1852
                return ae
×
1853
        }
×
1854

1855
        return ApiErrors[JSMessageCounterBrokenErr]
4✔
1856
}
1857

1858
// NewJSMessageIncrDisabledError creates a new JSMessageIncrDisabledErr error: "message counters is disabled"
1859
func NewJSMessageIncrDisabledError(opts ...ErrorOption) *ApiError {
4✔
1860
        eopts := parseOpts(opts)
4✔
1861
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1862
                return ae
×
1863
        }
×
1864

1865
        return ApiErrors[JSMessageIncrDisabledErr]
4✔
1866
}
1867

1868
// NewJSMessageIncrInvalidError creates a new JSMessageIncrInvalidErr error: "message counter increment is invalid"
1869
func NewJSMessageIncrInvalidError(opts ...ErrorOption) *ApiError {
24✔
1870
        eopts := parseOpts(opts)
24✔
1871
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
1872
                return ae
×
1873
        }
×
1874

1875
        return ApiErrors[JSMessageIncrInvalidErr]
24✔
1876
}
1877

1878
// NewJSMessageIncrMissingError creates a new JSMessageIncrMissingErr error: "message counter increment is missing"
1879
func NewJSMessageIncrMissingError(opts ...ErrorOption) *ApiError {
8✔
1880
        eopts := parseOpts(opts)
8✔
1881
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1882
                return ae
×
1883
        }
×
1884

1885
        return ApiErrors[JSMessageIncrMissingErr]
8✔
1886
}
1887

1888
// NewJSMessageIncrPayloadError creates a new JSMessageIncrPayloadErr error: "message counter has payload"
1889
func NewJSMessageIncrPayloadError(opts ...ErrorOption) *ApiError {
4✔
1890
        eopts := parseOpts(opts)
4✔
1891
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1892
                return ae
×
1893
        }
×
1894

1895
        return ApiErrors[JSMessageIncrPayloadErr]
4✔
1896
}
1897

1898
// NewJSMessageSchedulesDisabledError creates a new JSMessageSchedulesDisabledErr error: "message schedules is disabled"
1899
func NewJSMessageSchedulesDisabledError(opts ...ErrorOption) *ApiError {
20✔
1900
        eopts := parseOpts(opts)
20✔
1901
        if ae, ok := eopts.err.(*ApiError); ok {
20✔
1902
                return ae
×
1903
        }
×
1904

1905
        return ApiErrors[JSMessageSchedulesDisabledErr]
20✔
1906
}
1907

1908
// NewJSMessageSchedulesPatternInvalidError creates a new JSMessageSchedulesPatternInvalidErr error: "message schedules pattern is invalid"
1909
func NewJSMessageSchedulesPatternInvalidError(opts ...ErrorOption) *ApiError {
15✔
1910
        eopts := parseOpts(opts)
15✔
1911
        if ae, ok := eopts.err.(*ApiError); ok {
15✔
1912
                return ae
×
1913
        }
×
1914

1915
        return ApiErrors[JSMessageSchedulesPatternInvalidErr]
15✔
1916
}
1917

1918
// NewJSMessageSchedulesRollupInvalidError creates a new JSMessageSchedulesRollupInvalidErr error: "message schedules invalid rollup"
1919
func NewJSMessageSchedulesRollupInvalidError(opts ...ErrorOption) *ApiError {
8✔
1920
        eopts := parseOpts(opts)
8✔
1921
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1922
                return ae
×
1923
        }
×
1924

1925
        return ApiErrors[JSMessageSchedulesRollupInvalidErr]
8✔
1926
}
1927

1928
// NewJSMessageSchedulesTTLInvalidError creates a new JSMessageSchedulesTTLInvalidErr error: "message schedules invalid per-message TTL"
1929
func NewJSMessageSchedulesTTLInvalidError(opts ...ErrorOption) *ApiError {
10✔
1930
        eopts := parseOpts(opts)
10✔
1931
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1932
                return ae
×
1933
        }
×
1934

1935
        return ApiErrors[JSMessageSchedulesTTLInvalidErr]
10✔
1936
}
1937

1938
// NewJSMessageSchedulesTargetInvalidError creates a new JSMessageSchedulesTargetInvalidErr error: "message schedules target is invalid"
1939
func NewJSMessageSchedulesTargetInvalidError(opts ...ErrorOption) *ApiError {
30✔
1940
        eopts := parseOpts(opts)
30✔
1941
        if ae, ok := eopts.err.(*ApiError); ok {
30✔
1942
                return ae
×
1943
        }
×
1944

1945
        return ApiErrors[JSMessageSchedulesTargetInvalidErr]
30✔
1946
}
1947

1948
// NewJSMessageTTLDisabledError creates a new JSMessageTTLDisabledErr error: "per-message TTL is disabled"
1949
func NewJSMessageTTLDisabledError(opts ...ErrorOption) *ApiError {
16✔
1950
        eopts := parseOpts(opts)
16✔
1951
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
1952
                return ae
×
1953
        }
×
1954

1955
        return ApiErrors[JSMessageTTLDisabledErr]
16✔
1956
}
1957

1958
// NewJSMessageTTLInvalidError creates a new JSMessageTTLInvalidErr error: "invalid per-message TTL"
1959
func NewJSMessageTTLInvalidError(opts ...ErrorOption) *ApiError {
23✔
1960
        eopts := parseOpts(opts)
23✔
1961
        if ae, ok := eopts.err.(*ApiError); ok {
23✔
1962
                return ae
×
1963
        }
×
1964

1965
        return ApiErrors[JSMessageTTLInvalidErr]
23✔
1966
}
1967

1968
// NewJSMirrorConsumerSetupFailedError creates a new JSMirrorConsumerSetupFailedErrF error: "{err}"
1969
func NewJSMirrorConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
1970
        eopts := parseOpts(opts)
×
1971
        if ae, ok := eopts.err.(*ApiError); ok {
×
1972
                return ae
×
1973
        }
×
1974

1975
        e := ApiErrors[JSMirrorConsumerSetupFailedErrF]
×
1976
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1977
        return &ApiError{
×
1978
                Code:        e.Code,
×
1979
                ErrCode:     e.ErrCode,
×
1980
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1981
        }
×
1982
}
1983

1984
// NewJSMirrorInvalidStreamNameError creates a new JSMirrorInvalidStreamName error: "mirrored stream name is invalid"
1985
func NewJSMirrorInvalidStreamNameError(opts ...ErrorOption) *ApiError {
×
1986
        eopts := parseOpts(opts)
×
1987
        if ae, ok := eopts.err.(*ApiError); ok {
×
1988
                return ae
×
1989
        }
×
1990

1991
        return ApiErrors[JSMirrorInvalidStreamName]
×
1992
}
1993

1994
// NewJSMirrorInvalidSubjectFilterError creates a new JSMirrorInvalidSubjectFilter error: "mirror transform source: {err}"
1995
func NewJSMirrorInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
2✔
1996
        eopts := parseOpts(opts)
2✔
1997
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1998
                return ae
×
1999
        }
×
2000

2001
        e := ApiErrors[JSMirrorInvalidSubjectFilter]
2✔
2002
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2✔
2003
        return &ApiError{
2✔
2004
                Code:        e.Code,
2✔
2005
                ErrCode:     e.ErrCode,
2✔
2006
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2007
        }
2✔
2008
}
2009

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

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

2026
// NewJSMirrorMaxMessageSizeTooBigError creates a new JSMirrorMaxMessageSizeTooBigErr error: "stream mirror must have max message size >= source"
2027
func NewJSMirrorMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
2028
        eopts := parseOpts(opts)
×
2029
        if ae, ok := eopts.err.(*ApiError); ok {
×
2030
                return ae
×
2031
        }
×
2032

2033
        return ApiErrors[JSMirrorMaxMessageSizeTooBigErr]
×
2034
}
2035

2036
// NewJSMirrorMultipleFiltersNotAllowedError creates a new JSMirrorMultipleFiltersNotAllowed error: "mirror with multiple subject transforms cannot also have a single subject filter"
2037
func NewJSMirrorMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
2038
        eopts := parseOpts(opts)
1✔
2039
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2040
                return ae
×
2041
        }
×
2042

2043
        return ApiErrors[JSMirrorMultipleFiltersNotAllowed]
1✔
2044
}
2045

2046
// NewJSMirrorOverlappingSubjectFiltersError creates a new JSMirrorOverlappingSubjectFilters error: "mirror subject filters can not overlap"
2047
func NewJSMirrorOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
2✔
2048
        eopts := parseOpts(opts)
2✔
2049
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2050
                return ae
×
2051
        }
×
2052

2053
        return ApiErrors[JSMirrorOverlappingSubjectFilters]
2✔
2054
}
2055

2056
// NewJSMirrorWithAtomicPublishError creates a new JSMirrorWithAtomicPublishErr error: "stream mirrors can not also use atomic publishing"
2057
func NewJSMirrorWithAtomicPublishError(opts ...ErrorOption) *ApiError {
4✔
2058
        eopts := parseOpts(opts)
4✔
2059
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2060
                return ae
×
2061
        }
×
2062

2063
        return ApiErrors[JSMirrorWithAtomicPublishErr]
4✔
2064
}
2065

2066
// NewJSMirrorWithCountersError creates a new JSMirrorWithCountersErr error: "stream mirrors can not also calculate counters"
2067
func NewJSMirrorWithCountersError(opts ...ErrorOption) *ApiError {
4✔
2068
        eopts := parseOpts(opts)
4✔
2069
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2070
                return ae
×
2071
        }
×
2072

2073
        return ApiErrors[JSMirrorWithCountersErr]
4✔
2074
}
2075

2076
// NewJSMirrorWithFirstSeqError creates a new JSMirrorWithFirstSeqErr error: "stream mirrors can not have first sequence configured"
2077
func NewJSMirrorWithFirstSeqError(opts ...ErrorOption) *ApiError {
2✔
2078
        eopts := parseOpts(opts)
2✔
2079
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2080
                return ae
×
2081
        }
×
2082

2083
        return ApiErrors[JSMirrorWithFirstSeqErr]
2✔
2084
}
2085

2086
// NewJSMirrorWithMsgSchedulesError creates a new JSMirrorWithMsgSchedulesErr error: "stream mirrors can not also schedule messages"
2087
func NewJSMirrorWithMsgSchedulesError(opts ...ErrorOption) *ApiError {
2✔
2088
        eopts := parseOpts(opts)
2✔
2089
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2090
                return ae
×
2091
        }
×
2092

2093
        return ApiErrors[JSMirrorWithMsgSchedulesErr]
2✔
2094
}
2095

2096
// NewJSMirrorWithSourcesError creates a new JSMirrorWithSourcesErr error: "stream mirrors can not also contain other sources"
2097
func NewJSMirrorWithSourcesError(opts ...ErrorOption) *ApiError {
×
2098
        eopts := parseOpts(opts)
×
2099
        if ae, ok := eopts.err.(*ApiError); ok {
×
2100
                return ae
×
2101
        }
×
2102

2103
        return ApiErrors[JSMirrorWithSourcesErr]
×
2104
}
2105

2106
// NewJSMirrorWithStartSeqAndTimeError creates a new JSMirrorWithStartSeqAndTimeErr error: "stream mirrors can not have both start seq and start time configured"
2107
func NewJSMirrorWithStartSeqAndTimeError(opts ...ErrorOption) *ApiError {
×
2108
        eopts := parseOpts(opts)
×
2109
        if ae, ok := eopts.err.(*ApiError); ok {
×
2110
                return ae
×
2111
        }
×
2112

2113
        return ApiErrors[JSMirrorWithStartSeqAndTimeErr]
×
2114
}
2115

2116
// NewJSMirrorWithSubjectFiltersError creates a new JSMirrorWithSubjectFiltersErr error: "stream mirrors can not contain filtered subjects"
2117
func NewJSMirrorWithSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
2118
        eopts := parseOpts(opts)
×
2119
        if ae, ok := eopts.err.(*ApiError); ok {
×
2120
                return ae
×
2121
        }
×
2122

2123
        return ApiErrors[JSMirrorWithSubjectFiltersErr]
×
2124
}
2125

2126
// NewJSMirrorWithSubjectsError creates a new JSMirrorWithSubjectsErr error: "stream mirrors can not contain subjects"
2127
func NewJSMirrorWithSubjectsError(opts ...ErrorOption) *ApiError {
2✔
2128
        eopts := parseOpts(opts)
2✔
2129
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2130
                return ae
×
2131
        }
×
2132

2133
        return ApiErrors[JSMirrorWithSubjectsErr]
2✔
2134
}
2135

2136
// NewJSNoAccountError creates a new JSNoAccountErr error: "account not found"
2137
func NewJSNoAccountError(opts ...ErrorOption) *ApiError {
1✔
2138
        eopts := parseOpts(opts)
1✔
2139
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2140
                return ae
×
2141
        }
×
2142

2143
        return ApiErrors[JSNoAccountErr]
1✔
2144
}
2145

2146
// NewJSNoLimitsError creates a new JSNoLimitsErr error: "no JetStream default or applicable tiered limit present"
2147
func NewJSNoLimitsError(opts ...ErrorOption) *ApiError {
4✔
2148
        eopts := parseOpts(opts)
4✔
2149
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2150
                return ae
×
2151
        }
×
2152

2153
        return ApiErrors[JSNoLimitsErr]
4✔
2154
}
2155

2156
// NewJSNoMessageFoundError creates a new JSNoMessageFoundErr error: "no message found"
2157
func NewJSNoMessageFoundError(opts ...ErrorOption) *ApiError {
465✔
2158
        eopts := parseOpts(opts)
465✔
2159
        if ae, ok := eopts.err.(*ApiError); ok {
465✔
2160
                return ae
×
2161
        }
×
2162

2163
        return ApiErrors[JSNoMessageFoundErr]
465✔
2164
}
2165

2166
// NewJSNotEmptyRequestError creates a new JSNotEmptyRequestErr error: "expected an empty request payload"
2167
func NewJSNotEmptyRequestError(opts ...ErrorOption) *ApiError {
3✔
2168
        eopts := parseOpts(opts)
3✔
2169
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2170
                return ae
×
2171
        }
×
2172

2173
        return ApiErrors[JSNotEmptyRequestErr]
3✔
2174
}
2175

2176
// NewJSNotEnabledError creates a new JSNotEnabledErr error: "JetStream not enabled"
2177
func NewJSNotEnabledError(opts ...ErrorOption) *ApiError {
10✔
2178
        eopts := parseOpts(opts)
10✔
2179
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2180
                return ae
×
2181
        }
×
2182

2183
        return ApiErrors[JSNotEnabledErr]
10✔
2184
}
2185

2186
// NewJSNotEnabledForAccountError creates a new JSNotEnabledForAccountErr error: "JetStream not enabled for account"
2187
func NewJSNotEnabledForAccountError(opts ...ErrorOption) *ApiError {
324✔
2188
        eopts := parseOpts(opts)
324✔
2189
        if ae, ok := eopts.err.(*ApiError); ok {
324✔
2190
                return ae
×
2191
        }
×
2192

2193
        return ApiErrors[JSNotEnabledForAccountErr]
324✔
2194
}
2195

2196
// NewJSPedanticError creates a new JSPedanticErrF error: "pedantic mode: {err}"
2197
func NewJSPedanticError(err error, opts ...ErrorOption) *ApiError {
36✔
2198
        eopts := parseOpts(opts)
36✔
2199
        if ae, ok := eopts.err.(*ApiError); ok {
36✔
2200
                return ae
×
2201
        }
×
2202

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

2212
// NewJSPeerRemapError creates a new JSPeerRemapErr error: "peer remap failed"
2213
func NewJSPeerRemapError(opts ...ErrorOption) *ApiError {
5✔
2214
        eopts := parseOpts(opts)
5✔
2215
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2216
                return ae
1✔
2217
        }
1✔
2218

2219
        return ApiErrors[JSPeerRemapErr]
4✔
2220
}
2221

2222
// NewJSRaftGeneralError creates a new JSRaftGeneralErrF error: "{err}"
2223
func NewJSRaftGeneralError(err error, opts ...ErrorOption) *ApiError {
×
2224
        eopts := parseOpts(opts)
×
2225
        if ae, ok := eopts.err.(*ApiError); ok {
×
2226
                return ae
×
2227
        }
×
2228

2229
        e := ApiErrors[JSRaftGeneralErrF]
×
2230
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2231
        return &ApiError{
×
2232
                Code:        e.Code,
×
2233
                ErrCode:     e.ErrCode,
×
2234
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2235
        }
×
2236
}
2237

2238
// NewJSReplicasCountCannotBeNegativeError creates a new JSReplicasCountCannotBeNegative error: "replicas count cannot be negative"
2239
func NewJSReplicasCountCannotBeNegativeError(opts ...ErrorOption) *ApiError {
16✔
2240
        eopts := parseOpts(opts)
16✔
2241
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2242
                return ae
×
2243
        }
×
2244

2245
        return ApiErrors[JSReplicasCountCannotBeNegative]
16✔
2246
}
2247

2248
// NewJSRequiredApiLevelError creates a new JSRequiredApiLevelErr error: "JetStream minimum api level required"
2249
func NewJSRequiredApiLevelError(opts ...ErrorOption) *ApiError {
56✔
2250
        eopts := parseOpts(opts)
56✔
2251
        if ae, ok := eopts.err.(*ApiError); ok {
56✔
2252
                return ae
×
2253
        }
×
2254

2255
        return ApiErrors[JSRequiredApiLevelErr]
56✔
2256
}
2257

2258
// NewJSRestoreSubscribeFailedError creates a new JSRestoreSubscribeFailedErrF error: "JetStream unable to subscribe to restore snapshot {subject}: {err}"
2259
func NewJSRestoreSubscribeFailedError(err error, subject interface{}, opts ...ErrorOption) *ApiError {
1✔
2260
        eopts := parseOpts(opts)
1✔
2261
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2262
                return ae
×
2263
        }
×
2264

2265
        e := ApiErrors[JSRestoreSubscribeFailedErrF]
1✔
2266
        args := e.toReplacerArgs([]interface{}{"{err}", err, "{subject}", subject})
1✔
2267
        return &ApiError{
1✔
2268
                Code:        e.Code,
1✔
2269
                ErrCode:     e.ErrCode,
1✔
2270
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2271
        }
1✔
2272
}
2273

2274
// NewJSSequenceNotFoundError creates a new JSSequenceNotFoundErrF error: "sequence {seq} not found"
2275
func NewJSSequenceNotFoundError(seq uint64, opts ...ErrorOption) *ApiError {
×
2276
        eopts := parseOpts(opts)
×
2277
        if ae, ok := eopts.err.(*ApiError); ok {
×
2278
                return ae
×
2279
        }
×
2280

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

2290
// NewJSSnapshotDeliverSubjectInvalidError creates a new JSSnapshotDeliverSubjectInvalidErr error: "deliver subject not valid"
2291
func NewJSSnapshotDeliverSubjectInvalidError(opts ...ErrorOption) *ApiError {
1✔
2292
        eopts := parseOpts(opts)
1✔
2293
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2294
                return ae
×
2295
        }
×
2296

2297
        return ApiErrors[JSSnapshotDeliverSubjectInvalidErr]
1✔
2298
}
2299

2300
// NewJSSourceConsumerSetupFailedError creates a new JSSourceConsumerSetupFailedErrF error: "{err}"
2301
func NewJSSourceConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
2302
        eopts := parseOpts(opts)
×
2303
        if ae, ok := eopts.err.(*ApiError); ok {
×
2304
                return ae
×
2305
        }
×
2306

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

2316
// NewJSSourceDuplicateDetectedError creates a new JSSourceDuplicateDetected error: "duplicate source configuration detected"
2317
func NewJSSourceDuplicateDetectedError(opts ...ErrorOption) *ApiError {
×
2318
        eopts := parseOpts(opts)
×
2319
        if ae, ok := eopts.err.(*ApiError); ok {
×
2320
                return ae
×
2321
        }
×
2322

2323
        return ApiErrors[JSSourceDuplicateDetected]
×
2324
}
2325

2326
// NewJSSourceInvalidStreamNameError creates a new JSSourceInvalidStreamName error: "sourced stream name is invalid"
2327
func NewJSSourceInvalidStreamNameError(opts ...ErrorOption) *ApiError {
1✔
2328
        eopts := parseOpts(opts)
1✔
2329
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2330
                return ae
×
2331
        }
×
2332

2333
        return ApiErrors[JSSourceInvalidStreamName]
1✔
2334
}
2335

2336
// NewJSSourceInvalidSubjectFilterError creates a new JSSourceInvalidSubjectFilter error: "source transform source: {err}"
2337
func NewJSSourceInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
1✔
2338
        eopts := parseOpts(opts)
1✔
2339
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2340
                return ae
×
2341
        }
×
2342

2343
        e := ApiErrors[JSSourceInvalidSubjectFilter]
1✔
2344
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2345
        return &ApiError{
1✔
2346
                Code:        e.Code,
1✔
2347
                ErrCode:     e.ErrCode,
1✔
2348
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2349
        }
1✔
2350
}
2351

2352
// NewJSSourceInvalidTransformDestinationError creates a new JSSourceInvalidTransformDestination error: "source transform: {err}"
2353
func NewJSSourceInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
2354
        eopts := parseOpts(opts)
1✔
2355
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2356
                return ae
×
2357
        }
×
2358

2359
        e := ApiErrors[JSSourceInvalidTransformDestination]
1✔
2360
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2361
        return &ApiError{
1✔
2362
                Code:        e.Code,
1✔
2363
                ErrCode:     e.ErrCode,
1✔
2364
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2365
        }
1✔
2366
}
2367

2368
// NewJSSourceMaxMessageSizeTooBigError creates a new JSSourceMaxMessageSizeTooBigErr error: "stream source must have max message size >= target"
2369
func NewJSSourceMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
2370
        eopts := parseOpts(opts)
×
2371
        if ae, ok := eopts.err.(*ApiError); ok {
×
2372
                return ae
×
2373
        }
×
2374

2375
        return ApiErrors[JSSourceMaxMessageSizeTooBigErr]
×
2376
}
2377

2378
// NewJSSourceMultipleFiltersNotAllowedError creates a new JSSourceMultipleFiltersNotAllowed error: "source with multiple subject transforms cannot also have a single subject filter"
2379
func NewJSSourceMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
×
2380
        eopts := parseOpts(opts)
×
2381
        if ae, ok := eopts.err.(*ApiError); ok {
×
2382
                return ae
×
2383
        }
×
2384

2385
        return ApiErrors[JSSourceMultipleFiltersNotAllowed]
×
2386
}
2387

2388
// NewJSSourceOverlappingSubjectFiltersError creates a new JSSourceOverlappingSubjectFilters error: "source filters can not overlap"
2389
func NewJSSourceOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
2390
        eopts := parseOpts(opts)
×
2391
        if ae, ok := eopts.err.(*ApiError); ok {
×
2392
                return ae
×
2393
        }
×
2394

2395
        return ApiErrors[JSSourceOverlappingSubjectFilters]
×
2396
}
2397

2398
// NewJSSourceWithMsgSchedulesError creates a new JSSourceWithMsgSchedulesErr error: "stream source can not also schedule messages"
2399
func NewJSSourceWithMsgSchedulesError(opts ...ErrorOption) *ApiError {
2✔
2400
        eopts := parseOpts(opts)
2✔
2401
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2402
                return ae
×
2403
        }
×
2404

2405
        return ApiErrors[JSSourceWithMsgSchedulesErr]
2✔
2406
}
2407

2408
// NewJSStorageResourcesExceededError creates a new JSStorageResourcesExceededErr error: "insufficient storage resources available"
2409
func NewJSStorageResourcesExceededError(opts ...ErrorOption) *ApiError {
25✔
2410
        eopts := parseOpts(opts)
25✔
2411
        if ae, ok := eopts.err.(*ApiError); ok {
25✔
2412
                return ae
×
2413
        }
×
2414

2415
        return ApiErrors[JSStorageResourcesExceededErr]
25✔
2416
}
2417

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

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

2434
// NewJSStreamCreateError creates a new JSStreamCreateErrF error: "{err}"
2435
func NewJSStreamCreateError(err error, opts ...ErrorOption) *ApiError {
74✔
2436
        eopts := parseOpts(opts)
74✔
2437
        if ae, ok := eopts.err.(*ApiError); ok {
148✔
2438
                return ae
74✔
2439
        }
74✔
2440

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

2450
// NewJSStreamDeleteError creates a new JSStreamDeleteErrF error: "{err}"
2451
func NewJSStreamDeleteError(err error, opts ...ErrorOption) *ApiError {
×
2452
        eopts := parseOpts(opts)
×
2453
        if ae, ok := eopts.err.(*ApiError); ok {
×
2454
                return ae
×
2455
        }
×
2456

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

2466
// NewJSStreamDuplicateMessageConflictError creates a new JSStreamDuplicateMessageConflict error: "duplicate message id is in process"
2467
func NewJSStreamDuplicateMessageConflictError(opts ...ErrorOption) *ApiError {
36✔
2468
        eopts := parseOpts(opts)
36✔
2469
        if ae, ok := eopts.err.(*ApiError); ok {
36✔
2470
                return ae
×
2471
        }
×
2472

2473
        return ApiErrors[JSStreamDuplicateMessageConflict]
36✔
2474
}
2475

2476
// NewJSStreamExpectedLastSeqPerSubjectInvalidError creates a new JSStreamExpectedLastSeqPerSubjectInvalid error: "missing sequence for expected last sequence per subject"
2477
func NewJSStreamExpectedLastSeqPerSubjectInvalidError(opts ...ErrorOption) *ApiError {
8✔
2478
        eopts := parseOpts(opts)
8✔
2479
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
2480
                return ae
×
2481
        }
×
2482

2483
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectInvalid]
8✔
2484
}
2485

2486
// NewJSStreamExpectedLastSeqPerSubjectNotReadyError creates a new JSStreamExpectedLastSeqPerSubjectNotReady error: "expected last sequence per subject temporarily unavailable"
2487
func NewJSStreamExpectedLastSeqPerSubjectNotReadyError(opts ...ErrorOption) *ApiError {
×
2488
        eopts := parseOpts(opts)
×
2489
        if ae, ok := eopts.err.(*ApiError); ok {
×
2490
                return ae
×
2491
        }
×
2492

2493
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectNotReady]
×
2494
}
2495

2496
// NewJSStreamExternalApiOverlapError creates a new JSStreamExternalApiOverlapErrF error: "stream external api prefix {prefix} must not overlap with {subject}"
2497
func NewJSStreamExternalApiOverlapError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
2✔
2498
        eopts := parseOpts(opts)
2✔
2499
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2500
                return ae
×
2501
        }
×
2502

2503
        e := ApiErrors[JSStreamExternalApiOverlapErrF]
2✔
2504
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
2✔
2505
        return &ApiError{
2✔
2506
                Code:        e.Code,
2✔
2507
                ErrCode:     e.ErrCode,
2✔
2508
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2509
        }
2✔
2510
}
2511

2512
// NewJSStreamExternalDelPrefixOverlapsError creates a new JSStreamExternalDelPrefixOverlapsErrF error: "stream external delivery prefix {prefix} overlaps with stream subject {subject}"
2513
func NewJSStreamExternalDelPrefixOverlapsError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
×
2514
        eopts := parseOpts(opts)
×
2515
        if ae, ok := eopts.err.(*ApiError); ok {
×
2516
                return ae
×
2517
        }
×
2518

2519
        e := ApiErrors[JSStreamExternalDelPrefixOverlapsErrF]
×
2520
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
×
2521
        return &ApiError{
×
2522
                Code:        e.Code,
×
2523
                ErrCode:     e.ErrCode,
×
2524
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2525
        }
×
2526
}
2527

2528
// NewJSStreamGeneralError creates a new JSStreamGeneralErrorF error: "{err}"
2529
func NewJSStreamGeneralError(err error, opts ...ErrorOption) *ApiError {
3✔
2530
        eopts := parseOpts(opts)
3✔
2531
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2532
                return ae
×
2533
        }
×
2534

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

2544
// NewJSStreamHeaderExceedsMaximumError creates a new JSStreamHeaderExceedsMaximumErr error: "header size exceeds maximum allowed of 64k"
2545
func NewJSStreamHeaderExceedsMaximumError(opts ...ErrorOption) *ApiError {
1✔
2546
        eopts := parseOpts(opts)
1✔
2547
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2548
                return ae
×
2549
        }
×
2550

2551
        return ApiErrors[JSStreamHeaderExceedsMaximumErr]
1✔
2552
}
2553

2554
// NewJSStreamInfoMaxSubjectsError creates a new JSStreamInfoMaxSubjectsErr error: "subject details would exceed maximum allowed"
2555
func NewJSStreamInfoMaxSubjectsError(opts ...ErrorOption) *ApiError {
×
2556
        eopts := parseOpts(opts)
×
2557
        if ae, ok := eopts.err.(*ApiError); ok {
×
2558
                return ae
×
2559
        }
×
2560

2561
        return ApiErrors[JSStreamInfoMaxSubjectsErr]
×
2562
}
2563

2564
// NewJSStreamInvalidConfigError creates a new JSStreamInvalidConfigF error: "{err}"
2565
func NewJSStreamInvalidConfigError(err error, opts ...ErrorOption) *ApiError {
165✔
2566
        eopts := parseOpts(opts)
165✔
2567
        if ae, ok := eopts.err.(*ApiError); ok {
188✔
2568
                return ae
23✔
2569
        }
23✔
2570

2571
        e := ApiErrors[JSStreamInvalidConfigF]
142✔
2572
        args := e.toReplacerArgs([]interface{}{"{err}", err})
142✔
2573
        return &ApiError{
142✔
2574
                Code:        e.Code,
142✔
2575
                ErrCode:     e.ErrCode,
142✔
2576
                Description: strings.NewReplacer(args...).Replace(e.Description),
142✔
2577
        }
142✔
2578
}
2579

2580
// NewJSStreamInvalidError creates a new JSStreamInvalidErr error: "stream not valid"
2581
func NewJSStreamInvalidError(opts ...ErrorOption) *ApiError {
×
2582
        eopts := parseOpts(opts)
×
2583
        if ae, ok := eopts.err.(*ApiError); ok {
×
2584
                return ae
×
2585
        }
×
2586

2587
        return ApiErrors[JSStreamInvalidErr]
×
2588
}
2589

2590
// NewJSStreamInvalidExternalDeliverySubjError creates a new JSStreamInvalidExternalDeliverySubjErrF error: "stream external delivery prefix {prefix} must not contain wildcards"
2591
func NewJSStreamInvalidExternalDeliverySubjError(prefix interface{}, opts ...ErrorOption) *ApiError {
×
2592
        eopts := parseOpts(opts)
×
2593
        if ae, ok := eopts.err.(*ApiError); ok {
×
2594
                return ae
×
2595
        }
×
2596

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

2606
// NewJSStreamLimitsError creates a new JSStreamLimitsErrF error: "{err}"
2607
func NewJSStreamLimitsError(err error, opts ...ErrorOption) *ApiError {
8✔
2608
        eopts := parseOpts(opts)
8✔
2609
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2610
                return ae
8✔
2611
        }
8✔
2612

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

2622
// NewJSStreamMaxBytesRequiredError creates a new JSStreamMaxBytesRequired error: "account requires a stream config to have max bytes set"
2623
func NewJSStreamMaxBytesRequiredError(opts ...ErrorOption) *ApiError {
3✔
2624
        eopts := parseOpts(opts)
3✔
2625
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2626
                return ae
×
2627
        }
×
2628

2629
        return ApiErrors[JSStreamMaxBytesRequired]
3✔
2630
}
2631

2632
// NewJSStreamMaxStreamBytesExceededError creates a new JSStreamMaxStreamBytesExceeded error: "stream max bytes exceeds account limit max stream bytes"
2633
func NewJSStreamMaxStreamBytesExceededError(opts ...ErrorOption) *ApiError {
2✔
2634
        eopts := parseOpts(opts)
2✔
2635
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2636
                return ae
×
2637
        }
×
2638

2639
        return ApiErrors[JSStreamMaxStreamBytesExceeded]
2✔
2640
}
2641

2642
// NewJSStreamMessageExceedsMaximumError creates a new JSStreamMessageExceedsMaximumErr error: "message size exceeds maximum allowed"
2643
func NewJSStreamMessageExceedsMaximumError(opts ...ErrorOption) *ApiError {
19✔
2644
        eopts := parseOpts(opts)
19✔
2645
        if ae, ok := eopts.err.(*ApiError); ok {
19✔
2646
                return ae
×
2647
        }
×
2648

2649
        return ApiErrors[JSStreamMessageExceedsMaximumErr]
19✔
2650
}
2651

2652
// NewJSStreamMinLastSeqError creates a new JSStreamMinLastSeqErr error: "min last sequence"
2653
func NewJSStreamMinLastSeqError(opts ...ErrorOption) *ApiError {
×
2654
        eopts := parseOpts(opts)
×
2655
        if ae, ok := eopts.err.(*ApiError); ok {
×
2656
                return ae
×
2657
        }
×
2658

2659
        return ApiErrors[JSStreamMinLastSeqErr]
×
2660
}
2661

2662
// NewJSStreamMirrorNotUpdatableError creates a new JSStreamMirrorNotUpdatableErr error: "stream mirror configuration can not be updated"
2663
func NewJSStreamMirrorNotUpdatableError(opts ...ErrorOption) *ApiError {
2✔
2664
        eopts := parseOpts(opts)
2✔
2665
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2666
                return ae
×
2667
        }
×
2668

2669
        return ApiErrors[JSStreamMirrorNotUpdatableErr]
2✔
2670
}
2671

2672
// NewJSStreamMismatchError creates a new JSStreamMismatchErr error: "stream name in subject does not match request"
2673
func NewJSStreamMismatchError(opts ...ErrorOption) *ApiError {
3✔
2674
        eopts := parseOpts(opts)
3✔
2675
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2676
                return ae
×
2677
        }
×
2678

2679
        return ApiErrors[JSStreamMismatchErr]
3✔
2680
}
2681

2682
// NewJSStreamMoveAndScaleError creates a new JSStreamMoveAndScaleErr error: "can not move and scale a stream in a single update"
2683
func NewJSStreamMoveAndScaleError(opts ...ErrorOption) *ApiError {
4✔
2684
        eopts := parseOpts(opts)
4✔
2685
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2686
                return ae
×
2687
        }
×
2688

2689
        return ApiErrors[JSStreamMoveAndScaleErr]
4✔
2690
}
2691

2692
// NewJSStreamMoveInProgressError creates a new JSStreamMoveInProgressF error: "stream move already in progress: {msg}"
2693
func NewJSStreamMoveInProgressError(msg interface{}, opts ...ErrorOption) *ApiError {
2✔
2694
        eopts := parseOpts(opts)
2✔
2695
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2696
                return ae
×
2697
        }
×
2698

2699
        e := ApiErrors[JSStreamMoveInProgressF]
2✔
2700
        args := e.toReplacerArgs([]interface{}{"{msg}", msg})
2✔
2701
        return &ApiError{
2✔
2702
                Code:        e.Code,
2✔
2703
                ErrCode:     e.ErrCode,
2✔
2704
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2705
        }
2✔
2706
}
2707

2708
// NewJSStreamMoveNotInProgressError creates a new JSStreamMoveNotInProgress error: "stream move not in progress"
2709
func NewJSStreamMoveNotInProgressError(opts ...ErrorOption) *ApiError {
×
2710
        eopts := parseOpts(opts)
×
2711
        if ae, ok := eopts.err.(*ApiError); ok {
×
2712
                return ae
×
2713
        }
×
2714

2715
        return ApiErrors[JSStreamMoveNotInProgress]
×
2716
}
2717

2718
// NewJSStreamMsgDeleteFailedError creates a new JSStreamMsgDeleteFailedF error: "{err}"
2719
func NewJSStreamMsgDeleteFailedError(err error, opts ...ErrorOption) *ApiError {
1✔
2720
        eopts := parseOpts(opts)
1✔
2721
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2722
                return ae
×
2723
        }
×
2724

2725
        e := ApiErrors[JSStreamMsgDeleteFailedF]
1✔
2726
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2727
        return &ApiError{
1✔
2728
                Code:        e.Code,
1✔
2729
                ErrCode:     e.ErrCode,
1✔
2730
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2731
        }
1✔
2732
}
2733

2734
// NewJSStreamNameContainsPathSeparatorsError creates a new JSStreamNameContainsPathSeparatorsErr error: "Stream name can not contain path separators"
2735
func NewJSStreamNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
6✔
2736
        eopts := parseOpts(opts)
6✔
2737
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2738
                return ae
×
2739
        }
×
2740

2741
        return ApiErrors[JSStreamNameContainsPathSeparatorsErr]
6✔
2742
}
2743

2744
// NewJSStreamNameExistError creates a new JSStreamNameExistErr error: "stream name already in use with a different configuration"
2745
func NewJSStreamNameExistError(opts ...ErrorOption) *ApiError {
10✔
2746
        eopts := parseOpts(opts)
10✔
2747
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2748
                return ae
×
2749
        }
×
2750

2751
        return ApiErrors[JSStreamNameExistErr]
10✔
2752
}
2753

2754
// NewJSStreamNameExistRestoreFailedError creates a new JSStreamNameExistRestoreFailedErr error: "stream name already in use, cannot restore"
2755
func NewJSStreamNameExistRestoreFailedError(opts ...ErrorOption) *ApiError {
3✔
2756
        eopts := parseOpts(opts)
3✔
2757
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2758
                return ae
×
2759
        }
×
2760

2761
        return ApiErrors[JSStreamNameExistRestoreFailedErr]
3✔
2762
}
2763

2764
// NewJSStreamNotFoundError creates a new JSStreamNotFoundErr error: "stream not found"
2765
func NewJSStreamNotFoundError(opts ...ErrorOption) *ApiError {
25,284✔
2766
        eopts := parseOpts(opts)
25,284✔
2767
        if ae, ok := eopts.err.(*ApiError); ok {
25,955✔
2768
                return ae
671✔
2769
        }
671✔
2770

2771
        return ApiErrors[JSStreamNotFoundErr]
24,613✔
2772
}
2773

2774
// NewJSStreamNotMatchError creates a new JSStreamNotMatchErr error: "expected stream does not match"
2775
func NewJSStreamNotMatchError(opts ...ErrorOption) *ApiError {
5✔
2776
        eopts := parseOpts(opts)
5✔
2777
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2778
                return ae
×
2779
        }
×
2780

2781
        return ApiErrors[JSStreamNotMatchErr]
5✔
2782
}
2783

2784
// NewJSStreamOfflineError creates a new JSStreamOfflineErr error: "stream is offline"
2785
func NewJSStreamOfflineError(opts ...ErrorOption) *ApiError {
6✔
2786
        eopts := parseOpts(opts)
6✔
2787
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2788
                return ae
×
2789
        }
×
2790

2791
        return ApiErrors[JSStreamOfflineErr]
6✔
2792
}
2793

2794
// NewJSStreamOfflineReasonError creates a new JSStreamOfflineReasonErrF error: "stream is offline: {err}"
2795
func NewJSStreamOfflineReasonError(err error, opts ...ErrorOption) *ApiError {
40✔
2796
        eopts := parseOpts(opts)
40✔
2797
        if ae, ok := eopts.err.(*ApiError); ok {
40✔
2798
                return ae
×
2799
        }
×
2800

2801
        e := ApiErrors[JSStreamOfflineReasonErrF]
40✔
2802
        args := e.toReplacerArgs([]interface{}{"{err}", err})
40✔
2803
        return &ApiError{
40✔
2804
                Code:        e.Code,
40✔
2805
                ErrCode:     e.ErrCode,
40✔
2806
                Description: strings.NewReplacer(args...).Replace(e.Description),
40✔
2807
        }
40✔
2808
}
2809

2810
// NewJSStreamPurgeFailedError creates a new JSStreamPurgeFailedF error: "{err}"
2811
func NewJSStreamPurgeFailedError(err error, opts ...ErrorOption) *ApiError {
1✔
2812
        eopts := parseOpts(opts)
1✔
2813
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2814
                return ae
×
2815
        }
×
2816

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

2826
// NewJSStreamReplicasNotSupportedError creates a new JSStreamReplicasNotSupportedErr error: "replicas > 1 not supported in non-clustered mode"
2827
func NewJSStreamReplicasNotSupportedError(opts ...ErrorOption) *ApiError {
1✔
2828
        eopts := parseOpts(opts)
1✔
2829
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2830
                return ae
×
2831
        }
×
2832

2833
        return ApiErrors[JSStreamReplicasNotSupportedErr]
1✔
2834
}
2835

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

2843
        return ApiErrors[JSStreamReplicasNotUpdatableErr]
×
2844
}
2845

2846
// NewJSStreamRestoreError creates a new JSStreamRestoreErrF error: "restore failed: {err}"
2847
func NewJSStreamRestoreError(err error, opts ...ErrorOption) *ApiError {
7✔
2848
        eopts := parseOpts(opts)
7✔
2849
        if ae, ok := eopts.err.(*ApiError); ok {
9✔
2850
                return ae
2✔
2851
        }
2✔
2852

2853
        e := ApiErrors[JSStreamRestoreErrF]
5✔
2854
        args := e.toReplacerArgs([]interface{}{"{err}", err})
5✔
2855
        return &ApiError{
5✔
2856
                Code:        e.Code,
5✔
2857
                ErrCode:     e.ErrCode,
5✔
2858
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
2859
        }
5✔
2860
}
2861

2862
// NewJSStreamRollupFailedError creates a new JSStreamRollupFailedF error: "{err}"
2863
func NewJSStreamRollupFailedError(err error, opts ...ErrorOption) *ApiError {
13✔
2864
        eopts := parseOpts(opts)
13✔
2865
        if ae, ok := eopts.err.(*ApiError); ok {
13✔
2866
                return ae
×
2867
        }
×
2868

2869
        e := ApiErrors[JSStreamRollupFailedF]
13✔
2870
        args := e.toReplacerArgs([]interface{}{"{err}", err})
13✔
2871
        return &ApiError{
13✔
2872
                Code:        e.Code,
13✔
2873
                ErrCode:     e.ErrCode,
13✔
2874
                Description: strings.NewReplacer(args...).Replace(e.Description),
13✔
2875
        }
13✔
2876
}
2877

2878
// NewJSStreamSealedError creates a new JSStreamSealedErr error: "invalid operation on sealed stream"
2879
func NewJSStreamSealedError(opts ...ErrorOption) *ApiError {
10✔
2880
        eopts := parseOpts(opts)
10✔
2881
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2882
                return ae
×
2883
        }
×
2884

2885
        return ApiErrors[JSStreamSealedErr]
10✔
2886
}
2887

2888
// NewJSStreamSequenceNotMatchError creates a new JSStreamSequenceNotMatchErr error: "expected stream sequence does not match"
2889
func NewJSStreamSequenceNotMatchError(opts ...ErrorOption) *ApiError {
×
2890
        eopts := parseOpts(opts)
×
2891
        if ae, ok := eopts.err.(*ApiError); ok {
×
2892
                return ae
×
2893
        }
×
2894

2895
        return ApiErrors[JSStreamSequenceNotMatchErr]
×
2896
}
2897

2898
// NewJSStreamSnapshotError creates a new JSStreamSnapshotErrF error: "snapshot failed: {err}"
2899
func NewJSStreamSnapshotError(err error, opts ...ErrorOption) *ApiError {
×
2900
        eopts := parseOpts(opts)
×
2901
        if ae, ok := eopts.err.(*ApiError); ok {
×
2902
                return ae
×
2903
        }
×
2904

2905
        e := ApiErrors[JSStreamSnapshotErrF]
×
2906
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2907
        return &ApiError{
×
2908
                Code:        e.Code,
×
2909
                ErrCode:     e.ErrCode,
×
2910
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2911
        }
×
2912
}
2913

2914
// NewJSStreamStoreFailedError creates a new JSStreamStoreFailedF error: "{err}"
2915
func NewJSStreamStoreFailedError(err error, opts ...ErrorOption) *ApiError {
2,486✔
2916
        eopts := parseOpts(opts)
2,486✔
2917
        if ae, ok := eopts.err.(*ApiError); ok {
2,486✔
2918
                return ae
×
2919
        }
×
2920

2921
        e := ApiErrors[JSStreamStoreFailedF]
2,486✔
2922
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2,486✔
2923
        return &ApiError{
2,486✔
2924
                Code:        e.Code,
2,486✔
2925
                ErrCode:     e.ErrCode,
2,486✔
2926
                Description: strings.NewReplacer(args...).Replace(e.Description),
2,486✔
2927
        }
2,486✔
2928
}
2929

2930
// NewJSStreamSubjectOverlapError creates a new JSStreamSubjectOverlapErr error: "subjects overlap with an existing stream"
2931
func NewJSStreamSubjectOverlapError(opts ...ErrorOption) *ApiError {
37✔
2932
        eopts := parseOpts(opts)
37✔
2933
        if ae, ok := eopts.err.(*ApiError); ok {
37✔
2934
                return ae
×
2935
        }
×
2936

2937
        return ApiErrors[JSStreamSubjectOverlapErr]
37✔
2938
}
2939

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

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

2956
// NewJSStreamTemplateDeleteError creates a new JSStreamTemplateDeleteErrF error: "{err}"
2957
func NewJSStreamTemplateDeleteError(err error, opts ...ErrorOption) *ApiError {
1✔
2958
        eopts := parseOpts(opts)
1✔
2959
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2960
                return ae
1✔
2961
        }
1✔
2962

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

2972
// NewJSStreamTemplateNotFoundError creates a new JSStreamTemplateNotFoundErr error: "template not found"
2973
func NewJSStreamTemplateNotFoundError(opts ...ErrorOption) *ApiError {
4✔
2974
        eopts := parseOpts(opts)
4✔
2975
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2976
                return ae
×
2977
        }
×
2978

2979
        return ApiErrors[JSStreamTemplateNotFoundErr]
4✔
2980
}
2981

2982
// NewJSStreamTooManyRequestsError creates a new JSStreamTooManyRequests error: "too many requests"
2983
func NewJSStreamTooManyRequestsError(opts ...ErrorOption) *ApiError {
246✔
2984
        eopts := parseOpts(opts)
246✔
2985
        if ae, ok := eopts.err.(*ApiError); ok {
246✔
2986
                return ae
×
2987
        }
×
2988

2989
        return ApiErrors[JSStreamTooManyRequests]
246✔
2990
}
2991

2992
// NewJSStreamTransformInvalidDestinationError creates a new JSStreamTransformInvalidDestination error: "stream transform: {err}"
2993
func NewJSStreamTransformInvalidDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
2994
        eopts := parseOpts(opts)
1✔
2995
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2996
                return ae
×
2997
        }
×
2998

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

3008
// NewJSStreamTransformInvalidSourceError creates a new JSStreamTransformInvalidSource error: "stream transform source: {err}"
3009
func NewJSStreamTransformInvalidSourceError(err error, opts ...ErrorOption) *ApiError {
1✔
3010
        eopts := parseOpts(opts)
1✔
3011
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3012
                return ae
×
3013
        }
×
3014

3015
        e := ApiErrors[JSStreamTransformInvalidSource]
1✔
3016
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
3017
        return &ApiError{
1✔
3018
                Code:        e.Code,
1✔
3019
                ErrCode:     e.ErrCode,
1✔
3020
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
3021
        }
1✔
3022
}
3023

3024
// NewJSStreamUpdateError creates a new JSStreamUpdateErrF error: "{err}"
3025
func NewJSStreamUpdateError(err error, opts ...ErrorOption) *ApiError {
29✔
3026
        eopts := parseOpts(opts)
29✔
3027
        if ae, ok := eopts.err.(*ApiError); ok {
52✔
3028
                return ae
23✔
3029
        }
23✔
3030

3031
        e := ApiErrors[JSStreamUpdateErrF]
6✔
3032
        args := e.toReplacerArgs([]interface{}{"{err}", err})
6✔
3033
        return &ApiError{
6✔
3034
                Code:        e.Code,
6✔
3035
                ErrCode:     e.ErrCode,
6✔
3036
                Description: strings.NewReplacer(args...).Replace(e.Description),
6✔
3037
        }
6✔
3038
}
3039

3040
// NewJSStreamWrongLastMsgIDError creates a new JSStreamWrongLastMsgIDErrF error: "wrong last msg ID: {id}"
3041
func NewJSStreamWrongLastMsgIDError(id interface{}, opts ...ErrorOption) *ApiError {
5✔
3042
        eopts := parseOpts(opts)
5✔
3043
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
3044
                return ae
×
3045
        }
×
3046

3047
        e := ApiErrors[JSStreamWrongLastMsgIDErrF]
5✔
3048
        args := e.toReplacerArgs([]interface{}{"{id}", id})
5✔
3049
        return &ApiError{
5✔
3050
                Code:        e.Code,
5✔
3051
                ErrCode:     e.ErrCode,
5✔
3052
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
3053
        }
5✔
3054
}
3055

3056
// NewJSStreamWrongLastSequenceConstantError creates a new JSStreamWrongLastSequenceConstantErr error: "wrong last sequence"
3057
func NewJSStreamWrongLastSequenceConstantError(opts ...ErrorOption) *ApiError {
23✔
3058
        eopts := parseOpts(opts)
23✔
3059
        if ae, ok := eopts.err.(*ApiError); ok {
23✔
3060
                return ae
×
3061
        }
×
3062

3063
        return ApiErrors[JSStreamWrongLastSequenceConstantErr]
23✔
3064
}
3065

3066
// NewJSStreamWrongLastSequenceError creates a new JSStreamWrongLastSequenceErrF error: "wrong last sequence: {seq}"
3067
func NewJSStreamWrongLastSequenceError(seq uint64, opts ...ErrorOption) *ApiError {
96✔
3068
        eopts := parseOpts(opts)
96✔
3069
        if ae, ok := eopts.err.(*ApiError); ok {
96✔
3070
                return ae
×
3071
        }
×
3072

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

3082
// NewJSTempStorageFailedError creates a new JSTempStorageFailedErr error: "JetStream unable to open temp storage for restore"
3083
func NewJSTempStorageFailedError(opts ...ErrorOption) *ApiError {
×
3084
        eopts := parseOpts(opts)
×
3085
        if ae, ok := eopts.err.(*ApiError); ok {
×
3086
                return ae
×
3087
        }
×
3088

3089
        return ApiErrors[JSTempStorageFailedErr]
×
3090
}
3091

3092
// NewJSTemplateNameNotMatchSubjectError creates a new JSTemplateNameNotMatchSubjectErr error: "template name in subject does not match request"
3093
func NewJSTemplateNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
1✔
3094
        eopts := parseOpts(opts)
1✔
3095
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3096
                return ae
×
3097
        }
×
3098

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