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

nats-io / nats-server / 17572013453

08 Sep 2025 04:12PM UTC coverage: 86.033% (-0.02%) from 86.048%
17572013453

push

github

neilalexander
Release v2.12.0-RC.1

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

74115 of 86147 relevant lines covered (86.03%)

347566.54 hits per line

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

55.01
/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
        // JSAtomicPublishTooLargeBatchErr atomic publish batch is too large
24
        JSAtomicPublishTooLargeBatchErr 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
                JSAtomicPublishTooLargeBatchErr:              {Code: 400, ErrCode: 10199, Description: "atomic publish batch is too large"},
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,060✔
830
        eopts := parseOpts(opts)
20,060✔
831
        if ae, ok := eopts.err.(*ApiError); ok {
20,060✔
832
                return ae
×
833
        }
×
834

835
        return ApiErrors[JSAccountResourcesExceededErr]
20,060✔
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 {
68✔
850
        eopts := parseOpts(opts)
68✔
851
        if ae, ok := eopts.err.(*ApiError); ok {
68✔
852
                return ae
×
853
        }
×
854

855
        return ApiErrors[JSAtomicPublishIncompleteBatchErr]
68✔
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 JSAtomicPublishTooLargeBatchErr error: "atomic publish batch is too large"
879
func NewJSAtomicPublishTooLargeBatchError(opts ...ErrorOption) *ApiError {
4✔
880
        eopts := parseOpts(opts)
4✔
881
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
882
                return ae
×
883
        }
×
884

885
        return ApiErrors[JSAtomicPublishTooLargeBatchErr]
4✔
886
}
887

888
// NewJSAtomicPublishUnsupportedHeaderBatchError creates a new JSAtomicPublishUnsupportedHeaderBatchErr error: "atomic publish unsupported header used: {header}"
889
func NewJSAtomicPublishUnsupportedHeaderBatchError(header interface{}, opts ...ErrorOption) *ApiError {
32✔
890
        eopts := parseOpts(opts)
32✔
891
        if ae, ok := eopts.err.(*ApiError); ok {
32✔
892
                return ae
×
893
        }
×
894

895
        e := ApiErrors[JSAtomicPublishUnsupportedHeaderBatchErr]
32✔
896
        args := e.toReplacerArgs([]interface{}{"{header}", header})
32✔
897
        return &ApiError{
32✔
898
                Code:        e.Code,
32✔
899
                ErrCode:     e.ErrCode,
32✔
900
                Description: strings.NewReplacer(args...).Replace(e.Description),
32✔
901
        }
32✔
902
}
903

904
// NewJSBadRequestError creates a new JSBadRequestErr error: "bad request"
905
func NewJSBadRequestError(opts ...ErrorOption) *ApiError {
10✔
906
        eopts := parseOpts(opts)
10✔
907
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
908
                return ae
×
909
        }
×
910

911
        return ApiErrors[JSBadRequestErr]
10✔
912
}
913

914
// NewJSClusterIncompleteError creates a new JSClusterIncompleteErr error: "incomplete results"
915
func NewJSClusterIncompleteError(opts ...ErrorOption) *ApiError {
×
916
        eopts := parseOpts(opts)
×
917
        if ae, ok := eopts.err.(*ApiError); ok {
×
918
                return ae
×
919
        }
×
920

921
        return ApiErrors[JSClusterIncompleteErr]
×
922
}
923

924
// NewJSClusterNoPeersError creates a new JSClusterNoPeersErrF error: "{err}"
925
func NewJSClusterNoPeersError(err error, opts ...ErrorOption) *ApiError {
58✔
926
        eopts := parseOpts(opts)
58✔
927
        if ae, ok := eopts.err.(*ApiError); ok {
58✔
928
                return ae
×
929
        }
×
930

931
        e := ApiErrors[JSClusterNoPeersErrF]
58✔
932
        args := e.toReplacerArgs([]interface{}{"{err}", err})
58✔
933
        return &ApiError{
58✔
934
                Code:        e.Code,
58✔
935
                ErrCode:     e.ErrCode,
58✔
936
                Description: strings.NewReplacer(args...).Replace(e.Description),
58✔
937
        }
58✔
938
}
939

940
// NewJSClusterNotActiveError creates a new JSClusterNotActiveErr error: "JetStream not in clustered mode"
941
func NewJSClusterNotActiveError(opts ...ErrorOption) *ApiError {
1✔
942
        eopts := parseOpts(opts)
1✔
943
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
944
                return ae
×
945
        }
×
946

947
        return ApiErrors[JSClusterNotActiveErr]
1✔
948
}
949

950
// NewJSClusterNotAssignedError creates a new JSClusterNotAssignedErr error: "JetStream cluster not assigned to this server"
951
func NewJSClusterNotAssignedError(opts ...ErrorOption) *ApiError {
34✔
952
        eopts := parseOpts(opts)
34✔
953
        if ae, ok := eopts.err.(*ApiError); ok {
34✔
954
                return ae
×
955
        }
×
956

957
        return ApiErrors[JSClusterNotAssignedErr]
34✔
958
}
959

960
// NewJSClusterNotAvailError creates a new JSClusterNotAvailErr error: "JetStream system temporarily unavailable"
961
func NewJSClusterNotAvailError(opts ...ErrorOption) *ApiError {
13✔
962
        eopts := parseOpts(opts)
13✔
963
        if ae, ok := eopts.err.(*ApiError); ok {
13✔
964
                return ae
×
965
        }
×
966

967
        return ApiErrors[JSClusterNotAvailErr]
13✔
968
}
969

970
// NewJSClusterNotLeaderError creates a new JSClusterNotLeaderErr error: "JetStream cluster can not handle request"
971
func NewJSClusterNotLeaderError(opts ...ErrorOption) *ApiError {
6✔
972
        eopts := parseOpts(opts)
6✔
973
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
974
                return ae
×
975
        }
×
976

977
        return ApiErrors[JSClusterNotLeaderErr]
6✔
978
}
979

980
// NewJSClusterPeerNotMemberError creates a new JSClusterPeerNotMemberErr error: "peer not a member"
981
func NewJSClusterPeerNotMemberError(opts ...ErrorOption) *ApiError {
1✔
982
        eopts := parseOpts(opts)
1✔
983
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
984
                return ae
×
985
        }
×
986

987
        return ApiErrors[JSClusterPeerNotMemberErr]
1✔
988
}
989

990
// NewJSClusterRequiredError creates a new JSClusterRequiredErr error: "JetStream clustering support required"
991
func NewJSClusterRequiredError(opts ...ErrorOption) *ApiError {
×
992
        eopts := parseOpts(opts)
×
993
        if ae, ok := eopts.err.(*ApiError); ok {
×
994
                return ae
×
995
        }
×
996

997
        return ApiErrors[JSClusterRequiredErr]
×
998
}
999

1000
// NewJSClusterServerNotMemberError creates a new JSClusterServerNotMemberErr error: "server is not a member of the cluster"
1001
func NewJSClusterServerNotMemberError(opts ...ErrorOption) *ApiError {
3✔
1002
        eopts := parseOpts(opts)
3✔
1003
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1004
                return ae
×
1005
        }
×
1006

1007
        return ApiErrors[JSClusterServerNotMemberErr]
3✔
1008
}
1009

1010
// NewJSClusterTagsError creates a new JSClusterTagsErr error: "tags placement not supported for operation"
1011
func NewJSClusterTagsError(opts ...ErrorOption) *ApiError {
×
1012
        eopts := parseOpts(opts)
×
1013
        if ae, ok := eopts.err.(*ApiError); ok {
×
1014
                return ae
×
1015
        }
×
1016

1017
        return ApiErrors[JSClusterTagsErr]
×
1018
}
1019

1020
// NewJSClusterUnSupportFeatureError creates a new JSClusterUnSupportFeatureErr error: "not currently supported in clustered mode"
1021
func NewJSClusterUnSupportFeatureError(opts ...ErrorOption) *ApiError {
6✔
1022
        eopts := parseOpts(opts)
6✔
1023
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1024
                return ae
×
1025
        }
×
1026

1027
        return ApiErrors[JSClusterUnSupportFeatureErr]
6✔
1028
}
1029

1030
// NewJSConsumerAckPolicyInvalidError creates a new JSConsumerAckPolicyInvalidErr error: "consumer ack policy invalid"
1031
func NewJSConsumerAckPolicyInvalidError(opts ...ErrorOption) *ApiError {
2✔
1032
        eopts := parseOpts(opts)
2✔
1033
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1034
                return ae
×
1035
        }
×
1036

1037
        return ApiErrors[JSConsumerAckPolicyInvalidErr]
2✔
1038
}
1039

1040
// NewJSConsumerAckWaitNegativeError creates a new JSConsumerAckWaitNegativeErr error: "consumer ack wait needs to be positive"
1041
func NewJSConsumerAckWaitNegativeError(opts ...ErrorOption) *ApiError {
2✔
1042
        eopts := parseOpts(opts)
2✔
1043
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1044
                return ae
×
1045
        }
×
1046

1047
        return ApiErrors[JSConsumerAckWaitNegativeErr]
2✔
1048
}
1049

1050
// NewJSConsumerAlreadyExistsError creates a new JSConsumerAlreadyExists error: "consumer already exists"
1051
func NewJSConsumerAlreadyExistsError(opts ...ErrorOption) *ApiError {
5✔
1052
        eopts := parseOpts(opts)
5✔
1053
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
1054
                return ae
×
1055
        }
×
1056

1057
        return ApiErrors[JSConsumerAlreadyExists]
5✔
1058
}
1059

1060
// NewJSConsumerBackOffNegativeError creates a new JSConsumerBackOffNegativeErr error: "consumer backoff needs to be positive"
1061
func NewJSConsumerBackOffNegativeError(opts ...ErrorOption) *ApiError {
2✔
1062
        eopts := parseOpts(opts)
2✔
1063
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1064
                return ae
×
1065
        }
×
1066

1067
        return ApiErrors[JSConsumerBackOffNegativeErr]
2✔
1068
}
1069

1070
// NewJSConsumerBadDurableNameError creates a new JSConsumerBadDurableNameErr error: "durable name can not contain '.', '*', '>'"
1071
func NewJSConsumerBadDurableNameError(opts ...ErrorOption) *ApiError {
×
1072
        eopts := parseOpts(opts)
×
1073
        if ae, ok := eopts.err.(*ApiError); ok {
×
1074
                return ae
×
1075
        }
×
1076

1077
        return ApiErrors[JSConsumerBadDurableNameErr]
×
1078
}
1079

1080
// NewJSConsumerConfigRequiredError creates a new JSConsumerConfigRequiredErr error: "consumer config required"
1081
func NewJSConsumerConfigRequiredError(opts ...ErrorOption) *ApiError {
2✔
1082
        eopts := parseOpts(opts)
2✔
1083
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1084
                return ae
×
1085
        }
×
1086

1087
        return ApiErrors[JSConsumerConfigRequiredErr]
2✔
1088
}
1089

1090
// NewJSConsumerCreateDurableAndNameMismatchError creates a new JSConsumerCreateDurableAndNameMismatch error: "Consumer Durable and Name have to be equal if both are provided"
1091
func NewJSConsumerCreateDurableAndNameMismatchError(opts ...ErrorOption) *ApiError {
1✔
1092
        eopts := parseOpts(opts)
1✔
1093
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1094
                return ae
×
1095
        }
×
1096

1097
        return ApiErrors[JSConsumerCreateDurableAndNameMismatch]
1✔
1098
}
1099

1100
// NewJSConsumerCreateError creates a new JSConsumerCreateErrF error: "{err}"
1101
func NewJSConsumerCreateError(err error, opts ...ErrorOption) *ApiError {
71✔
1102
        eopts := parseOpts(opts)
71✔
1103
        if ae, ok := eopts.err.(*ApiError); ok {
124✔
1104
                return ae
53✔
1105
        }
53✔
1106

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

1116
// NewJSConsumerCreateFilterSubjectMismatchError creates a new JSConsumerCreateFilterSubjectMismatchErr error: "Consumer create request did not match filtered subject from create subject"
1117
func NewJSConsumerCreateFilterSubjectMismatchError(opts ...ErrorOption) *ApiError {
2✔
1118
        eopts := parseOpts(opts)
2✔
1119
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1120
                return ae
×
1121
        }
×
1122

1123
        return ApiErrors[JSConsumerCreateFilterSubjectMismatchErr]
2✔
1124
}
1125

1126
// NewJSConsumerDeliverCycleError creates a new JSConsumerDeliverCycleErr error: "consumer deliver subject forms a cycle"
1127
func NewJSConsumerDeliverCycleError(opts ...ErrorOption) *ApiError {
4✔
1128
        eopts := parseOpts(opts)
4✔
1129
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1130
                return ae
×
1131
        }
×
1132

1133
        return ApiErrors[JSConsumerDeliverCycleErr]
4✔
1134
}
1135

1136
// NewJSConsumerDeliverToWildcardsError creates a new JSConsumerDeliverToWildcardsErr error: "consumer deliver subject has wildcards"
1137
func NewJSConsumerDeliverToWildcardsError(opts ...ErrorOption) *ApiError {
4✔
1138
        eopts := parseOpts(opts)
4✔
1139
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1140
                return ae
×
1141
        }
×
1142

1143
        return ApiErrors[JSConsumerDeliverToWildcardsErr]
4✔
1144
}
1145

1146
// NewJSConsumerDescriptionTooLongError creates a new JSConsumerDescriptionTooLongErrF error: "consumer description is too long, maximum allowed is {max}"
1147
func NewJSConsumerDescriptionTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
1✔
1148
        eopts := parseOpts(opts)
1✔
1149
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1150
                return ae
×
1151
        }
×
1152

1153
        e := ApiErrors[JSConsumerDescriptionTooLongErrF]
1✔
1154
        args := e.toReplacerArgs([]interface{}{"{max}", max})
1✔
1155
        return &ApiError{
1✔
1156
                Code:        e.Code,
1✔
1157
                ErrCode:     e.ErrCode,
1✔
1158
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1159
        }
1✔
1160
}
1161

1162
// NewJSConsumerDirectRequiresEphemeralError creates a new JSConsumerDirectRequiresEphemeralErr error: "consumer direct requires an ephemeral consumer"
1163
func NewJSConsumerDirectRequiresEphemeralError(opts ...ErrorOption) *ApiError {
×
1164
        eopts := parseOpts(opts)
×
1165
        if ae, ok := eopts.err.(*ApiError); ok {
×
1166
                return ae
×
1167
        }
×
1168

1169
        return ApiErrors[JSConsumerDirectRequiresEphemeralErr]
×
1170
}
1171

1172
// NewJSConsumerDirectRequiresPushError creates a new JSConsumerDirectRequiresPushErr error: "consumer direct requires a push based consumer"
1173
func NewJSConsumerDirectRequiresPushError(opts ...ErrorOption) *ApiError {
×
1174
        eopts := parseOpts(opts)
×
1175
        if ae, ok := eopts.err.(*ApiError); ok {
×
1176
                return ae
×
1177
        }
×
1178

1179
        return ApiErrors[JSConsumerDirectRequiresPushErr]
×
1180
}
1181

1182
// NewJSConsumerDoesNotExistError creates a new JSConsumerDoesNotExist error: "consumer does not exist"
1183
func NewJSConsumerDoesNotExistError(opts ...ErrorOption) *ApiError {
3✔
1184
        eopts := parseOpts(opts)
3✔
1185
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1186
                return ae
×
1187
        }
×
1188

1189
        return ApiErrors[JSConsumerDoesNotExist]
3✔
1190
}
1191

1192
// NewJSConsumerDuplicateFilterSubjectsError creates a new JSConsumerDuplicateFilterSubjects error: "consumer cannot have both FilterSubject and FilterSubjects specified"
1193
func NewJSConsumerDuplicateFilterSubjectsError(opts ...ErrorOption) *ApiError {
1✔
1194
        eopts := parseOpts(opts)
1✔
1195
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1196
                return ae
×
1197
        }
×
1198

1199
        return ApiErrors[JSConsumerDuplicateFilterSubjects]
1✔
1200
}
1201

1202
// NewJSConsumerDurableNameNotInSubjectError creates a new JSConsumerDurableNameNotInSubjectErr error: "consumer expected to be durable but no durable name set in subject"
1203
func NewJSConsumerDurableNameNotInSubjectError(opts ...ErrorOption) *ApiError {
×
1204
        eopts := parseOpts(opts)
×
1205
        if ae, ok := eopts.err.(*ApiError); ok {
×
1206
                return ae
×
1207
        }
×
1208

1209
        return ApiErrors[JSConsumerDurableNameNotInSubjectErr]
×
1210
}
1211

1212
// NewJSConsumerDurableNameNotMatchSubjectError creates a new JSConsumerDurableNameNotMatchSubjectErr error: "consumer name in subject does not match durable name in request"
1213
func NewJSConsumerDurableNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
×
1214
        eopts := parseOpts(opts)
×
1215
        if ae, ok := eopts.err.(*ApiError); ok {
×
1216
                return ae
×
1217
        }
×
1218

1219
        return ApiErrors[JSConsumerDurableNameNotMatchSubjectErr]
×
1220
}
1221

1222
// NewJSConsumerDurableNameNotSetError creates a new JSConsumerDurableNameNotSetErr error: "consumer expected to be durable but a durable name was not set"
1223
func NewJSConsumerDurableNameNotSetError(opts ...ErrorOption) *ApiError {
1✔
1224
        eopts := parseOpts(opts)
1✔
1225
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1226
                return ae
×
1227
        }
×
1228

1229
        return ApiErrors[JSConsumerDurableNameNotSetErr]
1✔
1230
}
1231

1232
// NewJSConsumerEmptyFilterError creates a new JSConsumerEmptyFilter error: "consumer filter in FilterSubjects cannot be empty"
1233
func NewJSConsumerEmptyFilterError(opts ...ErrorOption) *ApiError {
1✔
1234
        eopts := parseOpts(opts)
1✔
1235
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1236
                return ae
×
1237
        }
×
1238

1239
        return ApiErrors[JSConsumerEmptyFilter]
1✔
1240
}
1241

1242
// NewJSConsumerEmptyGroupNameError creates a new JSConsumerEmptyGroupName error: "Group name cannot be an empty string"
1243
func NewJSConsumerEmptyGroupNameError(opts ...ErrorOption) *ApiError {
4✔
1244
        eopts := parseOpts(opts)
4✔
1245
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1246
                return ae
×
1247
        }
×
1248

1249
        return ApiErrors[JSConsumerEmptyGroupName]
4✔
1250
}
1251

1252
// NewJSConsumerEphemeralWithDurableInSubjectError creates a new JSConsumerEphemeralWithDurableInSubjectErr error: "consumer expected to be ephemeral but detected a durable name set in subject"
1253
func NewJSConsumerEphemeralWithDurableInSubjectError(opts ...ErrorOption) *ApiError {
×
1254
        eopts := parseOpts(opts)
×
1255
        if ae, ok := eopts.err.(*ApiError); ok {
×
1256
                return ae
×
1257
        }
×
1258

1259
        return ApiErrors[JSConsumerEphemeralWithDurableInSubjectErr]
×
1260
}
1261

1262
// NewJSConsumerEphemeralWithDurableNameError creates a new JSConsumerEphemeralWithDurableNameErr error: "consumer expected to be ephemeral but a durable name was set in request"
1263
func NewJSConsumerEphemeralWithDurableNameError(opts ...ErrorOption) *ApiError {
3✔
1264
        eopts := parseOpts(opts)
3✔
1265
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1266
                return ae
×
1267
        }
×
1268

1269
        return ApiErrors[JSConsumerEphemeralWithDurableNameErr]
3✔
1270
}
1271

1272
// NewJSConsumerExistingActiveError creates a new JSConsumerExistingActiveErr error: "consumer already exists and is still active"
1273
func NewJSConsumerExistingActiveError(opts ...ErrorOption) *ApiError {
×
1274
        eopts := parseOpts(opts)
×
1275
        if ae, ok := eopts.err.(*ApiError); ok {
×
1276
                return ae
×
1277
        }
×
1278

1279
        return ApiErrors[JSConsumerExistingActiveErr]
×
1280
}
1281

1282
// NewJSConsumerFCRequiresPushError creates a new JSConsumerFCRequiresPushErr error: "consumer flow control requires a push based consumer"
1283
func NewJSConsumerFCRequiresPushError(opts ...ErrorOption) *ApiError {
×
1284
        eopts := parseOpts(opts)
×
1285
        if ae, ok := eopts.err.(*ApiError); ok {
×
1286
                return ae
×
1287
        }
×
1288

1289
        return ApiErrors[JSConsumerFCRequiresPushErr]
×
1290
}
1291

1292
// NewJSConsumerFilterNotSubsetError creates a new JSConsumerFilterNotSubsetErr error: "consumer filter subject is not a valid subset of the interest subjects"
1293
func NewJSConsumerFilterNotSubsetError(opts ...ErrorOption) *ApiError {
×
1294
        eopts := parseOpts(opts)
×
1295
        if ae, ok := eopts.err.(*ApiError); ok {
×
1296
                return ae
×
1297
        }
×
1298

1299
        return ApiErrors[JSConsumerFilterNotSubsetErr]
×
1300
}
1301

1302
// NewJSConsumerHBRequiresPushError creates a new JSConsumerHBRequiresPushErr error: "consumer idle heartbeat requires a push based consumer"
1303
func NewJSConsumerHBRequiresPushError(opts ...ErrorOption) *ApiError {
×
1304
        eopts := parseOpts(opts)
×
1305
        if ae, ok := eopts.err.(*ApiError); ok {
×
1306
                return ae
×
1307
        }
×
1308

1309
        return ApiErrors[JSConsumerHBRequiresPushErr]
×
1310
}
1311

1312
// NewJSConsumerInactiveThresholdExcessError creates a new JSConsumerInactiveThresholdExcess error: "consumer inactive threshold exceeds system limit of {limit}"
1313
func NewJSConsumerInactiveThresholdExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
2✔
1314
        eopts := parseOpts(opts)
2✔
1315
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1316
                return ae
×
1317
        }
×
1318

1319
        e := ApiErrors[JSConsumerInactiveThresholdExcess]
2✔
1320
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
2✔
1321
        return &ApiError{
2✔
1322
                Code:        e.Code,
2✔
1323
                ErrCode:     e.ErrCode,
2✔
1324
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1325
        }
2✔
1326
}
1327

1328
// NewJSConsumerInvalidDeliverSubjectError creates a new JSConsumerInvalidDeliverSubject error: "invalid push consumer deliver subject"
1329
func NewJSConsumerInvalidDeliverSubjectError(opts ...ErrorOption) *ApiError {
2✔
1330
        eopts := parseOpts(opts)
2✔
1331
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1332
                return ae
×
1333
        }
×
1334

1335
        return ApiErrors[JSConsumerInvalidDeliverSubject]
2✔
1336
}
1337

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

1345
        return ApiErrors[JSConsumerInvalidGroupNameErr]
4✔
1346
}
1347

1348
// NewJSConsumerInvalidPolicyError creates a new JSConsumerInvalidPolicyErrF error: "{err}"
1349
func NewJSConsumerInvalidPolicyError(err error, opts ...ErrorOption) *ApiError {
10✔
1350
        eopts := parseOpts(opts)
10✔
1351
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1352
                return ae
×
1353
        }
×
1354

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

1364
// NewJSConsumerInvalidPriorityGroupError creates a new JSConsumerInvalidPriorityGroupErr error: "Provided priority group does not exist for this consumer"
1365
func NewJSConsumerInvalidPriorityGroupError(opts ...ErrorOption) *ApiError {
2✔
1366
        eopts := parseOpts(opts)
2✔
1367
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1368
                return ae
×
1369
        }
×
1370

1371
        return ApiErrors[JSConsumerInvalidPriorityGroupErr]
2✔
1372
}
1373

1374
// NewJSConsumerInvalidSamplingError creates a new JSConsumerInvalidSamplingErrF error: "failed to parse consumer sampling configuration: {err}"
1375
func NewJSConsumerInvalidSamplingError(err error, opts ...ErrorOption) *ApiError {
×
1376
        eopts := parseOpts(opts)
×
1377
        if ae, ok := eopts.err.(*ApiError); ok {
×
1378
                return ae
×
1379
        }
×
1380

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

1390
// NewJSConsumerMaxDeliverBackoffError creates a new JSConsumerMaxDeliverBackoffErr error: "max deliver is required to be > length of backoff values"
1391
func NewJSConsumerMaxDeliverBackoffError(opts ...ErrorOption) *ApiError {
3✔
1392
        eopts := parseOpts(opts)
3✔
1393
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1394
                return ae
×
1395
        }
×
1396

1397
        return ApiErrors[JSConsumerMaxDeliverBackoffErr]
3✔
1398
}
1399

1400
// NewJSConsumerMaxPendingAckExcessError creates a new JSConsumerMaxPendingAckExcessErrF error: "consumer max ack pending exceeds system limit of {limit}"
1401
func NewJSConsumerMaxPendingAckExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
12✔
1402
        eopts := parseOpts(opts)
12✔
1403
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
1404
                return ae
×
1405
        }
×
1406

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

1416
// NewJSConsumerMaxPendingAckPolicyRequiredError creates a new JSConsumerMaxPendingAckPolicyRequiredErr error: "consumer requires ack policy for max ack pending"
1417
func NewJSConsumerMaxPendingAckPolicyRequiredError(opts ...ErrorOption) *ApiError {
2✔
1418
        eopts := parseOpts(opts)
2✔
1419
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1420
                return ae
×
1421
        }
×
1422

1423
        return ApiErrors[JSConsumerMaxPendingAckPolicyRequiredErr]
2✔
1424
}
1425

1426
// NewJSConsumerMaxRequestBatchExceededError creates a new JSConsumerMaxRequestBatchExceededF error: "consumer max request batch exceeds server limit of {limit}"
1427
func NewJSConsumerMaxRequestBatchExceededError(limit interface{}, opts ...ErrorOption) *ApiError {
4✔
1428
        eopts := parseOpts(opts)
4✔
1429
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1430
                return ae
×
1431
        }
×
1432

1433
        e := ApiErrors[JSConsumerMaxRequestBatchExceededF]
4✔
1434
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
4✔
1435
        return &ApiError{
4✔
1436
                Code:        e.Code,
4✔
1437
                ErrCode:     e.ErrCode,
4✔
1438
                Description: strings.NewReplacer(args...).Replace(e.Description),
4✔
1439
        }
4✔
1440
}
1441

1442
// NewJSConsumerMaxRequestBatchNegativeError creates a new JSConsumerMaxRequestBatchNegativeErr error: "consumer max request batch needs to be > 0"
1443
func NewJSConsumerMaxRequestBatchNegativeError(opts ...ErrorOption) *ApiError {
×
1444
        eopts := parseOpts(opts)
×
1445
        if ae, ok := eopts.err.(*ApiError); ok {
×
1446
                return ae
×
1447
        }
×
1448

1449
        return ApiErrors[JSConsumerMaxRequestBatchNegativeErr]
×
1450
}
1451

1452
// NewJSConsumerMaxRequestExpiresTooSmallError creates a new JSConsumerMaxRequestExpiresTooSmall error: "consumer max request expires needs to be >= 1ms"
1453
func NewJSConsumerMaxRequestExpiresTooSmallError(opts ...ErrorOption) *ApiError {
×
1454
        eopts := parseOpts(opts)
×
1455
        if ae, ok := eopts.err.(*ApiError); ok {
×
1456
                return ae
×
1457
        }
×
1458

1459
        return ApiErrors[JSConsumerMaxRequestExpiresTooSmall]
×
1460
}
1461

1462
// NewJSConsumerMaxWaitingNegativeError creates a new JSConsumerMaxWaitingNegativeErr error: "consumer max waiting needs to be positive"
1463
func NewJSConsumerMaxWaitingNegativeError(opts ...ErrorOption) *ApiError {
×
1464
        eopts := parseOpts(opts)
×
1465
        if ae, ok := eopts.err.(*ApiError); ok {
×
1466
                return ae
×
1467
        }
×
1468

1469
        return ApiErrors[JSConsumerMaxWaitingNegativeErr]
×
1470
}
1471

1472
// NewJSConsumerMetadataLengthError creates a new JSConsumerMetadataLengthErrF error: "consumer metadata exceeds maximum size of {limit}"
1473
func NewJSConsumerMetadataLengthError(limit interface{}, opts ...ErrorOption) *ApiError {
1✔
1474
        eopts := parseOpts(opts)
1✔
1475
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1476
                return ae
×
1477
        }
×
1478

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

1488
// NewJSConsumerMultipleFiltersNotAllowedError creates a new JSConsumerMultipleFiltersNotAllowed error: "consumer with multiple subject filters cannot use subject based API"
1489
func NewJSConsumerMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
1490
        eopts := parseOpts(opts)
1✔
1491
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1492
                return ae
×
1493
        }
×
1494

1495
        return ApiErrors[JSConsumerMultipleFiltersNotAllowed]
1✔
1496
}
1497

1498
// NewJSConsumerNameContainsPathSeparatorsError creates a new JSConsumerNameContainsPathSeparatorsErr error: "Consumer name can not contain path separators"
1499
func NewJSConsumerNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
8✔
1500
        eopts := parseOpts(opts)
8✔
1501
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1502
                return ae
×
1503
        }
×
1504

1505
        return ApiErrors[JSConsumerNameContainsPathSeparatorsErr]
8✔
1506
}
1507

1508
// NewJSConsumerNameExistError creates a new JSConsumerNameExistErr error: "consumer name already in use"
1509
func NewJSConsumerNameExistError(opts ...ErrorOption) *ApiError {
2✔
1510
        eopts := parseOpts(opts)
2✔
1511
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1512
                return ae
×
1513
        }
×
1514

1515
        return ApiErrors[JSConsumerNameExistErr]
2✔
1516
}
1517

1518
// NewJSConsumerNameTooLongError creates a new JSConsumerNameTooLongErrF error: "consumer name is too long, maximum allowed is {max}"
1519
func NewJSConsumerNameTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
×
1520
        eopts := parseOpts(opts)
×
1521
        if ae, ok := eopts.err.(*ApiError); ok {
×
1522
                return ae
×
1523
        }
×
1524

1525
        e := ApiErrors[JSConsumerNameTooLongErrF]
×
1526
        args := e.toReplacerArgs([]interface{}{"{max}", max})
×
1527
        return &ApiError{
×
1528
                Code:        e.Code,
×
1529
                ErrCode:     e.ErrCode,
×
1530
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1531
        }
×
1532
}
1533

1534
// NewJSConsumerNotFoundError creates a new JSConsumerNotFoundErr error: "consumer not found"
1535
func NewJSConsumerNotFoundError(opts ...ErrorOption) *ApiError {
2,773✔
1536
        eopts := parseOpts(opts)
2,773✔
1537
        if ae, ok := eopts.err.(*ApiError); ok {
2,773✔
1538
                return ae
×
1539
        }
×
1540

1541
        return ApiErrors[JSConsumerNotFoundErr]
2,773✔
1542
}
1543

1544
// NewJSConsumerOfflineError creates a new JSConsumerOfflineErr error: "consumer is offline"
1545
func NewJSConsumerOfflineError(opts ...ErrorOption) *ApiError {
6✔
1546
        eopts := parseOpts(opts)
6✔
1547
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1548
                return ae
×
1549
        }
×
1550

1551
        return ApiErrors[JSConsumerOfflineErr]
6✔
1552
}
1553

1554
// NewJSConsumerOfflineReasonError creates a new JSConsumerOfflineReasonErrF error: "consumer is offline: {err}"
1555
func NewJSConsumerOfflineReasonError(err error, opts ...ErrorOption) *ApiError {
24✔
1556
        eopts := parseOpts(opts)
24✔
1557
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
1558
                return ae
×
1559
        }
×
1560

1561
        e := ApiErrors[JSConsumerOfflineReasonErrF]
24✔
1562
        args := e.toReplacerArgs([]interface{}{"{err}", err})
24✔
1563
        return &ApiError{
24✔
1564
                Code:        e.Code,
24✔
1565
                ErrCode:     e.ErrCode,
24✔
1566
                Description: strings.NewReplacer(args...).Replace(e.Description),
24✔
1567
        }
24✔
1568
}
1569

1570
// NewJSConsumerOnMappedError creates a new JSConsumerOnMappedErr error: "consumer direct on a mapped consumer"
1571
func NewJSConsumerOnMappedError(opts ...ErrorOption) *ApiError {
×
1572
        eopts := parseOpts(opts)
×
1573
        if ae, ok := eopts.err.(*ApiError); ok {
×
1574
                return ae
×
1575
        }
×
1576

1577
        return ApiErrors[JSConsumerOnMappedErr]
×
1578
}
1579

1580
// NewJSConsumerOverlappingSubjectFiltersError creates a new JSConsumerOverlappingSubjectFilters error: "consumer subject filters cannot overlap"
1581
func NewJSConsumerOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
1✔
1582
        eopts := parseOpts(opts)
1✔
1583
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1584
                return ae
×
1585
        }
×
1586

1587
        return ApiErrors[JSConsumerOverlappingSubjectFilters]
1✔
1588
}
1589

1590
// NewJSConsumerPinnedTTLWithoutPriorityPolicyNoneError creates a new JSConsumerPinnedTTLWithoutPriorityPolicyNone error: "PinnedTTL cannot be set when PriorityPolicy is none"
1591
func NewJSConsumerPinnedTTLWithoutPriorityPolicyNoneError(opts ...ErrorOption) *ApiError {
1✔
1592
        eopts := parseOpts(opts)
1✔
1593
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1594
                return ae
×
1595
        }
×
1596

1597
        return ApiErrors[JSConsumerPinnedTTLWithoutPriorityPolicyNone]
1✔
1598
}
1599

1600
// NewJSConsumerPriorityGroupWithPolicyNoneError creates a new JSConsumerPriorityGroupWithPolicyNone error: "consumer can not have priority groups when policy is none"
1601
func NewJSConsumerPriorityGroupWithPolicyNoneError(opts ...ErrorOption) *ApiError {
1✔
1602
        eopts := parseOpts(opts)
1✔
1603
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1604
                return ae
×
1605
        }
×
1606

1607
        return ApiErrors[JSConsumerPriorityGroupWithPolicyNone]
1✔
1608
}
1609

1610
// NewJSConsumerPriorityPolicyWithoutGroupError creates a new JSConsumerPriorityPolicyWithoutGroup error: "Setting PriorityPolicy requires at least one PriorityGroup to be set"
1611
func NewJSConsumerPriorityPolicyWithoutGroupError(opts ...ErrorOption) *ApiError {
4✔
1612
        eopts := parseOpts(opts)
4✔
1613
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1614
                return ae
×
1615
        }
×
1616

1617
        return ApiErrors[JSConsumerPriorityPolicyWithoutGroup]
4✔
1618
}
1619

1620
// NewJSConsumerPullNotDurableError creates a new JSConsumerPullNotDurableErr error: "consumer in pull mode requires a durable name"
1621
func NewJSConsumerPullNotDurableError(opts ...ErrorOption) *ApiError {
×
1622
        eopts := parseOpts(opts)
×
1623
        if ae, ok := eopts.err.(*ApiError); ok {
×
1624
                return ae
×
1625
        }
×
1626

1627
        return ApiErrors[JSConsumerPullNotDurableErr]
×
1628
}
1629

1630
// NewJSConsumerPullRequiresAckError creates a new JSConsumerPullRequiresAckErr error: "consumer in pull mode requires explicit ack policy on workqueue stream"
1631
func NewJSConsumerPullRequiresAckError(opts ...ErrorOption) *ApiError {
6✔
1632
        eopts := parseOpts(opts)
6✔
1633
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1634
                return ae
×
1635
        }
×
1636

1637
        return ApiErrors[JSConsumerPullRequiresAckErr]
6✔
1638
}
1639

1640
// NewJSConsumerPullWithRateLimitError creates a new JSConsumerPullWithRateLimitErr error: "consumer in pull mode can not have rate limit set"
1641
func NewJSConsumerPullWithRateLimitError(opts ...ErrorOption) *ApiError {
1✔
1642
        eopts := parseOpts(opts)
1✔
1643
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1644
                return ae
×
1645
        }
×
1646

1647
        return ApiErrors[JSConsumerPullWithRateLimitErr]
1✔
1648
}
1649

1650
// NewJSConsumerPushMaxWaitingError creates a new JSConsumerPushMaxWaitingErr error: "consumer in push mode can not set max waiting"
1651
func NewJSConsumerPushMaxWaitingError(opts ...ErrorOption) *ApiError {
3✔
1652
        eopts := parseOpts(opts)
3✔
1653
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1654
                return ae
×
1655
        }
×
1656

1657
        return ApiErrors[JSConsumerPushMaxWaitingErr]
3✔
1658
}
1659

1660
// NewJSConsumerPushWithPriorityGroupError creates a new JSConsumerPushWithPriorityGroupErr error: "priority groups can not be used with push consumers"
1661
func NewJSConsumerPushWithPriorityGroupError(opts ...ErrorOption) *ApiError {
1✔
1662
        eopts := parseOpts(opts)
1✔
1663
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1664
                return ae
×
1665
        }
×
1666

1667
        return ApiErrors[JSConsumerPushWithPriorityGroupErr]
1✔
1668
}
1669

1670
// NewJSConsumerReplacementWithDifferentNameError creates a new JSConsumerReplacementWithDifferentNameErr error: "consumer replacement durable config not the same"
1671
func NewJSConsumerReplacementWithDifferentNameError(opts ...ErrorOption) *ApiError {
×
1672
        eopts := parseOpts(opts)
×
1673
        if ae, ok := eopts.err.(*ApiError); ok {
×
1674
                return ae
×
1675
        }
×
1676

1677
        return ApiErrors[JSConsumerReplacementWithDifferentNameErr]
×
1678
}
1679

1680
// NewJSConsumerReplayPolicyInvalidError creates a new JSConsumerReplayPolicyInvalidErr error: "consumer replay policy invalid"
1681
func NewJSConsumerReplayPolicyInvalidError(opts ...ErrorOption) *ApiError {
2✔
1682
        eopts := parseOpts(opts)
2✔
1683
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1684
                return ae
×
1685
        }
×
1686

1687
        return ApiErrors[JSConsumerReplayPolicyInvalidErr]
2✔
1688
}
1689

1690
// NewJSConsumerReplicasExceedsStreamError creates a new JSConsumerReplicasExceedsStream error: "consumer config replica count exceeds parent stream"
1691
func NewJSConsumerReplicasExceedsStreamError(opts ...ErrorOption) *ApiError {
1✔
1692
        eopts := parseOpts(opts)
1✔
1693
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1694
                return ae
×
1695
        }
×
1696

1697
        return ApiErrors[JSConsumerReplicasExceedsStream]
1✔
1698
}
1699

1700
// NewJSConsumerReplicasShouldMatchStreamError creates a new JSConsumerReplicasShouldMatchStream error: "consumer config replicas must match interest retention stream's replicas"
1701
func NewJSConsumerReplicasShouldMatchStreamError(opts ...ErrorOption) *ApiError {
2✔
1702
        eopts := parseOpts(opts)
2✔
1703
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1704
                return ae
×
1705
        }
×
1706

1707
        return ApiErrors[JSConsumerReplicasShouldMatchStream]
2✔
1708
}
1709

1710
// NewJSConsumerSmallHeartbeatError creates a new JSConsumerSmallHeartbeatErr error: "consumer idle heartbeat needs to be >= 100ms"
1711
func NewJSConsumerSmallHeartbeatError(opts ...ErrorOption) *ApiError {
1✔
1712
        eopts := parseOpts(opts)
1✔
1713
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1714
                return ae
×
1715
        }
×
1716

1717
        return ApiErrors[JSConsumerSmallHeartbeatErr]
1✔
1718
}
1719

1720
// NewJSConsumerStoreFailedError creates a new JSConsumerStoreFailedErrF error: "error creating store for consumer: {err}"
1721
func NewJSConsumerStoreFailedError(err error, opts ...ErrorOption) *ApiError {
8✔
1722
        eopts := parseOpts(opts)
8✔
1723
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1724
                return ae
×
1725
        }
×
1726

1727
        e := ApiErrors[JSConsumerStoreFailedErrF]
8✔
1728
        args := e.toReplacerArgs([]interface{}{"{err}", err})
8✔
1729
        return &ApiError{
8✔
1730
                Code:        e.Code,
8✔
1731
                ErrCode:     e.ErrCode,
8✔
1732
                Description: strings.NewReplacer(args...).Replace(e.Description),
8✔
1733
        }
8✔
1734
}
1735

1736
// NewJSConsumerWQConsumerNotDeliverAllError creates a new JSConsumerWQConsumerNotDeliverAllErr error: "consumer must be deliver all on workqueue stream"
1737
func NewJSConsumerWQConsumerNotDeliverAllError(opts ...ErrorOption) *ApiError {
×
1738
        eopts := parseOpts(opts)
×
1739
        if ae, ok := eopts.err.(*ApiError); ok {
×
1740
                return ae
×
1741
        }
×
1742

1743
        return ApiErrors[JSConsumerWQConsumerNotDeliverAllErr]
×
1744
}
1745

1746
// NewJSConsumerWQConsumerNotUniqueError creates a new JSConsumerWQConsumerNotUniqueErr error: "filtered consumer not unique on workqueue stream"
1747
func NewJSConsumerWQConsumerNotUniqueError(opts ...ErrorOption) *ApiError {
11✔
1748
        eopts := parseOpts(opts)
11✔
1749
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
1750
                return ae
×
1751
        }
×
1752

1753
        return ApiErrors[JSConsumerWQConsumerNotUniqueErr]
11✔
1754
}
1755

1756
// NewJSConsumerWQMultipleUnfilteredError creates a new JSConsumerWQMultipleUnfilteredErr error: "multiple non-filtered consumers not allowed on workqueue stream"
1757
func NewJSConsumerWQMultipleUnfilteredError(opts ...ErrorOption) *ApiError {
2✔
1758
        eopts := parseOpts(opts)
2✔
1759
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1760
                return ae
×
1761
        }
×
1762

1763
        return ApiErrors[JSConsumerWQMultipleUnfilteredErr]
2✔
1764
}
1765

1766
// NewJSConsumerWQRequiresExplicitAckError creates a new JSConsumerWQRequiresExplicitAckErr error: "workqueue stream requires explicit ack"
1767
func NewJSConsumerWQRequiresExplicitAckError(opts ...ErrorOption) *ApiError {
×
1768
        eopts := parseOpts(opts)
×
1769
        if ae, ok := eopts.err.(*ApiError); ok {
×
1770
                return ae
×
1771
        }
×
1772

1773
        return ApiErrors[JSConsumerWQRequiresExplicitAckErr]
×
1774
}
1775

1776
// NewJSConsumerWithFlowControlNeedsHeartbeatsError creates a new JSConsumerWithFlowControlNeedsHeartbeats error: "consumer with flow control also needs heartbeats"
1777
func NewJSConsumerWithFlowControlNeedsHeartbeatsError(opts ...ErrorOption) *ApiError {
4✔
1778
        eopts := parseOpts(opts)
4✔
1779
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1780
                return ae
×
1781
        }
×
1782

1783
        return ApiErrors[JSConsumerWithFlowControlNeedsHeartbeats]
4✔
1784
}
1785

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

1793
        return ApiErrors[JSInsufficientResourcesErr]
11✔
1794
}
1795

1796
// NewJSInvalidJSONError creates a new JSInvalidJSONErr error: "invalid JSON: {err}"
1797
func NewJSInvalidJSONError(err error, opts ...ErrorOption) *ApiError {
10✔
1798
        eopts := parseOpts(opts)
10✔
1799
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1800
                return ae
×
1801
        }
×
1802

1803
        e := ApiErrors[JSInvalidJSONErr]
10✔
1804
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1805
        return &ApiError{
10✔
1806
                Code:        e.Code,
10✔
1807
                ErrCode:     e.ErrCode,
10✔
1808
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1809
        }
10✔
1810
}
1811

1812
// NewJSMaximumConsumersLimitError creates a new JSMaximumConsumersLimitErr error: "maximum consumers limit reached"
1813
func NewJSMaximumConsumersLimitError(opts ...ErrorOption) *ApiError {
29✔
1814
        eopts := parseOpts(opts)
29✔
1815
        if ae, ok := eopts.err.(*ApiError); ok {
29✔
1816
                return ae
×
1817
        }
×
1818

1819
        return ApiErrors[JSMaximumConsumersLimitErr]
29✔
1820
}
1821

1822
// NewJSMaximumStreamsLimitError creates a new JSMaximumStreamsLimitErr error: "maximum number of streams reached"
1823
func NewJSMaximumStreamsLimitError(opts ...ErrorOption) *ApiError {
16✔
1824
        eopts := parseOpts(opts)
16✔
1825
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
1826
                return ae
×
1827
        }
×
1828

1829
        return ApiErrors[JSMaximumStreamsLimitErr]
16✔
1830
}
1831

1832
// NewJSMemoryResourcesExceededError creates a new JSMemoryResourcesExceededErr error: "insufficient memory resources available"
1833
func NewJSMemoryResourcesExceededError(opts ...ErrorOption) *ApiError {
4✔
1834
        eopts := parseOpts(opts)
4✔
1835
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1836
                return ae
×
1837
        }
×
1838

1839
        return ApiErrors[JSMemoryResourcesExceededErr]
4✔
1840
}
1841

1842
// NewJSMessageCounterBrokenError creates a new JSMessageCounterBrokenErr error: "message counter is broken"
1843
func NewJSMessageCounterBrokenError(opts ...ErrorOption) *ApiError {
4✔
1844
        eopts := parseOpts(opts)
4✔
1845
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1846
                return ae
×
1847
        }
×
1848

1849
        return ApiErrors[JSMessageCounterBrokenErr]
4✔
1850
}
1851

1852
// NewJSMessageIncrDisabledError creates a new JSMessageIncrDisabledErr error: "message counters is disabled"
1853
func NewJSMessageIncrDisabledError(opts ...ErrorOption) *ApiError {
4✔
1854
        eopts := parseOpts(opts)
4✔
1855
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1856
                return ae
×
1857
        }
×
1858

1859
        return ApiErrors[JSMessageIncrDisabledErr]
4✔
1860
}
1861

1862
// NewJSMessageIncrInvalidError creates a new JSMessageIncrInvalidErr error: "message counter increment is invalid"
1863
func NewJSMessageIncrInvalidError(opts ...ErrorOption) *ApiError {
24✔
1864
        eopts := parseOpts(opts)
24✔
1865
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
1866
                return ae
×
1867
        }
×
1868

1869
        return ApiErrors[JSMessageIncrInvalidErr]
24✔
1870
}
1871

1872
// NewJSMessageIncrMissingError creates a new JSMessageIncrMissingErr error: "message counter increment is missing"
1873
func NewJSMessageIncrMissingError(opts ...ErrorOption) *ApiError {
8✔
1874
        eopts := parseOpts(opts)
8✔
1875
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1876
                return ae
×
1877
        }
×
1878

1879
        return ApiErrors[JSMessageIncrMissingErr]
8✔
1880
}
1881

1882
// NewJSMessageIncrPayloadError creates a new JSMessageIncrPayloadErr error: "message counter has payload"
1883
func NewJSMessageIncrPayloadError(opts ...ErrorOption) *ApiError {
4✔
1884
        eopts := parseOpts(opts)
4✔
1885
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1886
                return ae
×
1887
        }
×
1888

1889
        return ApiErrors[JSMessageIncrPayloadErr]
4✔
1890
}
1891

1892
// NewJSMessageSchedulesDisabledError creates a new JSMessageSchedulesDisabledErr error: "message schedules is disabled"
1893
func NewJSMessageSchedulesDisabledError(opts ...ErrorOption) *ApiError {
20✔
1894
        eopts := parseOpts(opts)
20✔
1895
        if ae, ok := eopts.err.(*ApiError); ok {
20✔
1896
                return ae
×
1897
        }
×
1898

1899
        return ApiErrors[JSMessageSchedulesDisabledErr]
20✔
1900
}
1901

1902
// NewJSMessageSchedulesPatternInvalidError creates a new JSMessageSchedulesPatternInvalidErr error: "message schedules pattern is invalid"
1903
func NewJSMessageSchedulesPatternInvalidError(opts ...ErrorOption) *ApiError {
15✔
1904
        eopts := parseOpts(opts)
15✔
1905
        if ae, ok := eopts.err.(*ApiError); ok {
15✔
1906
                return ae
×
1907
        }
×
1908

1909
        return ApiErrors[JSMessageSchedulesPatternInvalidErr]
15✔
1910
}
1911

1912
// NewJSMessageSchedulesRollupInvalidError creates a new JSMessageSchedulesRollupInvalidErr error: "message schedules invalid rollup"
1913
func NewJSMessageSchedulesRollupInvalidError(opts ...ErrorOption) *ApiError {
8✔
1914
        eopts := parseOpts(opts)
8✔
1915
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1916
                return ae
×
1917
        }
×
1918

1919
        return ApiErrors[JSMessageSchedulesRollupInvalidErr]
8✔
1920
}
1921

1922
// NewJSMessageSchedulesTTLInvalidError creates a new JSMessageSchedulesTTLInvalidErr error: "message schedules invalid per-message TTL"
1923
func NewJSMessageSchedulesTTLInvalidError(opts ...ErrorOption) *ApiError {
10✔
1924
        eopts := parseOpts(opts)
10✔
1925
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1926
                return ae
×
1927
        }
×
1928

1929
        return ApiErrors[JSMessageSchedulesTTLInvalidErr]
10✔
1930
}
1931

1932
// NewJSMessageSchedulesTargetInvalidError creates a new JSMessageSchedulesTargetInvalidErr error: "message schedules target is invalid"
1933
func NewJSMessageSchedulesTargetInvalidError(opts ...ErrorOption) *ApiError {
30✔
1934
        eopts := parseOpts(opts)
30✔
1935
        if ae, ok := eopts.err.(*ApiError); ok {
30✔
1936
                return ae
×
1937
        }
×
1938

1939
        return ApiErrors[JSMessageSchedulesTargetInvalidErr]
30✔
1940
}
1941

1942
// NewJSMessageTTLDisabledError creates a new JSMessageTTLDisabledErr error: "per-message TTL is disabled"
1943
func NewJSMessageTTLDisabledError(opts ...ErrorOption) *ApiError {
16✔
1944
        eopts := parseOpts(opts)
16✔
1945
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
1946
                return ae
×
1947
        }
×
1948

1949
        return ApiErrors[JSMessageTTLDisabledErr]
16✔
1950
}
1951

1952
// NewJSMessageTTLInvalidError creates a new JSMessageTTLInvalidErr error: "invalid per-message TTL"
1953
func NewJSMessageTTLInvalidError(opts ...ErrorOption) *ApiError {
23✔
1954
        eopts := parseOpts(opts)
23✔
1955
        if ae, ok := eopts.err.(*ApiError); ok {
23✔
1956
                return ae
×
1957
        }
×
1958

1959
        return ApiErrors[JSMessageTTLInvalidErr]
23✔
1960
}
1961

1962
// NewJSMirrorConsumerSetupFailedError creates a new JSMirrorConsumerSetupFailedErrF error: "{err}"
1963
func NewJSMirrorConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
1964
        eopts := parseOpts(opts)
×
1965
        if ae, ok := eopts.err.(*ApiError); ok {
×
1966
                return ae
×
1967
        }
×
1968

1969
        e := ApiErrors[JSMirrorConsumerSetupFailedErrF]
×
1970
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1971
        return &ApiError{
×
1972
                Code:        e.Code,
×
1973
                ErrCode:     e.ErrCode,
×
1974
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1975
        }
×
1976
}
1977

1978
// NewJSMirrorInvalidStreamNameError creates a new JSMirrorInvalidStreamName error: "mirrored stream name is invalid"
1979
func NewJSMirrorInvalidStreamNameError(opts ...ErrorOption) *ApiError {
×
1980
        eopts := parseOpts(opts)
×
1981
        if ae, ok := eopts.err.(*ApiError); ok {
×
1982
                return ae
×
1983
        }
×
1984

1985
        return ApiErrors[JSMirrorInvalidStreamName]
×
1986
}
1987

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

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

2004
// NewJSMirrorInvalidTransformDestinationError creates a new JSMirrorInvalidTransformDestination error: "mirror transform: {err}"
2005
func NewJSMirrorInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
2✔
2006
        eopts := parseOpts(opts)
2✔
2007
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2008
                return ae
×
2009
        }
×
2010

2011
        e := ApiErrors[JSMirrorInvalidTransformDestination]
2✔
2012
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2✔
2013
        return &ApiError{
2✔
2014
                Code:        e.Code,
2✔
2015
                ErrCode:     e.ErrCode,
2✔
2016
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2017
        }
2✔
2018
}
2019

2020
// NewJSMirrorMaxMessageSizeTooBigError creates a new JSMirrorMaxMessageSizeTooBigErr error: "stream mirror must have max message size >= source"
2021
func NewJSMirrorMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
2022
        eopts := parseOpts(opts)
×
2023
        if ae, ok := eopts.err.(*ApiError); ok {
×
2024
                return ae
×
2025
        }
×
2026

2027
        return ApiErrors[JSMirrorMaxMessageSizeTooBigErr]
×
2028
}
2029

2030
// NewJSMirrorMultipleFiltersNotAllowedError creates a new JSMirrorMultipleFiltersNotAllowed error: "mirror with multiple subject transforms cannot also have a single subject filter"
2031
func NewJSMirrorMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
2032
        eopts := parseOpts(opts)
1✔
2033
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2034
                return ae
×
2035
        }
×
2036

2037
        return ApiErrors[JSMirrorMultipleFiltersNotAllowed]
1✔
2038
}
2039

2040
// NewJSMirrorOverlappingSubjectFiltersError creates a new JSMirrorOverlappingSubjectFilters error: "mirror subject filters can not overlap"
2041
func NewJSMirrorOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
2✔
2042
        eopts := parseOpts(opts)
2✔
2043
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2044
                return ae
×
2045
        }
×
2046

2047
        return ApiErrors[JSMirrorOverlappingSubjectFilters]
2✔
2048
}
2049

2050
// NewJSMirrorWithAtomicPublishError creates a new JSMirrorWithAtomicPublishErr error: "stream mirrors can not also use atomic publishing"
2051
func NewJSMirrorWithAtomicPublishError(opts ...ErrorOption) *ApiError {
4✔
2052
        eopts := parseOpts(opts)
4✔
2053
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2054
                return ae
×
2055
        }
×
2056

2057
        return ApiErrors[JSMirrorWithAtomicPublishErr]
4✔
2058
}
2059

2060
// NewJSMirrorWithCountersError creates a new JSMirrorWithCountersErr error: "stream mirrors can not also calculate counters"
2061
func NewJSMirrorWithCountersError(opts ...ErrorOption) *ApiError {
4✔
2062
        eopts := parseOpts(opts)
4✔
2063
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2064
                return ae
×
2065
        }
×
2066

2067
        return ApiErrors[JSMirrorWithCountersErr]
4✔
2068
}
2069

2070
// NewJSMirrorWithFirstSeqError creates a new JSMirrorWithFirstSeqErr error: "stream mirrors can not have first sequence configured"
2071
func NewJSMirrorWithFirstSeqError(opts ...ErrorOption) *ApiError {
2✔
2072
        eopts := parseOpts(opts)
2✔
2073
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2074
                return ae
×
2075
        }
×
2076

2077
        return ApiErrors[JSMirrorWithFirstSeqErr]
2✔
2078
}
2079

2080
// NewJSMirrorWithMsgSchedulesError creates a new JSMirrorWithMsgSchedulesErr error: "stream mirrors can not also schedule messages"
2081
func NewJSMirrorWithMsgSchedulesError(opts ...ErrorOption) *ApiError {
2✔
2082
        eopts := parseOpts(opts)
2✔
2083
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2084
                return ae
×
2085
        }
×
2086

2087
        return ApiErrors[JSMirrorWithMsgSchedulesErr]
2✔
2088
}
2089

2090
// NewJSMirrorWithSourcesError creates a new JSMirrorWithSourcesErr error: "stream mirrors can not also contain other sources"
2091
func NewJSMirrorWithSourcesError(opts ...ErrorOption) *ApiError {
×
2092
        eopts := parseOpts(opts)
×
2093
        if ae, ok := eopts.err.(*ApiError); ok {
×
2094
                return ae
×
2095
        }
×
2096

2097
        return ApiErrors[JSMirrorWithSourcesErr]
×
2098
}
2099

2100
// NewJSMirrorWithStartSeqAndTimeError creates a new JSMirrorWithStartSeqAndTimeErr error: "stream mirrors can not have both start seq and start time configured"
2101
func NewJSMirrorWithStartSeqAndTimeError(opts ...ErrorOption) *ApiError {
×
2102
        eopts := parseOpts(opts)
×
2103
        if ae, ok := eopts.err.(*ApiError); ok {
×
2104
                return ae
×
2105
        }
×
2106

2107
        return ApiErrors[JSMirrorWithStartSeqAndTimeErr]
×
2108
}
2109

2110
// NewJSMirrorWithSubjectFiltersError creates a new JSMirrorWithSubjectFiltersErr error: "stream mirrors can not contain filtered subjects"
2111
func NewJSMirrorWithSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
2112
        eopts := parseOpts(opts)
×
2113
        if ae, ok := eopts.err.(*ApiError); ok {
×
2114
                return ae
×
2115
        }
×
2116

2117
        return ApiErrors[JSMirrorWithSubjectFiltersErr]
×
2118
}
2119

2120
// NewJSMirrorWithSubjectsError creates a new JSMirrorWithSubjectsErr error: "stream mirrors can not contain subjects"
2121
func NewJSMirrorWithSubjectsError(opts ...ErrorOption) *ApiError {
2✔
2122
        eopts := parseOpts(opts)
2✔
2123
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2124
                return ae
×
2125
        }
×
2126

2127
        return ApiErrors[JSMirrorWithSubjectsErr]
2✔
2128
}
2129

2130
// NewJSNoAccountError creates a new JSNoAccountErr error: "account not found"
2131
func NewJSNoAccountError(opts ...ErrorOption) *ApiError {
1✔
2132
        eopts := parseOpts(opts)
1✔
2133
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2134
                return ae
×
2135
        }
×
2136

2137
        return ApiErrors[JSNoAccountErr]
1✔
2138
}
2139

2140
// NewJSNoLimitsError creates a new JSNoLimitsErr error: "no JetStream default or applicable tiered limit present"
2141
func NewJSNoLimitsError(opts ...ErrorOption) *ApiError {
4✔
2142
        eopts := parseOpts(opts)
4✔
2143
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2144
                return ae
×
2145
        }
×
2146

2147
        return ApiErrors[JSNoLimitsErr]
4✔
2148
}
2149

2150
// NewJSNoMessageFoundError creates a new JSNoMessageFoundErr error: "no message found"
2151
func NewJSNoMessageFoundError(opts ...ErrorOption) *ApiError {
465✔
2152
        eopts := parseOpts(opts)
465✔
2153
        if ae, ok := eopts.err.(*ApiError); ok {
465✔
2154
                return ae
×
2155
        }
×
2156

2157
        return ApiErrors[JSNoMessageFoundErr]
465✔
2158
}
2159

2160
// NewJSNotEmptyRequestError creates a new JSNotEmptyRequestErr error: "expected an empty request payload"
2161
func NewJSNotEmptyRequestError(opts ...ErrorOption) *ApiError {
3✔
2162
        eopts := parseOpts(opts)
3✔
2163
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2164
                return ae
×
2165
        }
×
2166

2167
        return ApiErrors[JSNotEmptyRequestErr]
3✔
2168
}
2169

2170
// NewJSNotEnabledError creates a new JSNotEnabledErr error: "JetStream not enabled"
2171
func NewJSNotEnabledError(opts ...ErrorOption) *ApiError {
10✔
2172
        eopts := parseOpts(opts)
10✔
2173
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2174
                return ae
×
2175
        }
×
2176

2177
        return ApiErrors[JSNotEnabledErr]
10✔
2178
}
2179

2180
// NewJSNotEnabledForAccountError creates a new JSNotEnabledForAccountErr error: "JetStream not enabled for account"
2181
func NewJSNotEnabledForAccountError(opts ...ErrorOption) *ApiError {
312✔
2182
        eopts := parseOpts(opts)
312✔
2183
        if ae, ok := eopts.err.(*ApiError); ok {
312✔
2184
                return ae
×
2185
        }
×
2186

2187
        return ApiErrors[JSNotEnabledForAccountErr]
312✔
2188
}
2189

2190
// NewJSPedanticError creates a new JSPedanticErrF error: "pedantic mode: {err}"
2191
func NewJSPedanticError(err error, opts ...ErrorOption) *ApiError {
36✔
2192
        eopts := parseOpts(opts)
36✔
2193
        if ae, ok := eopts.err.(*ApiError); ok {
36✔
2194
                return ae
×
2195
        }
×
2196

2197
        e := ApiErrors[JSPedanticErrF]
36✔
2198
        args := e.toReplacerArgs([]interface{}{"{err}", err})
36✔
2199
        return &ApiError{
36✔
2200
                Code:        e.Code,
36✔
2201
                ErrCode:     e.ErrCode,
36✔
2202
                Description: strings.NewReplacer(args...).Replace(e.Description),
36✔
2203
        }
36✔
2204
}
2205

2206
// NewJSPeerRemapError creates a new JSPeerRemapErr error: "peer remap failed"
2207
func NewJSPeerRemapError(opts ...ErrorOption) *ApiError {
5✔
2208
        eopts := parseOpts(opts)
5✔
2209
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2210
                return ae
1✔
2211
        }
1✔
2212

2213
        return ApiErrors[JSPeerRemapErr]
4✔
2214
}
2215

2216
// NewJSRaftGeneralError creates a new JSRaftGeneralErrF error: "{err}"
2217
func NewJSRaftGeneralError(err error, opts ...ErrorOption) *ApiError {
×
2218
        eopts := parseOpts(opts)
×
2219
        if ae, ok := eopts.err.(*ApiError); ok {
×
2220
                return ae
×
2221
        }
×
2222

2223
        e := ApiErrors[JSRaftGeneralErrF]
×
2224
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2225
        return &ApiError{
×
2226
                Code:        e.Code,
×
2227
                ErrCode:     e.ErrCode,
×
2228
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2229
        }
×
2230
}
2231

2232
// NewJSReplicasCountCannotBeNegativeError creates a new JSReplicasCountCannotBeNegative error: "replicas count cannot be negative"
2233
func NewJSReplicasCountCannotBeNegativeError(opts ...ErrorOption) *ApiError {
16✔
2234
        eopts := parseOpts(opts)
16✔
2235
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2236
                return ae
×
2237
        }
×
2238

2239
        return ApiErrors[JSReplicasCountCannotBeNegative]
16✔
2240
}
2241

2242
// NewJSRequiredApiLevelError creates a new JSRequiredApiLevelErr error: "JetStream minimum api level required"
2243
func NewJSRequiredApiLevelError(opts ...ErrorOption) *ApiError {
56✔
2244
        eopts := parseOpts(opts)
56✔
2245
        if ae, ok := eopts.err.(*ApiError); ok {
56✔
2246
                return ae
×
2247
        }
×
2248

2249
        return ApiErrors[JSRequiredApiLevelErr]
56✔
2250
}
2251

2252
// NewJSRestoreSubscribeFailedError creates a new JSRestoreSubscribeFailedErrF error: "JetStream unable to subscribe to restore snapshot {subject}: {err}"
2253
func NewJSRestoreSubscribeFailedError(err error, subject interface{}, opts ...ErrorOption) *ApiError {
1✔
2254
        eopts := parseOpts(opts)
1✔
2255
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2256
                return ae
×
2257
        }
×
2258

2259
        e := ApiErrors[JSRestoreSubscribeFailedErrF]
1✔
2260
        args := e.toReplacerArgs([]interface{}{"{err}", err, "{subject}", subject})
1✔
2261
        return &ApiError{
1✔
2262
                Code:        e.Code,
1✔
2263
                ErrCode:     e.ErrCode,
1✔
2264
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2265
        }
1✔
2266
}
2267

2268
// NewJSSequenceNotFoundError creates a new JSSequenceNotFoundErrF error: "sequence {seq} not found"
2269
func NewJSSequenceNotFoundError(seq uint64, opts ...ErrorOption) *ApiError {
×
2270
        eopts := parseOpts(opts)
×
2271
        if ae, ok := eopts.err.(*ApiError); ok {
×
2272
                return ae
×
2273
        }
×
2274

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

2284
// NewJSSnapshotDeliverSubjectInvalidError creates a new JSSnapshotDeliverSubjectInvalidErr error: "deliver subject not valid"
2285
func NewJSSnapshotDeliverSubjectInvalidError(opts ...ErrorOption) *ApiError {
1✔
2286
        eopts := parseOpts(opts)
1✔
2287
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2288
                return ae
×
2289
        }
×
2290

2291
        return ApiErrors[JSSnapshotDeliverSubjectInvalidErr]
1✔
2292
}
2293

2294
// NewJSSourceConsumerSetupFailedError creates a new JSSourceConsumerSetupFailedErrF error: "{err}"
2295
func NewJSSourceConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
2296
        eopts := parseOpts(opts)
×
2297
        if ae, ok := eopts.err.(*ApiError); ok {
×
2298
                return ae
×
2299
        }
×
2300

2301
        e := ApiErrors[JSSourceConsumerSetupFailedErrF]
×
2302
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2303
        return &ApiError{
×
2304
                Code:        e.Code,
×
2305
                ErrCode:     e.ErrCode,
×
2306
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2307
        }
×
2308
}
2309

2310
// NewJSSourceDuplicateDetectedError creates a new JSSourceDuplicateDetected error: "duplicate source configuration detected"
2311
func NewJSSourceDuplicateDetectedError(opts ...ErrorOption) *ApiError {
×
2312
        eopts := parseOpts(opts)
×
2313
        if ae, ok := eopts.err.(*ApiError); ok {
×
2314
                return ae
×
2315
        }
×
2316

2317
        return ApiErrors[JSSourceDuplicateDetected]
×
2318
}
2319

2320
// NewJSSourceInvalidStreamNameError creates a new JSSourceInvalidStreamName error: "sourced stream name is invalid"
2321
func NewJSSourceInvalidStreamNameError(opts ...ErrorOption) *ApiError {
1✔
2322
        eopts := parseOpts(opts)
1✔
2323
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2324
                return ae
×
2325
        }
×
2326

2327
        return ApiErrors[JSSourceInvalidStreamName]
1✔
2328
}
2329

2330
// NewJSSourceInvalidSubjectFilterError creates a new JSSourceInvalidSubjectFilter error: "source transform source: {err}"
2331
func NewJSSourceInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
1✔
2332
        eopts := parseOpts(opts)
1✔
2333
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2334
                return ae
×
2335
        }
×
2336

2337
        e := ApiErrors[JSSourceInvalidSubjectFilter]
1✔
2338
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2339
        return &ApiError{
1✔
2340
                Code:        e.Code,
1✔
2341
                ErrCode:     e.ErrCode,
1✔
2342
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2343
        }
1✔
2344
}
2345

2346
// NewJSSourceInvalidTransformDestinationError creates a new JSSourceInvalidTransformDestination error: "source transform: {err}"
2347
func NewJSSourceInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
2348
        eopts := parseOpts(opts)
1✔
2349
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2350
                return ae
×
2351
        }
×
2352

2353
        e := ApiErrors[JSSourceInvalidTransformDestination]
1✔
2354
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2355
        return &ApiError{
1✔
2356
                Code:        e.Code,
1✔
2357
                ErrCode:     e.ErrCode,
1✔
2358
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2359
        }
1✔
2360
}
2361

2362
// NewJSSourceMaxMessageSizeTooBigError creates a new JSSourceMaxMessageSizeTooBigErr error: "stream source must have max message size >= target"
2363
func NewJSSourceMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
2364
        eopts := parseOpts(opts)
×
2365
        if ae, ok := eopts.err.(*ApiError); ok {
×
2366
                return ae
×
2367
        }
×
2368

2369
        return ApiErrors[JSSourceMaxMessageSizeTooBigErr]
×
2370
}
2371

2372
// NewJSSourceMultipleFiltersNotAllowedError creates a new JSSourceMultipleFiltersNotAllowed error: "source with multiple subject transforms cannot also have a single subject filter"
2373
func NewJSSourceMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
×
2374
        eopts := parseOpts(opts)
×
2375
        if ae, ok := eopts.err.(*ApiError); ok {
×
2376
                return ae
×
2377
        }
×
2378

2379
        return ApiErrors[JSSourceMultipleFiltersNotAllowed]
×
2380
}
2381

2382
// NewJSSourceOverlappingSubjectFiltersError creates a new JSSourceOverlappingSubjectFilters error: "source filters can not overlap"
2383
func NewJSSourceOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
2384
        eopts := parseOpts(opts)
×
2385
        if ae, ok := eopts.err.(*ApiError); ok {
×
2386
                return ae
×
2387
        }
×
2388

2389
        return ApiErrors[JSSourceOverlappingSubjectFilters]
×
2390
}
2391

2392
// NewJSSourceWithMsgSchedulesError creates a new JSSourceWithMsgSchedulesErr error: "stream source can not also schedule messages"
2393
func NewJSSourceWithMsgSchedulesError(opts ...ErrorOption) *ApiError {
2✔
2394
        eopts := parseOpts(opts)
2✔
2395
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2396
                return ae
×
2397
        }
×
2398

2399
        return ApiErrors[JSSourceWithMsgSchedulesErr]
2✔
2400
}
2401

2402
// NewJSStorageResourcesExceededError creates a new JSStorageResourcesExceededErr error: "insufficient storage resources available"
2403
func NewJSStorageResourcesExceededError(opts ...ErrorOption) *ApiError {
25✔
2404
        eopts := parseOpts(opts)
25✔
2405
        if ae, ok := eopts.err.(*ApiError); ok {
25✔
2406
                return ae
×
2407
        }
×
2408

2409
        return ApiErrors[JSStorageResourcesExceededErr]
25✔
2410
}
2411

2412
// NewJSStreamAssignmentError creates a new JSStreamAssignmentErrF error: "{err}"
2413
func NewJSStreamAssignmentError(err error, opts ...ErrorOption) *ApiError {
×
2414
        eopts := parseOpts(opts)
×
2415
        if ae, ok := eopts.err.(*ApiError); ok {
×
2416
                return ae
×
2417
        }
×
2418

2419
        e := ApiErrors[JSStreamAssignmentErrF]
×
2420
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2421
        return &ApiError{
×
2422
                Code:        e.Code,
×
2423
                ErrCode:     e.ErrCode,
×
2424
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2425
        }
×
2426
}
2427

2428
// NewJSStreamCreateError creates a new JSStreamCreateErrF error: "{err}"
2429
func NewJSStreamCreateError(err error, opts ...ErrorOption) *ApiError {
84✔
2430
        eopts := parseOpts(opts)
84✔
2431
        if ae, ok := eopts.err.(*ApiError); ok {
165✔
2432
                return ae
81✔
2433
        }
81✔
2434

2435
        e := ApiErrors[JSStreamCreateErrF]
3✔
2436
        args := e.toReplacerArgs([]interface{}{"{err}", err})
3✔
2437
        return &ApiError{
3✔
2438
                Code:        e.Code,
3✔
2439
                ErrCode:     e.ErrCode,
3✔
2440
                Description: strings.NewReplacer(args...).Replace(e.Description),
3✔
2441
        }
3✔
2442
}
2443

2444
// NewJSStreamDeleteError creates a new JSStreamDeleteErrF error: "{err}"
2445
func NewJSStreamDeleteError(err error, opts ...ErrorOption) *ApiError {
×
2446
        eopts := parseOpts(opts)
×
2447
        if ae, ok := eopts.err.(*ApiError); ok {
×
2448
                return ae
×
2449
        }
×
2450

2451
        e := ApiErrors[JSStreamDeleteErrF]
×
2452
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2453
        return &ApiError{
×
2454
                Code:        e.Code,
×
2455
                ErrCode:     e.ErrCode,
×
2456
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2457
        }
×
2458
}
2459

2460
// NewJSStreamDuplicateMessageConflictError creates a new JSStreamDuplicateMessageConflict error: "duplicate message id is in process"
2461
func NewJSStreamDuplicateMessageConflictError(opts ...ErrorOption) *ApiError {
175✔
2462
        eopts := parseOpts(opts)
175✔
2463
        if ae, ok := eopts.err.(*ApiError); ok {
175✔
2464
                return ae
×
2465
        }
×
2466

2467
        return ApiErrors[JSStreamDuplicateMessageConflict]
175✔
2468
}
2469

2470
// NewJSStreamExpectedLastSeqPerSubjectInvalidError creates a new JSStreamExpectedLastSeqPerSubjectInvalid error: "missing sequence for expected last sequence per subject"
2471
func NewJSStreamExpectedLastSeqPerSubjectInvalidError(opts ...ErrorOption) *ApiError {
8✔
2472
        eopts := parseOpts(opts)
8✔
2473
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
2474
                return ae
×
2475
        }
×
2476

2477
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectInvalid]
8✔
2478
}
2479

2480
// NewJSStreamExpectedLastSeqPerSubjectNotReadyError creates a new JSStreamExpectedLastSeqPerSubjectNotReady error: "expected last sequence per subject temporarily unavailable"
2481
func NewJSStreamExpectedLastSeqPerSubjectNotReadyError(opts ...ErrorOption) *ApiError {
×
2482
        eopts := parseOpts(opts)
×
2483
        if ae, ok := eopts.err.(*ApiError); ok {
×
2484
                return ae
×
2485
        }
×
2486

2487
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectNotReady]
×
2488
}
2489

2490
// NewJSStreamExternalApiOverlapError creates a new JSStreamExternalApiOverlapErrF error: "stream external api prefix {prefix} must not overlap with {subject}"
2491
func NewJSStreamExternalApiOverlapError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
2✔
2492
        eopts := parseOpts(opts)
2✔
2493
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2494
                return ae
×
2495
        }
×
2496

2497
        e := ApiErrors[JSStreamExternalApiOverlapErrF]
2✔
2498
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
2✔
2499
        return &ApiError{
2✔
2500
                Code:        e.Code,
2✔
2501
                ErrCode:     e.ErrCode,
2✔
2502
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2503
        }
2✔
2504
}
2505

2506
// NewJSStreamExternalDelPrefixOverlapsError creates a new JSStreamExternalDelPrefixOverlapsErrF error: "stream external delivery prefix {prefix} overlaps with stream subject {subject}"
2507
func NewJSStreamExternalDelPrefixOverlapsError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
×
2508
        eopts := parseOpts(opts)
×
2509
        if ae, ok := eopts.err.(*ApiError); ok {
×
2510
                return ae
×
2511
        }
×
2512

2513
        e := ApiErrors[JSStreamExternalDelPrefixOverlapsErrF]
×
2514
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
×
2515
        return &ApiError{
×
2516
                Code:        e.Code,
×
2517
                ErrCode:     e.ErrCode,
×
2518
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2519
        }
×
2520
}
2521

2522
// NewJSStreamGeneralError creates a new JSStreamGeneralErrorF error: "{err}"
2523
func NewJSStreamGeneralError(err error, opts ...ErrorOption) *ApiError {
3✔
2524
        eopts := parseOpts(opts)
3✔
2525
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2526
                return ae
×
2527
        }
×
2528

2529
        e := ApiErrors[JSStreamGeneralErrorF]
3✔
2530
        args := e.toReplacerArgs([]interface{}{"{err}", err})
3✔
2531
        return &ApiError{
3✔
2532
                Code:        e.Code,
3✔
2533
                ErrCode:     e.ErrCode,
3✔
2534
                Description: strings.NewReplacer(args...).Replace(e.Description),
3✔
2535
        }
3✔
2536
}
2537

2538
// NewJSStreamHeaderExceedsMaximumError creates a new JSStreamHeaderExceedsMaximumErr error: "header size exceeds maximum allowed of 64k"
2539
func NewJSStreamHeaderExceedsMaximumError(opts ...ErrorOption) *ApiError {
1✔
2540
        eopts := parseOpts(opts)
1✔
2541
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2542
                return ae
×
2543
        }
×
2544

2545
        return ApiErrors[JSStreamHeaderExceedsMaximumErr]
1✔
2546
}
2547

2548
// NewJSStreamInfoMaxSubjectsError creates a new JSStreamInfoMaxSubjectsErr error: "subject details would exceed maximum allowed"
2549
func NewJSStreamInfoMaxSubjectsError(opts ...ErrorOption) *ApiError {
×
2550
        eopts := parseOpts(opts)
×
2551
        if ae, ok := eopts.err.(*ApiError); ok {
×
2552
                return ae
×
2553
        }
×
2554

2555
        return ApiErrors[JSStreamInfoMaxSubjectsErr]
×
2556
}
2557

2558
// NewJSStreamInvalidConfigError creates a new JSStreamInvalidConfigF error: "{err}"
2559
func NewJSStreamInvalidConfigError(err error, opts ...ErrorOption) *ApiError {
156✔
2560
        eopts := parseOpts(opts)
156✔
2561
        if ae, ok := eopts.err.(*ApiError); ok {
178✔
2562
                return ae
22✔
2563
        }
22✔
2564

2565
        e := ApiErrors[JSStreamInvalidConfigF]
134✔
2566
        args := e.toReplacerArgs([]interface{}{"{err}", err})
134✔
2567
        return &ApiError{
134✔
2568
                Code:        e.Code,
134✔
2569
                ErrCode:     e.ErrCode,
134✔
2570
                Description: strings.NewReplacer(args...).Replace(e.Description),
134✔
2571
        }
134✔
2572
}
2573

2574
// NewJSStreamInvalidError creates a new JSStreamInvalidErr error: "stream not valid"
2575
func NewJSStreamInvalidError(opts ...ErrorOption) *ApiError {
×
2576
        eopts := parseOpts(opts)
×
2577
        if ae, ok := eopts.err.(*ApiError); ok {
×
2578
                return ae
×
2579
        }
×
2580

2581
        return ApiErrors[JSStreamInvalidErr]
×
2582
}
2583

2584
// NewJSStreamInvalidExternalDeliverySubjError creates a new JSStreamInvalidExternalDeliverySubjErrF error: "stream external delivery prefix {prefix} must not contain wildcards"
2585
func NewJSStreamInvalidExternalDeliverySubjError(prefix interface{}, opts ...ErrorOption) *ApiError {
×
2586
        eopts := parseOpts(opts)
×
2587
        if ae, ok := eopts.err.(*ApiError); ok {
×
2588
                return ae
×
2589
        }
×
2590

2591
        e := ApiErrors[JSStreamInvalidExternalDeliverySubjErrF]
×
2592
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix})
×
2593
        return &ApiError{
×
2594
                Code:        e.Code,
×
2595
                ErrCode:     e.ErrCode,
×
2596
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2597
        }
×
2598
}
2599

2600
// NewJSStreamLimitsError creates a new JSStreamLimitsErrF error: "{err}"
2601
func NewJSStreamLimitsError(err error, opts ...ErrorOption) *ApiError {
8✔
2602
        eopts := parseOpts(opts)
8✔
2603
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2604
                return ae
8✔
2605
        }
8✔
2606

2607
        e := ApiErrors[JSStreamLimitsErrF]
×
2608
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2609
        return &ApiError{
×
2610
                Code:        e.Code,
×
2611
                ErrCode:     e.ErrCode,
×
2612
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2613
        }
×
2614
}
2615

2616
// NewJSStreamMaxBytesRequiredError creates a new JSStreamMaxBytesRequired error: "account requires a stream config to have max bytes set"
2617
func NewJSStreamMaxBytesRequiredError(opts ...ErrorOption) *ApiError {
3✔
2618
        eopts := parseOpts(opts)
3✔
2619
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2620
                return ae
×
2621
        }
×
2622

2623
        return ApiErrors[JSStreamMaxBytesRequired]
3✔
2624
}
2625

2626
// NewJSStreamMaxStreamBytesExceededError creates a new JSStreamMaxStreamBytesExceeded error: "stream max bytes exceeds account limit max stream bytes"
2627
func NewJSStreamMaxStreamBytesExceededError(opts ...ErrorOption) *ApiError {
2✔
2628
        eopts := parseOpts(opts)
2✔
2629
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2630
                return ae
×
2631
        }
×
2632

2633
        return ApiErrors[JSStreamMaxStreamBytesExceeded]
2✔
2634
}
2635

2636
// NewJSStreamMessageExceedsMaximumError creates a new JSStreamMessageExceedsMaximumErr error: "message size exceeds maximum allowed"
2637
func NewJSStreamMessageExceedsMaximumError(opts ...ErrorOption) *ApiError {
19✔
2638
        eopts := parseOpts(opts)
19✔
2639
        if ae, ok := eopts.err.(*ApiError); ok {
19✔
2640
                return ae
×
2641
        }
×
2642

2643
        return ApiErrors[JSStreamMessageExceedsMaximumErr]
19✔
2644
}
2645

2646
// NewJSStreamMinLastSeqError creates a new JSStreamMinLastSeqErr error: "min last sequence"
2647
func NewJSStreamMinLastSeqError(opts ...ErrorOption) *ApiError {
×
2648
        eopts := parseOpts(opts)
×
2649
        if ae, ok := eopts.err.(*ApiError); ok {
×
2650
                return ae
×
2651
        }
×
2652

2653
        return ApiErrors[JSStreamMinLastSeqErr]
×
2654
}
2655

2656
// NewJSStreamMirrorNotUpdatableError creates a new JSStreamMirrorNotUpdatableErr error: "stream mirror configuration can not be updated"
2657
func NewJSStreamMirrorNotUpdatableError(opts ...ErrorOption) *ApiError {
2✔
2658
        eopts := parseOpts(opts)
2✔
2659
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2660
                return ae
×
2661
        }
×
2662

2663
        return ApiErrors[JSStreamMirrorNotUpdatableErr]
2✔
2664
}
2665

2666
// NewJSStreamMismatchError creates a new JSStreamMismatchErr error: "stream name in subject does not match request"
2667
func NewJSStreamMismatchError(opts ...ErrorOption) *ApiError {
3✔
2668
        eopts := parseOpts(opts)
3✔
2669
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2670
                return ae
×
2671
        }
×
2672

2673
        return ApiErrors[JSStreamMismatchErr]
3✔
2674
}
2675

2676
// NewJSStreamMoveAndScaleError creates a new JSStreamMoveAndScaleErr error: "can not move and scale a stream in a single update"
2677
func NewJSStreamMoveAndScaleError(opts ...ErrorOption) *ApiError {
4✔
2678
        eopts := parseOpts(opts)
4✔
2679
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2680
                return ae
×
2681
        }
×
2682

2683
        return ApiErrors[JSStreamMoveAndScaleErr]
4✔
2684
}
2685

2686
// NewJSStreamMoveInProgressError creates a new JSStreamMoveInProgressF error: "stream move already in progress: {msg}"
2687
func NewJSStreamMoveInProgressError(msg interface{}, opts ...ErrorOption) *ApiError {
2✔
2688
        eopts := parseOpts(opts)
2✔
2689
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2690
                return ae
×
2691
        }
×
2692

2693
        e := ApiErrors[JSStreamMoveInProgressF]
2✔
2694
        args := e.toReplacerArgs([]interface{}{"{msg}", msg})
2✔
2695
        return &ApiError{
2✔
2696
                Code:        e.Code,
2✔
2697
                ErrCode:     e.ErrCode,
2✔
2698
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2699
        }
2✔
2700
}
2701

2702
// NewJSStreamMoveNotInProgressError creates a new JSStreamMoveNotInProgress error: "stream move not in progress"
2703
func NewJSStreamMoveNotInProgressError(opts ...ErrorOption) *ApiError {
×
2704
        eopts := parseOpts(opts)
×
2705
        if ae, ok := eopts.err.(*ApiError); ok {
×
2706
                return ae
×
2707
        }
×
2708

2709
        return ApiErrors[JSStreamMoveNotInProgress]
×
2710
}
2711

2712
// NewJSStreamMsgDeleteFailedError creates a new JSStreamMsgDeleteFailedF error: "{err}"
2713
func NewJSStreamMsgDeleteFailedError(err error, opts ...ErrorOption) *ApiError {
1✔
2714
        eopts := parseOpts(opts)
1✔
2715
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2716
                return ae
×
2717
        }
×
2718

2719
        e := ApiErrors[JSStreamMsgDeleteFailedF]
1✔
2720
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2721
        return &ApiError{
1✔
2722
                Code:        e.Code,
1✔
2723
                ErrCode:     e.ErrCode,
1✔
2724
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2725
        }
1✔
2726
}
2727

2728
// NewJSStreamNameContainsPathSeparatorsError creates a new JSStreamNameContainsPathSeparatorsErr error: "Stream name can not contain path separators"
2729
func NewJSStreamNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
6✔
2730
        eopts := parseOpts(opts)
6✔
2731
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2732
                return ae
×
2733
        }
×
2734

2735
        return ApiErrors[JSStreamNameContainsPathSeparatorsErr]
6✔
2736
}
2737

2738
// NewJSStreamNameExistError creates a new JSStreamNameExistErr error: "stream name already in use with a different configuration"
2739
func NewJSStreamNameExistError(opts ...ErrorOption) *ApiError {
10✔
2740
        eopts := parseOpts(opts)
10✔
2741
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2742
                return ae
×
2743
        }
×
2744

2745
        return ApiErrors[JSStreamNameExistErr]
10✔
2746
}
2747

2748
// NewJSStreamNameExistRestoreFailedError creates a new JSStreamNameExistRestoreFailedErr error: "stream name already in use, cannot restore"
2749
func NewJSStreamNameExistRestoreFailedError(opts ...ErrorOption) *ApiError {
3✔
2750
        eopts := parseOpts(opts)
3✔
2751
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2752
                return ae
×
2753
        }
×
2754

2755
        return ApiErrors[JSStreamNameExistRestoreFailedErr]
3✔
2756
}
2757

2758
// NewJSStreamNotFoundError creates a new JSStreamNotFoundErr error: "stream not found"
2759
func NewJSStreamNotFoundError(opts ...ErrorOption) *ApiError {
25,183✔
2760
        eopts := parseOpts(opts)
25,183✔
2761
        if ae, ok := eopts.err.(*ApiError); ok {
25,850✔
2762
                return ae
667✔
2763
        }
667✔
2764

2765
        return ApiErrors[JSStreamNotFoundErr]
24,516✔
2766
}
2767

2768
// NewJSStreamNotMatchError creates a new JSStreamNotMatchErr error: "expected stream does not match"
2769
func NewJSStreamNotMatchError(opts ...ErrorOption) *ApiError {
5✔
2770
        eopts := parseOpts(opts)
5✔
2771
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2772
                return ae
×
2773
        }
×
2774

2775
        return ApiErrors[JSStreamNotMatchErr]
5✔
2776
}
2777

2778
// NewJSStreamOfflineError creates a new JSStreamOfflineErr error: "stream is offline"
2779
func NewJSStreamOfflineError(opts ...ErrorOption) *ApiError {
6✔
2780
        eopts := parseOpts(opts)
6✔
2781
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2782
                return ae
×
2783
        }
×
2784

2785
        return ApiErrors[JSStreamOfflineErr]
6✔
2786
}
2787

2788
// NewJSStreamOfflineReasonError creates a new JSStreamOfflineReasonErrF error: "stream is offline: {err}"
2789
func NewJSStreamOfflineReasonError(err error, opts ...ErrorOption) *ApiError {
40✔
2790
        eopts := parseOpts(opts)
40✔
2791
        if ae, ok := eopts.err.(*ApiError); ok {
40✔
2792
                return ae
×
2793
        }
×
2794

2795
        e := ApiErrors[JSStreamOfflineReasonErrF]
40✔
2796
        args := e.toReplacerArgs([]interface{}{"{err}", err})
40✔
2797
        return &ApiError{
40✔
2798
                Code:        e.Code,
40✔
2799
                ErrCode:     e.ErrCode,
40✔
2800
                Description: strings.NewReplacer(args...).Replace(e.Description),
40✔
2801
        }
40✔
2802
}
2803

2804
// NewJSStreamPurgeFailedError creates a new JSStreamPurgeFailedF error: "{err}"
2805
func NewJSStreamPurgeFailedError(err error, opts ...ErrorOption) *ApiError {
1✔
2806
        eopts := parseOpts(opts)
1✔
2807
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2808
                return ae
×
2809
        }
×
2810

2811
        e := ApiErrors[JSStreamPurgeFailedF]
1✔
2812
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2813
        return &ApiError{
1✔
2814
                Code:        e.Code,
1✔
2815
                ErrCode:     e.ErrCode,
1✔
2816
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2817
        }
1✔
2818
}
2819

2820
// NewJSStreamReplicasNotSupportedError creates a new JSStreamReplicasNotSupportedErr error: "replicas > 1 not supported in non-clustered mode"
2821
func NewJSStreamReplicasNotSupportedError(opts ...ErrorOption) *ApiError {
1✔
2822
        eopts := parseOpts(opts)
1✔
2823
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2824
                return ae
×
2825
        }
×
2826

2827
        return ApiErrors[JSStreamReplicasNotSupportedErr]
1✔
2828
}
2829

2830
// NewJSStreamReplicasNotUpdatableError creates a new JSStreamReplicasNotUpdatableErr error: "Replicas configuration can not be updated"
2831
func NewJSStreamReplicasNotUpdatableError(opts ...ErrorOption) *ApiError {
×
2832
        eopts := parseOpts(opts)
×
2833
        if ae, ok := eopts.err.(*ApiError); ok {
×
2834
                return ae
×
2835
        }
×
2836

2837
        return ApiErrors[JSStreamReplicasNotUpdatableErr]
×
2838
}
2839

2840
// NewJSStreamRestoreError creates a new JSStreamRestoreErrF error: "restore failed: {err}"
2841
func NewJSStreamRestoreError(err error, opts ...ErrorOption) *ApiError {
7✔
2842
        eopts := parseOpts(opts)
7✔
2843
        if ae, ok := eopts.err.(*ApiError); ok {
9✔
2844
                return ae
2✔
2845
        }
2✔
2846

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

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

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

2872
// NewJSStreamSealedError creates a new JSStreamSealedErr error: "invalid operation on sealed stream"
2873
func NewJSStreamSealedError(opts ...ErrorOption) *ApiError {
10✔
2874
        eopts := parseOpts(opts)
10✔
2875
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2876
                return ae
×
2877
        }
×
2878

2879
        return ApiErrors[JSStreamSealedErr]
10✔
2880
}
2881

2882
// NewJSStreamSequenceNotMatchError creates a new JSStreamSequenceNotMatchErr error: "expected stream sequence does not match"
2883
func NewJSStreamSequenceNotMatchError(opts ...ErrorOption) *ApiError {
×
2884
        eopts := parseOpts(opts)
×
2885
        if ae, ok := eopts.err.(*ApiError); ok {
×
2886
                return ae
×
2887
        }
×
2888

2889
        return ApiErrors[JSStreamSequenceNotMatchErr]
×
2890
}
2891

2892
// NewJSStreamSnapshotError creates a new JSStreamSnapshotErrF error: "snapshot failed: {err}"
2893
func NewJSStreamSnapshotError(err error, opts ...ErrorOption) *ApiError {
×
2894
        eopts := parseOpts(opts)
×
2895
        if ae, ok := eopts.err.(*ApiError); ok {
×
2896
                return ae
×
2897
        }
×
2898

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

2908
// NewJSStreamStoreFailedError creates a new JSStreamStoreFailedF error: "{err}"
2909
func NewJSStreamStoreFailedError(err error, opts ...ErrorOption) *ApiError {
1,518✔
2910
        eopts := parseOpts(opts)
1,518✔
2911
        if ae, ok := eopts.err.(*ApiError); ok {
1,518✔
2912
                return ae
×
2913
        }
×
2914

2915
        e := ApiErrors[JSStreamStoreFailedF]
1,518✔
2916
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1,518✔
2917
        return &ApiError{
1,518✔
2918
                Code:        e.Code,
1,518✔
2919
                ErrCode:     e.ErrCode,
1,518✔
2920
                Description: strings.NewReplacer(args...).Replace(e.Description),
1,518✔
2921
        }
1,518✔
2922
}
2923

2924
// NewJSStreamSubjectOverlapError creates a new JSStreamSubjectOverlapErr error: "subjects overlap with an existing stream"
2925
func NewJSStreamSubjectOverlapError(opts ...ErrorOption) *ApiError {
43✔
2926
        eopts := parseOpts(opts)
43✔
2927
        if ae, ok := eopts.err.(*ApiError); ok {
43✔
2928
                return ae
×
2929
        }
×
2930

2931
        return ApiErrors[JSStreamSubjectOverlapErr]
43✔
2932
}
2933

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

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

2950
// NewJSStreamTemplateDeleteError creates a new JSStreamTemplateDeleteErrF error: "{err}"
2951
func NewJSStreamTemplateDeleteError(err error, opts ...ErrorOption) *ApiError {
1✔
2952
        eopts := parseOpts(opts)
1✔
2953
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2954
                return ae
1✔
2955
        }
1✔
2956

2957
        e := ApiErrors[JSStreamTemplateDeleteErrF]
×
2958
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2959
        return &ApiError{
×
2960
                Code:        e.Code,
×
2961
                ErrCode:     e.ErrCode,
×
2962
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2963
        }
×
2964
}
2965

2966
// NewJSStreamTemplateNotFoundError creates a new JSStreamTemplateNotFoundErr error: "template not found"
2967
func NewJSStreamTemplateNotFoundError(opts ...ErrorOption) *ApiError {
4✔
2968
        eopts := parseOpts(opts)
4✔
2969
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2970
                return ae
×
2971
        }
×
2972

2973
        return ApiErrors[JSStreamTemplateNotFoundErr]
4✔
2974
}
2975

2976
// NewJSStreamTooManyRequestsError creates a new JSStreamTooManyRequests error: "too many requests"
2977
func NewJSStreamTooManyRequestsError(opts ...ErrorOption) *ApiError {
205✔
2978
        eopts := parseOpts(opts)
205✔
2979
        if ae, ok := eopts.err.(*ApiError); ok {
205✔
2980
                return ae
×
2981
        }
×
2982

2983
        return ApiErrors[JSStreamTooManyRequests]
205✔
2984
}
2985

2986
// NewJSStreamTransformInvalidDestinationError creates a new JSStreamTransformInvalidDestination error: "stream transform: {err}"
2987
func NewJSStreamTransformInvalidDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
2988
        eopts := parseOpts(opts)
1✔
2989
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2990
                return ae
×
2991
        }
×
2992

2993
        e := ApiErrors[JSStreamTransformInvalidDestination]
1✔
2994
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2995
        return &ApiError{
1✔
2996
                Code:        e.Code,
1✔
2997
                ErrCode:     e.ErrCode,
1✔
2998
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2999
        }
1✔
3000
}
3001

3002
// NewJSStreamTransformInvalidSourceError creates a new JSStreamTransformInvalidSource error: "stream transform source: {err}"
3003
func NewJSStreamTransformInvalidSourceError(err error, opts ...ErrorOption) *ApiError {
1✔
3004
        eopts := parseOpts(opts)
1✔
3005
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3006
                return ae
×
3007
        }
×
3008

3009
        e := ApiErrors[JSStreamTransformInvalidSource]
1✔
3010
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
3011
        return &ApiError{
1✔
3012
                Code:        e.Code,
1✔
3013
                ErrCode:     e.ErrCode,
1✔
3014
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
3015
        }
1✔
3016
}
3017

3018
// NewJSStreamUpdateError creates a new JSStreamUpdateErrF error: "{err}"
3019
func NewJSStreamUpdateError(err error, opts ...ErrorOption) *ApiError {
28✔
3020
        eopts := parseOpts(opts)
28✔
3021
        if ae, ok := eopts.err.(*ApiError); ok {
50✔
3022
                return ae
22✔
3023
        }
22✔
3024

3025
        e := ApiErrors[JSStreamUpdateErrF]
6✔
3026
        args := e.toReplacerArgs([]interface{}{"{err}", err})
6✔
3027
        return &ApiError{
6✔
3028
                Code:        e.Code,
6✔
3029
                ErrCode:     e.ErrCode,
6✔
3030
                Description: strings.NewReplacer(args...).Replace(e.Description),
6✔
3031
        }
6✔
3032
}
3033

3034
// NewJSStreamWrongLastMsgIDError creates a new JSStreamWrongLastMsgIDErrF error: "wrong last msg ID: {id}"
3035
func NewJSStreamWrongLastMsgIDError(id interface{}, opts ...ErrorOption) *ApiError {
5✔
3036
        eopts := parseOpts(opts)
5✔
3037
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
3038
                return ae
×
3039
        }
×
3040

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

3050
// NewJSStreamWrongLastSequenceConstantError creates a new JSStreamWrongLastSequenceConstantErr error: "wrong last sequence"
3051
func NewJSStreamWrongLastSequenceConstantError(opts ...ErrorOption) *ApiError {
24✔
3052
        eopts := parseOpts(opts)
24✔
3053
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
3054
                return ae
×
3055
        }
×
3056

3057
        return ApiErrors[JSStreamWrongLastSequenceConstantErr]
24✔
3058
}
3059

3060
// NewJSStreamWrongLastSequenceError creates a new JSStreamWrongLastSequenceErrF error: "wrong last sequence: {seq}"
3061
func NewJSStreamWrongLastSequenceError(seq uint64, opts ...ErrorOption) *ApiError {
94✔
3062
        eopts := parseOpts(opts)
94✔
3063
        if ae, ok := eopts.err.(*ApiError); ok {
94✔
3064
                return ae
×
3065
        }
×
3066

3067
        e := ApiErrors[JSStreamWrongLastSequenceErrF]
94✔
3068
        args := e.toReplacerArgs([]interface{}{"{seq}", seq})
94✔
3069
        return &ApiError{
94✔
3070
                Code:        e.Code,
94✔
3071
                ErrCode:     e.ErrCode,
94✔
3072
                Description: strings.NewReplacer(args...).Replace(e.Description),
94✔
3073
        }
94✔
3074
}
3075

3076
// NewJSTempStorageFailedError creates a new JSTempStorageFailedErr error: "JetStream unable to open temp storage for restore"
3077
func NewJSTempStorageFailedError(opts ...ErrorOption) *ApiError {
×
3078
        eopts := parseOpts(opts)
×
3079
        if ae, ok := eopts.err.(*ApiError); ok {
×
3080
                return ae
×
3081
        }
×
3082

3083
        return ApiErrors[JSTempStorageFailedErr]
×
3084
}
3085

3086
// NewJSTemplateNameNotMatchSubjectError creates a new JSTemplateNameNotMatchSubjectErr error: "template name in subject does not match request"
3087
func NewJSTemplateNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
1✔
3088
        eopts := parseOpts(opts)
1✔
3089
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3090
                return ae
×
3091
        }
×
3092

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