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

nats-io / nats-server / 17031310072

15 Aug 2025 04:02PM UTC coverage: 85.869% (+0.05%) from 85.821%
17031310072

push

github

web-flow
[FIXED] Correct Nats-TTL header if SDM TTL overrides it (#7177)

This PR fixes a bug where the `Nats-TTL` header would not be corrected
if the TTL got changed based on the `SubjectDeleteMarkerTTL` and
`MaxMsgsPer`.

Signed-off-by: Maurice van Veen <github@mauricevanveen.com>

72382 of 84294 relevant lines covered (85.87%)

367294.24 hits per line

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

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

3
package server
4

5
import "strings"
6

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

203
        // JSConsumerOnMappedErr consumer direct on a mapped consumer
204
        JSConsumerOnMappedErr ErrorIdentifier = 10092
205

206
        // JSConsumerOverlappingSubjectFilters consumer subject filters cannot overlap
207
        JSConsumerOverlappingSubjectFilters ErrorIdentifier = 10138
208

209
        // JSConsumerPriorityPolicyWithoutGroup Setting PriorityPolicy requires at least one PriorityGroup to be set
210
        JSConsumerPriorityPolicyWithoutGroup ErrorIdentifier = 10159
211

212
        // JSConsumerPullNotDurableErr consumer in pull mode requires a durable name
213
        JSConsumerPullNotDurableErr ErrorIdentifier = 10085
214

215
        // JSConsumerPullRequiresAckErr consumer in pull mode requires explicit ack policy on workqueue stream
216
        JSConsumerPullRequiresAckErr ErrorIdentifier = 10084
217

218
        // JSConsumerPullWithRateLimitErr consumer in pull mode can not have rate limit set
219
        JSConsumerPullWithRateLimitErr ErrorIdentifier = 10086
220

221
        // JSConsumerPushMaxWaitingErr consumer in push mode can not set max waiting
222
        JSConsumerPushMaxWaitingErr ErrorIdentifier = 10080
223

224
        // JSConsumerPushWithPriorityGroupErr priority groups can not be used with push consumers
225
        JSConsumerPushWithPriorityGroupErr ErrorIdentifier = 10178
226

227
        // JSConsumerReplacementWithDifferentNameErr consumer replacement durable config not the same
228
        JSConsumerReplacementWithDifferentNameErr ErrorIdentifier = 10106
229

230
        // JSConsumerReplayPolicyInvalidErr consumer replay policy invalid
231
        JSConsumerReplayPolicyInvalidErr ErrorIdentifier = 10182
232

233
        // JSConsumerReplicasExceedsStream consumer config replica count exceeds parent stream
234
        JSConsumerReplicasExceedsStream ErrorIdentifier = 10126
235

236
        // JSConsumerReplicasShouldMatchStream consumer config replicas must match interest retention stream's replicas
237
        JSConsumerReplicasShouldMatchStream ErrorIdentifier = 10134
238

239
        // JSConsumerSmallHeartbeatErr consumer idle heartbeat needs to be >= 100ms
240
        JSConsumerSmallHeartbeatErr ErrorIdentifier = 10083
241

242
        // JSConsumerStoreFailedErrF error creating store for consumer: {err}
243
        JSConsumerStoreFailedErrF ErrorIdentifier = 10104
244

245
        // JSConsumerWQConsumerNotDeliverAllErr consumer must be deliver all on workqueue stream
246
        JSConsumerWQConsumerNotDeliverAllErr ErrorIdentifier = 10101
247

248
        // JSConsumerWQConsumerNotUniqueErr filtered consumer not unique on workqueue stream
249
        JSConsumerWQConsumerNotUniqueErr ErrorIdentifier = 10100
250

251
        // JSConsumerWQMultipleUnfilteredErr multiple non-filtered consumers not allowed on workqueue stream
252
        JSConsumerWQMultipleUnfilteredErr ErrorIdentifier = 10099
253

254
        // JSConsumerWQRequiresExplicitAckErr workqueue stream requires explicit ack
255
        JSConsumerWQRequiresExplicitAckErr ErrorIdentifier = 10098
256

257
        // JSConsumerWithFlowControlNeedsHeartbeats consumer with flow control also needs heartbeats
258
        JSConsumerWithFlowControlNeedsHeartbeats ErrorIdentifier = 10108
259

260
        // JSInsufficientResourcesErr insufficient resources
261
        JSInsufficientResourcesErr ErrorIdentifier = 10023
262

263
        // JSInvalidJSONErr invalid JSON: {err}
264
        JSInvalidJSONErr ErrorIdentifier = 10025
265

266
        // JSMaximumConsumersLimitErr maximum consumers limit reached
267
        JSMaximumConsumersLimitErr ErrorIdentifier = 10026
268

269
        // JSMaximumStreamsLimitErr maximum number of streams reached
270
        JSMaximumStreamsLimitErr ErrorIdentifier = 10027
271

272
        // JSMemoryResourcesExceededErr insufficient memory resources available
273
        JSMemoryResourcesExceededErr ErrorIdentifier = 10028
274

275
        // JSMessageCounterBrokenErr message counter is broken
276
        JSMessageCounterBrokenErr ErrorIdentifier = 10172
277

278
        // JSMessageIncrDisabledErr message counters is disabled
279
        JSMessageIncrDisabledErr ErrorIdentifier = 10168
280

281
        // JSMessageIncrInvalidErr message counter increment is invalid
282
        JSMessageIncrInvalidErr ErrorIdentifier = 10171
283

284
        // JSMessageIncrMissingErr message counter increment is missing
285
        JSMessageIncrMissingErr ErrorIdentifier = 10169
286

287
        // JSMessageIncrPayloadErr message counter has payload
288
        JSMessageIncrPayloadErr ErrorIdentifier = 10170
289

290
        // JSMessageTTLDisabledErr per-message TTL is disabled
291
        JSMessageTTLDisabledErr ErrorIdentifier = 10166
292

293
        // JSMessageTTLInvalidErr invalid per-message TTL
294
        JSMessageTTLInvalidErr ErrorIdentifier = 10165
295

296
        // JSMirrorConsumerSetupFailedErrF generic mirror consumer setup failure string ({err})
297
        JSMirrorConsumerSetupFailedErrF ErrorIdentifier = 10029
298

299
        // JSMirrorInvalidStreamName mirrored stream name is invalid
300
        JSMirrorInvalidStreamName ErrorIdentifier = 10142
301

302
        // JSMirrorInvalidSubjectFilter mirror transform source: {err}
303
        JSMirrorInvalidSubjectFilter ErrorIdentifier = 10151
304

305
        // JSMirrorInvalidTransformDestination mirror transform: {err}
306
        JSMirrorInvalidTransformDestination ErrorIdentifier = 10154
307

308
        // JSMirrorMaxMessageSizeTooBigErr stream mirror must have max message size >= source
309
        JSMirrorMaxMessageSizeTooBigErr ErrorIdentifier = 10030
310

311
        // JSMirrorMultipleFiltersNotAllowed mirror with multiple subject transforms cannot also have a single subject filter
312
        JSMirrorMultipleFiltersNotAllowed ErrorIdentifier = 10150
313

314
        // JSMirrorOverlappingSubjectFilters mirror subject filters can not overlap
315
        JSMirrorOverlappingSubjectFilters ErrorIdentifier = 10152
316

317
        // JSMirrorWithCountersErr stream mirrors can not also calculate counters
318
        JSMirrorWithCountersErr ErrorIdentifier = 10173
319

320
        // JSMirrorWithFirstSeqErr stream mirrors can not have first sequence configured
321
        JSMirrorWithFirstSeqErr ErrorIdentifier = 10143
322

323
        // JSMirrorWithSourcesErr stream mirrors can not also contain other sources
324
        JSMirrorWithSourcesErr ErrorIdentifier = 10031
325

326
        // JSMirrorWithStartSeqAndTimeErr stream mirrors can not have both start seq and start time configured
327
        JSMirrorWithStartSeqAndTimeErr ErrorIdentifier = 10032
328

329
        // JSMirrorWithSubjectFiltersErr stream mirrors can not contain filtered subjects
330
        JSMirrorWithSubjectFiltersErr ErrorIdentifier = 10033
331

332
        // JSMirrorWithSubjectsErr stream mirrors can not contain subjects
333
        JSMirrorWithSubjectsErr ErrorIdentifier = 10034
334

335
        // JSNoAccountErr account not found
336
        JSNoAccountErr ErrorIdentifier = 10035
337

338
        // JSNoLimitsErr no JetStream default or applicable tiered limit present
339
        JSNoLimitsErr ErrorIdentifier = 10120
340

341
        // JSNoMessageFoundErr no message found
342
        JSNoMessageFoundErr ErrorIdentifier = 10037
343

344
        // JSNotEmptyRequestErr expected an empty request payload
345
        JSNotEmptyRequestErr ErrorIdentifier = 10038
346

347
        // JSNotEnabledErr JetStream not enabled
348
        JSNotEnabledErr ErrorIdentifier = 10076
349

350
        // JSNotEnabledForAccountErr JetStream not enabled for account
351
        JSNotEnabledForAccountErr ErrorIdentifier = 10039
352

353
        // JSPedanticErrF pedantic mode: {err}
354
        JSPedanticErrF ErrorIdentifier = 10157
355

356
        // JSPeerRemapErr peer remap failed
357
        JSPeerRemapErr ErrorIdentifier = 10075
358

359
        // JSRaftGeneralErrF General RAFT error string ({err})
360
        JSRaftGeneralErrF ErrorIdentifier = 10041
361

362
        // JSReplicasCountCannotBeNegative replicas count cannot be negative
363
        JSReplicasCountCannotBeNegative ErrorIdentifier = 10133
364

365
        // JSRequiredApiLevelErr JetStream minimum api level required
366
        JSRequiredApiLevelErr ErrorIdentifier = 10185
367

368
        // JSRestoreSubscribeFailedErrF JetStream unable to subscribe to restore snapshot {subject}: {err}
369
        JSRestoreSubscribeFailedErrF ErrorIdentifier = 10042
370

371
        // JSSequenceNotFoundErrF sequence {seq} not found
372
        JSSequenceNotFoundErrF ErrorIdentifier = 10043
373

374
        // JSSnapshotDeliverSubjectInvalidErr deliver subject not valid
375
        JSSnapshotDeliverSubjectInvalidErr ErrorIdentifier = 10015
376

377
        // JSSourceConsumerSetupFailedErrF General source consumer setup failure string ({err})
378
        JSSourceConsumerSetupFailedErrF ErrorIdentifier = 10045
379

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

383
        // JSSourceInvalidStreamName sourced stream name is invalid
384
        JSSourceInvalidStreamName ErrorIdentifier = 10141
385

386
        // JSSourceInvalidSubjectFilter source transform source: {err}
387
        JSSourceInvalidSubjectFilter ErrorIdentifier = 10145
388

389
        // JSSourceInvalidTransformDestination source transform: {err}
390
        JSSourceInvalidTransformDestination ErrorIdentifier = 10146
391

392
        // JSSourceMaxMessageSizeTooBigErr stream source must have max message size >= target
393
        JSSourceMaxMessageSizeTooBigErr ErrorIdentifier = 10046
394

395
        // JSSourceMultipleFiltersNotAllowed source with multiple subject transforms cannot also have a single subject filter
396
        JSSourceMultipleFiltersNotAllowed ErrorIdentifier = 10144
397

398
        // JSSourceOverlappingSubjectFilters source filters can not overlap
399
        JSSourceOverlappingSubjectFilters ErrorIdentifier = 10147
400

401
        // JSStorageResourcesExceededErr insufficient storage resources available
402
        JSStorageResourcesExceededErr ErrorIdentifier = 10047
403

404
        // JSStreamAssignmentErrF Generic stream assignment error string ({err})
405
        JSStreamAssignmentErrF ErrorIdentifier = 10048
406

407
        // JSStreamCreateErrF Generic stream creation error string ({err})
408
        JSStreamCreateErrF ErrorIdentifier = 10049
409

410
        // JSStreamDeleteErrF General stream deletion error string ({err})
411
        JSStreamDeleteErrF ErrorIdentifier = 10050
412

413
        // JSStreamDuplicateMessageConflict duplicate message id is in process
414
        JSStreamDuplicateMessageConflict ErrorIdentifier = 10158
415

416
        // JSStreamExpectedLastSeqPerSubjectNotReady expected last sequence per subject temporarily unavailable
417
        JSStreamExpectedLastSeqPerSubjectNotReady ErrorIdentifier = 10163
418

419
        // JSStreamExternalApiOverlapErrF stream external api prefix {prefix} must not overlap with {subject}
420
        JSStreamExternalApiOverlapErrF ErrorIdentifier = 10021
421

422
        // JSStreamExternalDelPrefixOverlapsErrF stream external delivery prefix {prefix} overlaps with stream subject {subject}
423
        JSStreamExternalDelPrefixOverlapsErrF ErrorIdentifier = 10022
424

425
        // JSStreamGeneralErrorF General stream failure string ({err})
426
        JSStreamGeneralErrorF ErrorIdentifier = 10051
427

428
        // JSStreamHeaderExceedsMaximumErr header size exceeds maximum allowed of 64k
429
        JSStreamHeaderExceedsMaximumErr ErrorIdentifier = 10097
430

431
        // JSStreamInfoMaxSubjectsErr subject details would exceed maximum allowed
432
        JSStreamInfoMaxSubjectsErr ErrorIdentifier = 10117
433

434
        // JSStreamInvalidConfigF Stream configuration validation error string ({err})
435
        JSStreamInvalidConfigF ErrorIdentifier = 10052
436

437
        // JSStreamInvalidErr stream not valid
438
        JSStreamInvalidErr ErrorIdentifier = 10096
439

440
        // JSStreamInvalidExternalDeliverySubjErrF stream external delivery prefix {prefix} must not contain wildcards
441
        JSStreamInvalidExternalDeliverySubjErrF ErrorIdentifier = 10024
442

443
        // JSStreamLimitsErrF General stream limits exceeded error string ({err})
444
        JSStreamLimitsErrF ErrorIdentifier = 10053
445

446
        // JSStreamMaxBytesRequired account requires a stream config to have max bytes set
447
        JSStreamMaxBytesRequired ErrorIdentifier = 10113
448

449
        // JSStreamMaxStreamBytesExceeded stream max bytes exceeds account limit max stream bytes
450
        JSStreamMaxStreamBytesExceeded ErrorIdentifier = 10122
451

452
        // JSStreamMessageExceedsMaximumErr message size exceeds maximum allowed
453
        JSStreamMessageExceedsMaximumErr ErrorIdentifier = 10054
454

455
        // JSStreamMinLastSeqErr min last sequence
456
        JSStreamMinLastSeqErr ErrorIdentifier = 10180
457

458
        // JSStreamMirrorNotUpdatableErr stream mirror configuration can not be updated
459
        JSStreamMirrorNotUpdatableErr ErrorIdentifier = 10055
460

461
        // JSStreamMismatchErr stream name in subject does not match request
462
        JSStreamMismatchErr ErrorIdentifier = 10056
463

464
        // JSStreamMoveAndScaleErr can not move and scale a stream in a single update
465
        JSStreamMoveAndScaleErr ErrorIdentifier = 10123
466

467
        // JSStreamMoveInProgressF stream move already in progress: {msg}
468
        JSStreamMoveInProgressF ErrorIdentifier = 10124
469

470
        // JSStreamMoveNotInProgress stream move not in progress
471
        JSStreamMoveNotInProgress ErrorIdentifier = 10129
472

473
        // JSStreamMsgDeleteFailedF Generic message deletion failure error string ({err})
474
        JSStreamMsgDeleteFailedF ErrorIdentifier = 10057
475

476
        // JSStreamNameContainsPathSeparatorsErr Stream name can not contain path separators
477
        JSStreamNameContainsPathSeparatorsErr ErrorIdentifier = 10128
478

479
        // JSStreamNameExistErr stream name already in use with a different configuration
480
        JSStreamNameExistErr ErrorIdentifier = 10058
481

482
        // JSStreamNameExistRestoreFailedErr stream name already in use, cannot restore
483
        JSStreamNameExistRestoreFailedErr ErrorIdentifier = 10130
484

485
        // JSStreamNotFoundErr stream not found
486
        JSStreamNotFoundErr ErrorIdentifier = 10059
487

488
        // JSStreamNotMatchErr expected stream does not match
489
        JSStreamNotMatchErr ErrorIdentifier = 10060
490

491
        // JSStreamOfflineErr stream is offline
492
        JSStreamOfflineErr ErrorIdentifier = 10118
493

494
        // JSStreamPurgeFailedF Generic stream purge failure error string ({err})
495
        JSStreamPurgeFailedF ErrorIdentifier = 10110
496

497
        // JSStreamReplicasNotSupportedErr replicas > 1 not supported in non-clustered mode
498
        JSStreamReplicasNotSupportedErr ErrorIdentifier = 10074
499

500
        // JSStreamReplicasNotUpdatableErr Replicas configuration can not be updated
501
        JSStreamReplicasNotUpdatableErr ErrorIdentifier = 10061
502

503
        // JSStreamRestoreErrF restore failed: {err}
504
        JSStreamRestoreErrF ErrorIdentifier = 10062
505

506
        // JSStreamRollupFailedF Generic stream rollup failure error string ({err})
507
        JSStreamRollupFailedF ErrorIdentifier = 10111
508

509
        // JSStreamSealedErr invalid operation on sealed stream
510
        JSStreamSealedErr ErrorIdentifier = 10109
511

512
        // JSStreamSequenceNotMatchErr expected stream sequence does not match
513
        JSStreamSequenceNotMatchErr ErrorIdentifier = 10063
514

515
        // JSStreamSnapshotErrF snapshot failed: {err}
516
        JSStreamSnapshotErrF ErrorIdentifier = 10064
517

518
        // JSStreamStoreFailedF Generic error when storing a message failed ({err})
519
        JSStreamStoreFailedF ErrorIdentifier = 10077
520

521
        // JSStreamSubjectOverlapErr subjects overlap with an existing stream
522
        JSStreamSubjectOverlapErr ErrorIdentifier = 10065
523

524
        // JSStreamTemplateCreateErrF Generic template creation failed string ({err})
525
        JSStreamTemplateCreateErrF ErrorIdentifier = 10066
526

527
        // JSStreamTemplateDeleteErrF Generic stream template deletion failed error string ({err})
528
        JSStreamTemplateDeleteErrF ErrorIdentifier = 10067
529

530
        // JSStreamTemplateNotFoundErr template not found
531
        JSStreamTemplateNotFoundErr ErrorIdentifier = 10068
532

533
        // JSStreamTooManyRequests too many requests
534
        JSStreamTooManyRequests ErrorIdentifier = 10167
535

536
        // JSStreamTransformInvalidDestination stream transform: {err}
537
        JSStreamTransformInvalidDestination ErrorIdentifier = 10156
538

539
        // JSStreamTransformInvalidSource stream transform source: {err}
540
        JSStreamTransformInvalidSource ErrorIdentifier = 10155
541

542
        // JSStreamUpdateErrF Generic stream update error string ({err})
543
        JSStreamUpdateErrF ErrorIdentifier = 10069
544

545
        // JSStreamWrongLastMsgIDErrF wrong last msg ID: {id}
546
        JSStreamWrongLastMsgIDErrF ErrorIdentifier = 10070
547

548
        // JSStreamWrongLastSequenceConstantErr wrong last sequence
549
        JSStreamWrongLastSequenceConstantErr ErrorIdentifier = 10164
550

551
        // JSStreamWrongLastSequenceErrF wrong last sequence: {seq}
552
        JSStreamWrongLastSequenceErrF ErrorIdentifier = 10071
553

554
        // JSTempStorageFailedErr JetStream unable to open temp storage for restore
555
        JSTempStorageFailedErr ErrorIdentifier = 10072
556

557
        // JSTemplateNameNotMatchSubjectErr template name in subject does not match request
558
        JSTemplateNameNotMatchSubjectErr ErrorIdentifier = 10073
559
)
560

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

772
// NewJSAccountResourcesExceededError creates a new JSAccountResourcesExceededErr error: "resource limits exceeded for account"
773
func NewJSAccountResourcesExceededError(opts ...ErrorOption) *ApiError {
20,059✔
774
        eopts := parseOpts(opts)
20,059✔
775
        if ae, ok := eopts.err.(*ApiError); ok {
20,059✔
776
                return ae
×
777
        }
×
778

779
        return ApiErrors[JSAccountResourcesExceededErr]
20,059✔
780
}
781

782
// NewJSAtomicPublishDisabledError creates a new JSAtomicPublishDisabledErr error: "atomic publish is disabled"
783
func NewJSAtomicPublishDisabledError(opts ...ErrorOption) *ApiError {
24✔
784
        eopts := parseOpts(opts)
24✔
785
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
786
                return ae
×
787
        }
×
788

789
        return ApiErrors[JSAtomicPublishDisabledErr]
24✔
790
}
791

792
// NewJSAtomicPublishIncompleteBatchError creates a new JSAtomicPublishIncompleteBatchErr error: "atomic publish batch is incomplete"
793
func NewJSAtomicPublishIncompleteBatchError(opts ...ErrorOption) *ApiError {
64✔
794
        eopts := parseOpts(opts)
64✔
795
        if ae, ok := eopts.err.(*ApiError); ok {
64✔
796
                return ae
×
797
        }
×
798

799
        return ApiErrors[JSAtomicPublishIncompleteBatchErr]
64✔
800
}
801

802
// NewJSAtomicPublishInvalidBatchIDError creates a new JSAtomicPublishInvalidBatchIDErr error: "atomic publish batch ID is invalid"
803
func NewJSAtomicPublishInvalidBatchIDError(opts ...ErrorOption) *ApiError {
4✔
804
        eopts := parseOpts(opts)
4✔
805
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
806
                return ae
×
807
        }
×
808

809
        return ApiErrors[JSAtomicPublishInvalidBatchIDErr]
4✔
810
}
811

812
// NewJSAtomicPublishMissingSeqError creates a new JSAtomicPublishMissingSeqErr error: "atomic publish sequence is missing"
813
func NewJSAtomicPublishMissingSeqError(opts ...ErrorOption) *ApiError {
24✔
814
        eopts := parseOpts(opts)
24✔
815
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
816
                return ae
×
817
        }
×
818

819
        return ApiErrors[JSAtomicPublishMissingSeqErr]
24✔
820
}
821

822
// NewJSAtomicPublishUnsupportedHeaderBatchError creates a new JSAtomicPublishUnsupportedHeaderBatchErr error: "atomic publish unsupported header used: {header}"
823
func NewJSAtomicPublishUnsupportedHeaderBatchError(header interface{}, opts ...ErrorOption) *ApiError {
32✔
824
        eopts := parseOpts(opts)
32✔
825
        if ae, ok := eopts.err.(*ApiError); ok {
32✔
826
                return ae
×
827
        }
×
828

829
        e := ApiErrors[JSAtomicPublishUnsupportedHeaderBatchErr]
32✔
830
        args := e.toReplacerArgs([]interface{}{"{header}", header})
32✔
831
        return &ApiError{
32✔
832
                Code:        e.Code,
32✔
833
                ErrCode:     e.ErrCode,
32✔
834
                Description: strings.NewReplacer(args...).Replace(e.Description),
32✔
835
        }
32✔
836
}
837

838
// NewJSBadRequestError creates a new JSBadRequestErr error: "bad request"
839
func NewJSBadRequestError(opts ...ErrorOption) *ApiError {
10✔
840
        eopts := parseOpts(opts)
10✔
841
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
842
                return ae
×
843
        }
×
844

845
        return ApiErrors[JSBadRequestErr]
10✔
846
}
847

848
// NewJSClusterIncompleteError creates a new JSClusterIncompleteErr error: "incomplete results"
849
func NewJSClusterIncompleteError(opts ...ErrorOption) *ApiError {
×
850
        eopts := parseOpts(opts)
×
851
        if ae, ok := eopts.err.(*ApiError); ok {
×
852
                return ae
×
853
        }
×
854

855
        return ApiErrors[JSClusterIncompleteErr]
×
856
}
857

858
// NewJSClusterNoPeersError creates a new JSClusterNoPeersErrF error: "{err}"
859
func NewJSClusterNoPeersError(err error, opts ...ErrorOption) *ApiError {
59✔
860
        eopts := parseOpts(opts)
59✔
861
        if ae, ok := eopts.err.(*ApiError); ok {
59✔
862
                return ae
×
863
        }
×
864

865
        e := ApiErrors[JSClusterNoPeersErrF]
59✔
866
        args := e.toReplacerArgs([]interface{}{"{err}", err})
59✔
867
        return &ApiError{
59✔
868
                Code:        e.Code,
59✔
869
                ErrCode:     e.ErrCode,
59✔
870
                Description: strings.NewReplacer(args...).Replace(e.Description),
59✔
871
        }
59✔
872
}
873

874
// NewJSClusterNotActiveError creates a new JSClusterNotActiveErr error: "JetStream not in clustered mode"
875
func NewJSClusterNotActiveError(opts ...ErrorOption) *ApiError {
1✔
876
        eopts := parseOpts(opts)
1✔
877
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
878
                return ae
×
879
        }
×
880

881
        return ApiErrors[JSClusterNotActiveErr]
1✔
882
}
883

884
// NewJSClusterNotAssignedError creates a new JSClusterNotAssignedErr error: "JetStream cluster not assigned to this server"
885
func NewJSClusterNotAssignedError(opts ...ErrorOption) *ApiError {
18✔
886
        eopts := parseOpts(opts)
18✔
887
        if ae, ok := eopts.err.(*ApiError); ok {
18✔
888
                return ae
×
889
        }
×
890

891
        return ApiErrors[JSClusterNotAssignedErr]
18✔
892
}
893

894
// NewJSClusterNotAvailError creates a new JSClusterNotAvailErr error: "JetStream system temporarily unavailable"
895
func NewJSClusterNotAvailError(opts ...ErrorOption) *ApiError {
13✔
896
        eopts := parseOpts(opts)
13✔
897
        if ae, ok := eopts.err.(*ApiError); ok {
13✔
898
                return ae
×
899
        }
×
900

901
        return ApiErrors[JSClusterNotAvailErr]
13✔
902
}
903

904
// NewJSClusterNotLeaderError creates a new JSClusterNotLeaderErr error: "JetStream cluster can not handle request"
905
func NewJSClusterNotLeaderError(opts ...ErrorOption) *ApiError {
7✔
906
        eopts := parseOpts(opts)
7✔
907
        if ae, ok := eopts.err.(*ApiError); ok {
7✔
908
                return ae
×
909
        }
×
910

911
        return ApiErrors[JSClusterNotLeaderErr]
7✔
912
}
913

914
// NewJSClusterPeerNotMemberError creates a new JSClusterPeerNotMemberErr error: "peer not a member"
915
func NewJSClusterPeerNotMemberError(opts ...ErrorOption) *ApiError {
1✔
916
        eopts := parseOpts(opts)
1✔
917
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
918
                return ae
×
919
        }
×
920

921
        return ApiErrors[JSClusterPeerNotMemberErr]
1✔
922
}
923

924
// NewJSClusterRequiredError creates a new JSClusterRequiredErr error: "JetStream clustering support required"
925
func NewJSClusterRequiredError(opts ...ErrorOption) *ApiError {
×
926
        eopts := parseOpts(opts)
×
927
        if ae, ok := eopts.err.(*ApiError); ok {
×
928
                return ae
×
929
        }
×
930

931
        return ApiErrors[JSClusterRequiredErr]
×
932
}
933

934
// NewJSClusterServerNotMemberError creates a new JSClusterServerNotMemberErr error: "server is not a member of the cluster"
935
func NewJSClusterServerNotMemberError(opts ...ErrorOption) *ApiError {
3✔
936
        eopts := parseOpts(opts)
3✔
937
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
938
                return ae
×
939
        }
×
940

941
        return ApiErrors[JSClusterServerNotMemberErr]
3✔
942
}
943

944
// NewJSClusterTagsError creates a new JSClusterTagsErr error: "tags placement not supported for operation"
945
func NewJSClusterTagsError(opts ...ErrorOption) *ApiError {
×
946
        eopts := parseOpts(opts)
×
947
        if ae, ok := eopts.err.(*ApiError); ok {
×
948
                return ae
×
949
        }
×
950

951
        return ApiErrors[JSClusterTagsErr]
×
952
}
953

954
// NewJSClusterUnSupportFeatureError creates a new JSClusterUnSupportFeatureErr error: "not currently supported in clustered mode"
955
func NewJSClusterUnSupportFeatureError(opts ...ErrorOption) *ApiError {
6✔
956
        eopts := parseOpts(opts)
6✔
957
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
958
                return ae
×
959
        }
×
960

961
        return ApiErrors[JSClusterUnSupportFeatureErr]
6✔
962
}
963

964
// NewJSConsumerAckPolicyInvalidError creates a new JSConsumerAckPolicyInvalidErr error: "consumer ack policy invalid"
965
func NewJSConsumerAckPolicyInvalidError(opts ...ErrorOption) *ApiError {
2✔
966
        eopts := parseOpts(opts)
2✔
967
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
968
                return ae
×
969
        }
×
970

971
        return ApiErrors[JSConsumerAckPolicyInvalidErr]
2✔
972
}
973

974
// NewJSConsumerAckWaitNegativeError creates a new JSConsumerAckWaitNegativeErr error: "consumer ack wait needs to be positive"
975
func NewJSConsumerAckWaitNegativeError(opts ...ErrorOption) *ApiError {
2✔
976
        eopts := parseOpts(opts)
2✔
977
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
978
                return ae
×
979
        }
×
980

981
        return ApiErrors[JSConsumerAckWaitNegativeErr]
2✔
982
}
983

984
// NewJSConsumerAlreadyExistsError creates a new JSConsumerAlreadyExists error: "consumer already exists"
985
func NewJSConsumerAlreadyExistsError(opts ...ErrorOption) *ApiError {
5✔
986
        eopts := parseOpts(opts)
5✔
987
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
988
                return ae
×
989
        }
×
990

991
        return ApiErrors[JSConsumerAlreadyExists]
5✔
992
}
993

994
// NewJSConsumerBackOffNegativeError creates a new JSConsumerBackOffNegativeErr error: "consumer backoff needs to be positive"
995
func NewJSConsumerBackOffNegativeError(opts ...ErrorOption) *ApiError {
2✔
996
        eopts := parseOpts(opts)
2✔
997
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
998
                return ae
×
999
        }
×
1000

1001
        return ApiErrors[JSConsumerBackOffNegativeErr]
2✔
1002
}
1003

1004
// NewJSConsumerBadDurableNameError creates a new JSConsumerBadDurableNameErr error: "durable name can not contain '.', '*', '>'"
1005
func NewJSConsumerBadDurableNameError(opts ...ErrorOption) *ApiError {
×
1006
        eopts := parseOpts(opts)
×
1007
        if ae, ok := eopts.err.(*ApiError); ok {
×
1008
                return ae
×
1009
        }
×
1010

1011
        return ApiErrors[JSConsumerBadDurableNameErr]
×
1012
}
1013

1014
// NewJSConsumerConfigRequiredError creates a new JSConsumerConfigRequiredErr error: "consumer config required"
1015
func NewJSConsumerConfigRequiredError(opts ...ErrorOption) *ApiError {
2✔
1016
        eopts := parseOpts(opts)
2✔
1017
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1018
                return ae
×
1019
        }
×
1020

1021
        return ApiErrors[JSConsumerConfigRequiredErr]
2✔
1022
}
1023

1024
// NewJSConsumerCreateDurableAndNameMismatchError creates a new JSConsumerCreateDurableAndNameMismatch error: "Consumer Durable and Name have to be equal if both are provided"
1025
func NewJSConsumerCreateDurableAndNameMismatchError(opts ...ErrorOption) *ApiError {
1✔
1026
        eopts := parseOpts(opts)
1✔
1027
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1028
                return ae
×
1029
        }
×
1030

1031
        return ApiErrors[JSConsumerCreateDurableAndNameMismatch]
1✔
1032
}
1033

1034
// NewJSConsumerCreateError creates a new JSConsumerCreateErrF error: "{err}"
1035
func NewJSConsumerCreateError(err error, opts ...ErrorOption) *ApiError {
69✔
1036
        eopts := parseOpts(opts)
69✔
1037
        if ae, ok := eopts.err.(*ApiError); ok {
120✔
1038
                return ae
51✔
1039
        }
51✔
1040

1041
        e := ApiErrors[JSConsumerCreateErrF]
18✔
1042
        args := e.toReplacerArgs([]interface{}{"{err}", err})
18✔
1043
        return &ApiError{
18✔
1044
                Code:        e.Code,
18✔
1045
                ErrCode:     e.ErrCode,
18✔
1046
                Description: strings.NewReplacer(args...).Replace(e.Description),
18✔
1047
        }
18✔
1048
}
1049

1050
// NewJSConsumerCreateFilterSubjectMismatchError creates a new JSConsumerCreateFilterSubjectMismatchErr error: "Consumer create request did not match filtered subject from create subject"
1051
func NewJSConsumerCreateFilterSubjectMismatchError(opts ...ErrorOption) *ApiError {
2✔
1052
        eopts := parseOpts(opts)
2✔
1053
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1054
                return ae
×
1055
        }
×
1056

1057
        return ApiErrors[JSConsumerCreateFilterSubjectMismatchErr]
2✔
1058
}
1059

1060
// NewJSConsumerDeliverCycleError creates a new JSConsumerDeliverCycleErr error: "consumer deliver subject forms a cycle"
1061
func NewJSConsumerDeliverCycleError(opts ...ErrorOption) *ApiError {
4✔
1062
        eopts := parseOpts(opts)
4✔
1063
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1064
                return ae
×
1065
        }
×
1066

1067
        return ApiErrors[JSConsumerDeliverCycleErr]
4✔
1068
}
1069

1070
// NewJSConsumerDeliverToWildcardsError creates a new JSConsumerDeliverToWildcardsErr error: "consumer deliver subject has wildcards"
1071
func NewJSConsumerDeliverToWildcardsError(opts ...ErrorOption) *ApiError {
4✔
1072
        eopts := parseOpts(opts)
4✔
1073
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1074
                return ae
×
1075
        }
×
1076

1077
        return ApiErrors[JSConsumerDeliverToWildcardsErr]
4✔
1078
}
1079

1080
// NewJSConsumerDescriptionTooLongError creates a new JSConsumerDescriptionTooLongErrF error: "consumer description is too long, maximum allowed is {max}"
1081
func NewJSConsumerDescriptionTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
1✔
1082
        eopts := parseOpts(opts)
1✔
1083
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1084
                return ae
×
1085
        }
×
1086

1087
        e := ApiErrors[JSConsumerDescriptionTooLongErrF]
1✔
1088
        args := e.toReplacerArgs([]interface{}{"{max}", max})
1✔
1089
        return &ApiError{
1✔
1090
                Code:        e.Code,
1✔
1091
                ErrCode:     e.ErrCode,
1✔
1092
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1093
        }
1✔
1094
}
1095

1096
// NewJSConsumerDirectRequiresEphemeralError creates a new JSConsumerDirectRequiresEphemeralErr error: "consumer direct requires an ephemeral consumer"
1097
func NewJSConsumerDirectRequiresEphemeralError(opts ...ErrorOption) *ApiError {
×
1098
        eopts := parseOpts(opts)
×
1099
        if ae, ok := eopts.err.(*ApiError); ok {
×
1100
                return ae
×
1101
        }
×
1102

1103
        return ApiErrors[JSConsumerDirectRequiresEphemeralErr]
×
1104
}
1105

1106
// NewJSConsumerDirectRequiresPushError creates a new JSConsumerDirectRequiresPushErr error: "consumer direct requires a push based consumer"
1107
func NewJSConsumerDirectRequiresPushError(opts ...ErrorOption) *ApiError {
×
1108
        eopts := parseOpts(opts)
×
1109
        if ae, ok := eopts.err.(*ApiError); ok {
×
1110
                return ae
×
1111
        }
×
1112

1113
        return ApiErrors[JSConsumerDirectRequiresPushErr]
×
1114
}
1115

1116
// NewJSConsumerDoesNotExistError creates a new JSConsumerDoesNotExist error: "consumer does not exist"
1117
func NewJSConsumerDoesNotExistError(opts ...ErrorOption) *ApiError {
3✔
1118
        eopts := parseOpts(opts)
3✔
1119
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1120
                return ae
×
1121
        }
×
1122

1123
        return ApiErrors[JSConsumerDoesNotExist]
3✔
1124
}
1125

1126
// NewJSConsumerDuplicateFilterSubjectsError creates a new JSConsumerDuplicateFilterSubjects error: "consumer cannot have both FilterSubject and FilterSubjects specified"
1127
func NewJSConsumerDuplicateFilterSubjectsError(opts ...ErrorOption) *ApiError {
1✔
1128
        eopts := parseOpts(opts)
1✔
1129
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1130
                return ae
×
1131
        }
×
1132

1133
        return ApiErrors[JSConsumerDuplicateFilterSubjects]
1✔
1134
}
1135

1136
// NewJSConsumerDurableNameNotInSubjectError creates a new JSConsumerDurableNameNotInSubjectErr error: "consumer expected to be durable but no durable name set in subject"
1137
func NewJSConsumerDurableNameNotInSubjectError(opts ...ErrorOption) *ApiError {
×
1138
        eopts := parseOpts(opts)
×
1139
        if ae, ok := eopts.err.(*ApiError); ok {
×
1140
                return ae
×
1141
        }
×
1142

1143
        return ApiErrors[JSConsumerDurableNameNotInSubjectErr]
×
1144
}
1145

1146
// NewJSConsumerDurableNameNotMatchSubjectError creates a new JSConsumerDurableNameNotMatchSubjectErr error: "consumer name in subject does not match durable name in request"
1147
func NewJSConsumerDurableNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
×
1148
        eopts := parseOpts(opts)
×
1149
        if ae, ok := eopts.err.(*ApiError); ok {
×
1150
                return ae
×
1151
        }
×
1152

1153
        return ApiErrors[JSConsumerDurableNameNotMatchSubjectErr]
×
1154
}
1155

1156
// NewJSConsumerDurableNameNotSetError creates a new JSConsumerDurableNameNotSetErr error: "consumer expected to be durable but a durable name was not set"
1157
func NewJSConsumerDurableNameNotSetError(opts ...ErrorOption) *ApiError {
1✔
1158
        eopts := parseOpts(opts)
1✔
1159
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1160
                return ae
×
1161
        }
×
1162

1163
        return ApiErrors[JSConsumerDurableNameNotSetErr]
1✔
1164
}
1165

1166
// NewJSConsumerEmptyFilterError creates a new JSConsumerEmptyFilter error: "consumer filter in FilterSubjects cannot be empty"
1167
func NewJSConsumerEmptyFilterError(opts ...ErrorOption) *ApiError {
1✔
1168
        eopts := parseOpts(opts)
1✔
1169
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1170
                return ae
×
1171
        }
×
1172

1173
        return ApiErrors[JSConsumerEmptyFilter]
1✔
1174
}
1175

1176
// NewJSConsumerEmptyGroupNameError creates a new JSConsumerEmptyGroupName error: "Group name cannot be an empty string"
1177
func NewJSConsumerEmptyGroupNameError(opts ...ErrorOption) *ApiError {
4✔
1178
        eopts := parseOpts(opts)
4✔
1179
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1180
                return ae
×
1181
        }
×
1182

1183
        return ApiErrors[JSConsumerEmptyGroupName]
4✔
1184
}
1185

1186
// NewJSConsumerEphemeralWithDurableInSubjectError creates a new JSConsumerEphemeralWithDurableInSubjectErr error: "consumer expected to be ephemeral but detected a durable name set in subject"
1187
func NewJSConsumerEphemeralWithDurableInSubjectError(opts ...ErrorOption) *ApiError {
×
1188
        eopts := parseOpts(opts)
×
1189
        if ae, ok := eopts.err.(*ApiError); ok {
×
1190
                return ae
×
1191
        }
×
1192

1193
        return ApiErrors[JSConsumerEphemeralWithDurableInSubjectErr]
×
1194
}
1195

1196
// NewJSConsumerEphemeralWithDurableNameError creates a new JSConsumerEphemeralWithDurableNameErr error: "consumer expected to be ephemeral but a durable name was set in request"
1197
func NewJSConsumerEphemeralWithDurableNameError(opts ...ErrorOption) *ApiError {
3✔
1198
        eopts := parseOpts(opts)
3✔
1199
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1200
                return ae
×
1201
        }
×
1202

1203
        return ApiErrors[JSConsumerEphemeralWithDurableNameErr]
3✔
1204
}
1205

1206
// NewJSConsumerExistingActiveError creates a new JSConsumerExistingActiveErr error: "consumer already exists and is still active"
1207
func NewJSConsumerExistingActiveError(opts ...ErrorOption) *ApiError {
×
1208
        eopts := parseOpts(opts)
×
1209
        if ae, ok := eopts.err.(*ApiError); ok {
×
1210
                return ae
×
1211
        }
×
1212

1213
        return ApiErrors[JSConsumerExistingActiveErr]
×
1214
}
1215

1216
// NewJSConsumerFCRequiresPushError creates a new JSConsumerFCRequiresPushErr error: "consumer flow control requires a push based consumer"
1217
func NewJSConsumerFCRequiresPushError(opts ...ErrorOption) *ApiError {
×
1218
        eopts := parseOpts(opts)
×
1219
        if ae, ok := eopts.err.(*ApiError); ok {
×
1220
                return ae
×
1221
        }
×
1222

1223
        return ApiErrors[JSConsumerFCRequiresPushErr]
×
1224
}
1225

1226
// NewJSConsumerFilterNotSubsetError creates a new JSConsumerFilterNotSubsetErr error: "consumer filter subject is not a valid subset of the interest subjects"
1227
func NewJSConsumerFilterNotSubsetError(opts ...ErrorOption) *ApiError {
×
1228
        eopts := parseOpts(opts)
×
1229
        if ae, ok := eopts.err.(*ApiError); ok {
×
1230
                return ae
×
1231
        }
×
1232

1233
        return ApiErrors[JSConsumerFilterNotSubsetErr]
×
1234
}
1235

1236
// NewJSConsumerHBRequiresPushError creates a new JSConsumerHBRequiresPushErr error: "consumer idle heartbeat requires a push based consumer"
1237
func NewJSConsumerHBRequiresPushError(opts ...ErrorOption) *ApiError {
×
1238
        eopts := parseOpts(opts)
×
1239
        if ae, ok := eopts.err.(*ApiError); ok {
×
1240
                return ae
×
1241
        }
×
1242

1243
        return ApiErrors[JSConsumerHBRequiresPushErr]
×
1244
}
1245

1246
// NewJSConsumerInactiveThresholdExcessError creates a new JSConsumerInactiveThresholdExcess error: "consumer inactive threshold exceeds system limit of {limit}"
1247
func NewJSConsumerInactiveThresholdExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
2✔
1248
        eopts := parseOpts(opts)
2✔
1249
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1250
                return ae
×
1251
        }
×
1252

1253
        e := ApiErrors[JSConsumerInactiveThresholdExcess]
2✔
1254
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
2✔
1255
        return &ApiError{
2✔
1256
                Code:        e.Code,
2✔
1257
                ErrCode:     e.ErrCode,
2✔
1258
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1259
        }
2✔
1260
}
1261

1262
// NewJSConsumerInvalidDeliverSubjectError creates a new JSConsumerInvalidDeliverSubject error: "invalid push consumer deliver subject"
1263
func NewJSConsumerInvalidDeliverSubjectError(opts ...ErrorOption) *ApiError {
2✔
1264
        eopts := parseOpts(opts)
2✔
1265
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1266
                return ae
×
1267
        }
×
1268

1269
        return ApiErrors[JSConsumerInvalidDeliverSubject]
2✔
1270
}
1271

1272
// NewJSConsumerInvalidGroupNameError creates a new JSConsumerInvalidGroupNameErr error: "Valid priority group name must match A-Z, a-z, 0-9, -_/=)+ and may not exceed 16 characters"
1273
func NewJSConsumerInvalidGroupNameError(opts ...ErrorOption) *ApiError {
4✔
1274
        eopts := parseOpts(opts)
4✔
1275
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1276
                return ae
×
1277
        }
×
1278

1279
        return ApiErrors[JSConsumerInvalidGroupNameErr]
4✔
1280
}
1281

1282
// NewJSConsumerInvalidPolicyError creates a new JSConsumerInvalidPolicyErrF error: "{err}"
1283
func NewJSConsumerInvalidPolicyError(err error, opts ...ErrorOption) *ApiError {
10✔
1284
        eopts := parseOpts(opts)
10✔
1285
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1286
                return ae
×
1287
        }
×
1288

1289
        e := ApiErrors[JSConsumerInvalidPolicyErrF]
10✔
1290
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1291
        return &ApiError{
10✔
1292
                Code:        e.Code,
10✔
1293
                ErrCode:     e.ErrCode,
10✔
1294
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1295
        }
10✔
1296
}
1297

1298
// NewJSConsumerInvalidPriorityGroupError creates a new JSConsumerInvalidPriorityGroupErr error: "Provided priority group does not exist for this consumer"
1299
func NewJSConsumerInvalidPriorityGroupError(opts ...ErrorOption) *ApiError {
2✔
1300
        eopts := parseOpts(opts)
2✔
1301
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1302
                return ae
×
1303
        }
×
1304

1305
        return ApiErrors[JSConsumerInvalidPriorityGroupErr]
2✔
1306
}
1307

1308
// NewJSConsumerInvalidSamplingError creates a new JSConsumerInvalidSamplingErrF error: "failed to parse consumer sampling configuration: {err}"
1309
func NewJSConsumerInvalidSamplingError(err error, opts ...ErrorOption) *ApiError {
×
1310
        eopts := parseOpts(opts)
×
1311
        if ae, ok := eopts.err.(*ApiError); ok {
×
1312
                return ae
×
1313
        }
×
1314

1315
        e := ApiErrors[JSConsumerInvalidSamplingErrF]
×
1316
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1317
        return &ApiError{
×
1318
                Code:        e.Code,
×
1319
                ErrCode:     e.ErrCode,
×
1320
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1321
        }
×
1322
}
1323

1324
// NewJSConsumerMaxDeliverBackoffError creates a new JSConsumerMaxDeliverBackoffErr error: "max deliver is required to be > length of backoff values"
1325
func NewJSConsumerMaxDeliverBackoffError(opts ...ErrorOption) *ApiError {
3✔
1326
        eopts := parseOpts(opts)
3✔
1327
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1328
                return ae
×
1329
        }
×
1330

1331
        return ApiErrors[JSConsumerMaxDeliverBackoffErr]
3✔
1332
}
1333

1334
// NewJSConsumerMaxPendingAckExcessError creates a new JSConsumerMaxPendingAckExcessErrF error: "consumer max ack pending exceeds system limit of {limit}"
1335
func NewJSConsumerMaxPendingAckExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
12✔
1336
        eopts := parseOpts(opts)
12✔
1337
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
1338
                return ae
×
1339
        }
×
1340

1341
        e := ApiErrors[JSConsumerMaxPendingAckExcessErrF]
12✔
1342
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
12✔
1343
        return &ApiError{
12✔
1344
                Code:        e.Code,
12✔
1345
                ErrCode:     e.ErrCode,
12✔
1346
                Description: strings.NewReplacer(args...).Replace(e.Description),
12✔
1347
        }
12✔
1348
}
1349

1350
// NewJSConsumerMaxPendingAckPolicyRequiredError creates a new JSConsumerMaxPendingAckPolicyRequiredErr error: "consumer requires ack policy for max ack pending"
1351
func NewJSConsumerMaxPendingAckPolicyRequiredError(opts ...ErrorOption) *ApiError {
2✔
1352
        eopts := parseOpts(opts)
2✔
1353
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1354
                return ae
×
1355
        }
×
1356

1357
        return ApiErrors[JSConsumerMaxPendingAckPolicyRequiredErr]
2✔
1358
}
1359

1360
// NewJSConsumerMaxRequestBatchExceededError creates a new JSConsumerMaxRequestBatchExceededF error: "consumer max request batch exceeds server limit of {limit}"
1361
func NewJSConsumerMaxRequestBatchExceededError(limit interface{}, opts ...ErrorOption) *ApiError {
4✔
1362
        eopts := parseOpts(opts)
4✔
1363
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1364
                return ae
×
1365
        }
×
1366

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

1376
// NewJSConsumerMaxRequestBatchNegativeError creates a new JSConsumerMaxRequestBatchNegativeErr error: "consumer max request batch needs to be > 0"
1377
func NewJSConsumerMaxRequestBatchNegativeError(opts ...ErrorOption) *ApiError {
×
1378
        eopts := parseOpts(opts)
×
1379
        if ae, ok := eopts.err.(*ApiError); ok {
×
1380
                return ae
×
1381
        }
×
1382

1383
        return ApiErrors[JSConsumerMaxRequestBatchNegativeErr]
×
1384
}
1385

1386
// NewJSConsumerMaxRequestExpiresTooSmallError creates a new JSConsumerMaxRequestExpiresTooSmall error: "consumer max request expires needs to be >= 1ms"
1387
func NewJSConsumerMaxRequestExpiresTooSmallError(opts ...ErrorOption) *ApiError {
×
1388
        eopts := parseOpts(opts)
×
1389
        if ae, ok := eopts.err.(*ApiError); ok {
×
1390
                return ae
×
1391
        }
×
1392

1393
        return ApiErrors[JSConsumerMaxRequestExpiresTooSmall]
×
1394
}
1395

1396
// NewJSConsumerMaxWaitingNegativeError creates a new JSConsumerMaxWaitingNegativeErr error: "consumer max waiting needs to be positive"
1397
func NewJSConsumerMaxWaitingNegativeError(opts ...ErrorOption) *ApiError {
×
1398
        eopts := parseOpts(opts)
×
1399
        if ae, ok := eopts.err.(*ApiError); ok {
×
1400
                return ae
×
1401
        }
×
1402

1403
        return ApiErrors[JSConsumerMaxWaitingNegativeErr]
×
1404
}
1405

1406
// NewJSConsumerMetadataLengthError creates a new JSConsumerMetadataLengthErrF error: "consumer metadata exceeds maximum size of {limit}"
1407
func NewJSConsumerMetadataLengthError(limit interface{}, opts ...ErrorOption) *ApiError {
1✔
1408
        eopts := parseOpts(opts)
1✔
1409
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1410
                return ae
×
1411
        }
×
1412

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

1422
// NewJSConsumerMultipleFiltersNotAllowedError creates a new JSConsumerMultipleFiltersNotAllowed error: "consumer with multiple subject filters cannot use subject based API"
1423
func NewJSConsumerMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
1424
        eopts := parseOpts(opts)
1✔
1425
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1426
                return ae
×
1427
        }
×
1428

1429
        return ApiErrors[JSConsumerMultipleFiltersNotAllowed]
1✔
1430
}
1431

1432
// NewJSConsumerNameContainsPathSeparatorsError creates a new JSConsumerNameContainsPathSeparatorsErr error: "Consumer name can not contain path separators"
1433
func NewJSConsumerNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
8✔
1434
        eopts := parseOpts(opts)
8✔
1435
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1436
                return ae
×
1437
        }
×
1438

1439
        return ApiErrors[JSConsumerNameContainsPathSeparatorsErr]
8✔
1440
}
1441

1442
// NewJSConsumerNameExistError creates a new JSConsumerNameExistErr error: "consumer name already in use"
1443
func NewJSConsumerNameExistError(opts ...ErrorOption) *ApiError {
×
1444
        eopts := parseOpts(opts)
×
1445
        if ae, ok := eopts.err.(*ApiError); ok {
×
1446
                return ae
×
1447
        }
×
1448

1449
        return ApiErrors[JSConsumerNameExistErr]
×
1450
}
1451

1452
// NewJSConsumerNameTooLongError creates a new JSConsumerNameTooLongErrF error: "consumer name is too long, maximum allowed is {max}"
1453
func NewJSConsumerNameTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
×
1454
        eopts := parseOpts(opts)
×
1455
        if ae, ok := eopts.err.(*ApiError); ok {
×
1456
                return ae
×
1457
        }
×
1458

1459
        e := ApiErrors[JSConsumerNameTooLongErrF]
×
1460
        args := e.toReplacerArgs([]interface{}{"{max}", max})
×
1461
        return &ApiError{
×
1462
                Code:        e.Code,
×
1463
                ErrCode:     e.ErrCode,
×
1464
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1465
        }
×
1466
}
1467

1468
// NewJSConsumerNotFoundError creates a new JSConsumerNotFoundErr error: "consumer not found"
1469
func NewJSConsumerNotFoundError(opts ...ErrorOption) *ApiError {
2,752✔
1470
        eopts := parseOpts(opts)
2,752✔
1471
        if ae, ok := eopts.err.(*ApiError); ok {
2,752✔
1472
                return ae
×
1473
        }
×
1474

1475
        return ApiErrors[JSConsumerNotFoundErr]
2,752✔
1476
}
1477

1478
// NewJSConsumerOfflineError creates a new JSConsumerOfflineErr error: "consumer is offline"
1479
func NewJSConsumerOfflineError(opts ...ErrorOption) *ApiError {
6✔
1480
        eopts := parseOpts(opts)
6✔
1481
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1482
                return ae
×
1483
        }
×
1484

1485
        return ApiErrors[JSConsumerOfflineErr]
6✔
1486
}
1487

1488
// NewJSConsumerOnMappedError creates a new JSConsumerOnMappedErr error: "consumer direct on a mapped consumer"
1489
func NewJSConsumerOnMappedError(opts ...ErrorOption) *ApiError {
×
1490
        eopts := parseOpts(opts)
×
1491
        if ae, ok := eopts.err.(*ApiError); ok {
×
1492
                return ae
×
1493
        }
×
1494

1495
        return ApiErrors[JSConsumerOnMappedErr]
×
1496
}
1497

1498
// NewJSConsumerOverlappingSubjectFiltersError creates a new JSConsumerOverlappingSubjectFilters error: "consumer subject filters cannot overlap"
1499
func NewJSConsumerOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
1✔
1500
        eopts := parseOpts(opts)
1✔
1501
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1502
                return ae
×
1503
        }
×
1504

1505
        return ApiErrors[JSConsumerOverlappingSubjectFilters]
1✔
1506
}
1507

1508
// NewJSConsumerPriorityPolicyWithoutGroupError creates a new JSConsumerPriorityPolicyWithoutGroup error: "Setting PriorityPolicy requires at least one PriorityGroup to be set"
1509
func NewJSConsumerPriorityPolicyWithoutGroupError(opts ...ErrorOption) *ApiError {
4✔
1510
        eopts := parseOpts(opts)
4✔
1511
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1512
                return ae
×
1513
        }
×
1514

1515
        return ApiErrors[JSConsumerPriorityPolicyWithoutGroup]
4✔
1516
}
1517

1518
// NewJSConsumerPullNotDurableError creates a new JSConsumerPullNotDurableErr error: "consumer in pull mode requires a durable name"
1519
func NewJSConsumerPullNotDurableError(opts ...ErrorOption) *ApiError {
×
1520
        eopts := parseOpts(opts)
×
1521
        if ae, ok := eopts.err.(*ApiError); ok {
×
1522
                return ae
×
1523
        }
×
1524

1525
        return ApiErrors[JSConsumerPullNotDurableErr]
×
1526
}
1527

1528
// NewJSConsumerPullRequiresAckError creates a new JSConsumerPullRequiresAckErr error: "consumer in pull mode requires explicit ack policy on workqueue stream"
1529
func NewJSConsumerPullRequiresAckError(opts ...ErrorOption) *ApiError {
6✔
1530
        eopts := parseOpts(opts)
6✔
1531
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1532
                return ae
×
1533
        }
×
1534

1535
        return ApiErrors[JSConsumerPullRequiresAckErr]
6✔
1536
}
1537

1538
// NewJSConsumerPullWithRateLimitError creates a new JSConsumerPullWithRateLimitErr error: "consumer in pull mode can not have rate limit set"
1539
func NewJSConsumerPullWithRateLimitError(opts ...ErrorOption) *ApiError {
1✔
1540
        eopts := parseOpts(opts)
1✔
1541
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1542
                return ae
×
1543
        }
×
1544

1545
        return ApiErrors[JSConsumerPullWithRateLimitErr]
1✔
1546
}
1547

1548
// NewJSConsumerPushMaxWaitingError creates a new JSConsumerPushMaxWaitingErr error: "consumer in push mode can not set max waiting"
1549
func NewJSConsumerPushMaxWaitingError(opts ...ErrorOption) *ApiError {
3✔
1550
        eopts := parseOpts(opts)
3✔
1551
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1552
                return ae
×
1553
        }
×
1554

1555
        return ApiErrors[JSConsumerPushMaxWaitingErr]
3✔
1556
}
1557

1558
// NewJSConsumerPushWithPriorityGroupError creates a new JSConsumerPushWithPriorityGroupErr error: "priority groups can not be used with push consumers"
1559
func NewJSConsumerPushWithPriorityGroupError(opts ...ErrorOption) *ApiError {
1✔
1560
        eopts := parseOpts(opts)
1✔
1561
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1562
                return ae
×
1563
        }
×
1564

1565
        return ApiErrors[JSConsumerPushWithPriorityGroupErr]
1✔
1566
}
1567

1568
// NewJSConsumerReplacementWithDifferentNameError creates a new JSConsumerReplacementWithDifferentNameErr error: "consumer replacement durable config not the same"
1569
func NewJSConsumerReplacementWithDifferentNameError(opts ...ErrorOption) *ApiError {
×
1570
        eopts := parseOpts(opts)
×
1571
        if ae, ok := eopts.err.(*ApiError); ok {
×
1572
                return ae
×
1573
        }
×
1574

1575
        return ApiErrors[JSConsumerReplacementWithDifferentNameErr]
×
1576
}
1577

1578
// NewJSConsumerReplayPolicyInvalidError creates a new JSConsumerReplayPolicyInvalidErr error: "consumer replay policy invalid"
1579
func NewJSConsumerReplayPolicyInvalidError(opts ...ErrorOption) *ApiError {
2✔
1580
        eopts := parseOpts(opts)
2✔
1581
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1582
                return ae
×
1583
        }
×
1584

1585
        return ApiErrors[JSConsumerReplayPolicyInvalidErr]
2✔
1586
}
1587

1588
// NewJSConsumerReplicasExceedsStreamError creates a new JSConsumerReplicasExceedsStream error: "consumer config replica count exceeds parent stream"
1589
func NewJSConsumerReplicasExceedsStreamError(opts ...ErrorOption) *ApiError {
1✔
1590
        eopts := parseOpts(opts)
1✔
1591
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1592
                return ae
×
1593
        }
×
1594

1595
        return ApiErrors[JSConsumerReplicasExceedsStream]
1✔
1596
}
1597

1598
// NewJSConsumerReplicasShouldMatchStreamError creates a new JSConsumerReplicasShouldMatchStream error: "consumer config replicas must match interest retention stream's replicas"
1599
func NewJSConsumerReplicasShouldMatchStreamError(opts ...ErrorOption) *ApiError {
2✔
1600
        eopts := parseOpts(opts)
2✔
1601
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1602
                return ae
×
1603
        }
×
1604

1605
        return ApiErrors[JSConsumerReplicasShouldMatchStream]
2✔
1606
}
1607

1608
// NewJSConsumerSmallHeartbeatError creates a new JSConsumerSmallHeartbeatErr error: "consumer idle heartbeat needs to be >= 100ms"
1609
func NewJSConsumerSmallHeartbeatError(opts ...ErrorOption) *ApiError {
1✔
1610
        eopts := parseOpts(opts)
1✔
1611
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1612
                return ae
×
1613
        }
×
1614

1615
        return ApiErrors[JSConsumerSmallHeartbeatErr]
1✔
1616
}
1617

1618
// NewJSConsumerStoreFailedError creates a new JSConsumerStoreFailedErrF error: "error creating store for consumer: {err}"
1619
func NewJSConsumerStoreFailedError(err error, opts ...ErrorOption) *ApiError {
36✔
1620
        eopts := parseOpts(opts)
36✔
1621
        if ae, ok := eopts.err.(*ApiError); ok {
36✔
1622
                return ae
×
1623
        }
×
1624

1625
        e := ApiErrors[JSConsumerStoreFailedErrF]
36✔
1626
        args := e.toReplacerArgs([]interface{}{"{err}", err})
36✔
1627
        return &ApiError{
36✔
1628
                Code:        e.Code,
36✔
1629
                ErrCode:     e.ErrCode,
36✔
1630
                Description: strings.NewReplacer(args...).Replace(e.Description),
36✔
1631
        }
36✔
1632
}
1633

1634
// NewJSConsumerWQConsumerNotDeliverAllError creates a new JSConsumerWQConsumerNotDeliverAllErr error: "consumer must be deliver all on workqueue stream"
1635
func NewJSConsumerWQConsumerNotDeliverAllError(opts ...ErrorOption) *ApiError {
×
1636
        eopts := parseOpts(opts)
×
1637
        if ae, ok := eopts.err.(*ApiError); ok {
×
1638
                return ae
×
1639
        }
×
1640

1641
        return ApiErrors[JSConsumerWQConsumerNotDeliverAllErr]
×
1642
}
1643

1644
// NewJSConsumerWQConsumerNotUniqueError creates a new JSConsumerWQConsumerNotUniqueErr error: "filtered consumer not unique on workqueue stream"
1645
func NewJSConsumerWQConsumerNotUniqueError(opts ...ErrorOption) *ApiError {
11✔
1646
        eopts := parseOpts(opts)
11✔
1647
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
1648
                return ae
×
1649
        }
×
1650

1651
        return ApiErrors[JSConsumerWQConsumerNotUniqueErr]
11✔
1652
}
1653

1654
// NewJSConsumerWQMultipleUnfilteredError creates a new JSConsumerWQMultipleUnfilteredErr error: "multiple non-filtered consumers not allowed on workqueue stream"
1655
func NewJSConsumerWQMultipleUnfilteredError(opts ...ErrorOption) *ApiError {
2✔
1656
        eopts := parseOpts(opts)
2✔
1657
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1658
                return ae
×
1659
        }
×
1660

1661
        return ApiErrors[JSConsumerWQMultipleUnfilteredErr]
2✔
1662
}
1663

1664
// NewJSConsumerWQRequiresExplicitAckError creates a new JSConsumerWQRequiresExplicitAckErr error: "workqueue stream requires explicit ack"
1665
func NewJSConsumerWQRequiresExplicitAckError(opts ...ErrorOption) *ApiError {
×
1666
        eopts := parseOpts(opts)
×
1667
        if ae, ok := eopts.err.(*ApiError); ok {
×
1668
                return ae
×
1669
        }
×
1670

1671
        return ApiErrors[JSConsumerWQRequiresExplicitAckErr]
×
1672
}
1673

1674
// NewJSConsumerWithFlowControlNeedsHeartbeatsError creates a new JSConsumerWithFlowControlNeedsHeartbeats error: "consumer with flow control also needs heartbeats"
1675
func NewJSConsumerWithFlowControlNeedsHeartbeatsError(opts ...ErrorOption) *ApiError {
4✔
1676
        eopts := parseOpts(opts)
4✔
1677
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1678
                return ae
×
1679
        }
×
1680

1681
        return ApiErrors[JSConsumerWithFlowControlNeedsHeartbeats]
4✔
1682
}
1683

1684
// NewJSInsufficientResourcesError creates a new JSInsufficientResourcesErr error: "insufficient resources"
1685
func NewJSInsufficientResourcesError(opts ...ErrorOption) *ApiError {
10✔
1686
        eopts := parseOpts(opts)
10✔
1687
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1688
                return ae
×
1689
        }
×
1690

1691
        return ApiErrors[JSInsufficientResourcesErr]
10✔
1692
}
1693

1694
// NewJSInvalidJSONError creates a new JSInvalidJSONErr error: "invalid JSON: {err}"
1695
func NewJSInvalidJSONError(err error, opts ...ErrorOption) *ApiError {
10✔
1696
        eopts := parseOpts(opts)
10✔
1697
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1698
                return ae
×
1699
        }
×
1700

1701
        e := ApiErrors[JSInvalidJSONErr]
10✔
1702
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1703
        return &ApiError{
10✔
1704
                Code:        e.Code,
10✔
1705
                ErrCode:     e.ErrCode,
10✔
1706
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1707
        }
10✔
1708
}
1709

1710
// NewJSMaximumConsumersLimitError creates a new JSMaximumConsumersLimitErr error: "maximum consumers limit reached"
1711
func NewJSMaximumConsumersLimitError(opts ...ErrorOption) *ApiError {
29✔
1712
        eopts := parseOpts(opts)
29✔
1713
        if ae, ok := eopts.err.(*ApiError); ok {
29✔
1714
                return ae
×
1715
        }
×
1716

1717
        return ApiErrors[JSMaximumConsumersLimitErr]
29✔
1718
}
1719

1720
// NewJSMaximumStreamsLimitError creates a new JSMaximumStreamsLimitErr error: "maximum number of streams reached"
1721
func NewJSMaximumStreamsLimitError(opts ...ErrorOption) *ApiError {
16✔
1722
        eopts := parseOpts(opts)
16✔
1723
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
1724
                return ae
×
1725
        }
×
1726

1727
        return ApiErrors[JSMaximumStreamsLimitErr]
16✔
1728
}
1729

1730
// NewJSMemoryResourcesExceededError creates a new JSMemoryResourcesExceededErr error: "insufficient memory resources available"
1731
func NewJSMemoryResourcesExceededError(opts ...ErrorOption) *ApiError {
4✔
1732
        eopts := parseOpts(opts)
4✔
1733
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1734
                return ae
×
1735
        }
×
1736

1737
        return ApiErrors[JSMemoryResourcesExceededErr]
4✔
1738
}
1739

1740
// NewJSMessageCounterBrokenError creates a new JSMessageCounterBrokenErr error: "message counter is broken"
1741
func NewJSMessageCounterBrokenError(opts ...ErrorOption) *ApiError {
4✔
1742
        eopts := parseOpts(opts)
4✔
1743
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1744
                return ae
×
1745
        }
×
1746

1747
        return ApiErrors[JSMessageCounterBrokenErr]
4✔
1748
}
1749

1750
// NewJSMessageIncrDisabledError creates a new JSMessageIncrDisabledErr error: "message counters is disabled"
1751
func NewJSMessageIncrDisabledError(opts ...ErrorOption) *ApiError {
4✔
1752
        eopts := parseOpts(opts)
4✔
1753
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1754
                return ae
×
1755
        }
×
1756

1757
        return ApiErrors[JSMessageIncrDisabledErr]
4✔
1758
}
1759

1760
// NewJSMessageIncrInvalidError creates a new JSMessageIncrInvalidErr error: "message counter increment is invalid"
1761
func NewJSMessageIncrInvalidError(opts ...ErrorOption) *ApiError {
24✔
1762
        eopts := parseOpts(opts)
24✔
1763
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
1764
                return ae
×
1765
        }
×
1766

1767
        return ApiErrors[JSMessageIncrInvalidErr]
24✔
1768
}
1769

1770
// NewJSMessageIncrMissingError creates a new JSMessageIncrMissingErr error: "message counter increment is missing"
1771
func NewJSMessageIncrMissingError(opts ...ErrorOption) *ApiError {
8✔
1772
        eopts := parseOpts(opts)
8✔
1773
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1774
                return ae
×
1775
        }
×
1776

1777
        return ApiErrors[JSMessageIncrMissingErr]
8✔
1778
}
1779

1780
// NewJSMessageIncrPayloadError creates a new JSMessageIncrPayloadErr error: "message counter has payload"
1781
func NewJSMessageIncrPayloadError(opts ...ErrorOption) *ApiError {
4✔
1782
        eopts := parseOpts(opts)
4✔
1783
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1784
                return ae
×
1785
        }
×
1786

1787
        return ApiErrors[JSMessageIncrPayloadErr]
4✔
1788
}
1789

1790
// NewJSMessageTTLDisabledError creates a new JSMessageTTLDisabledErr error: "per-message TTL is disabled"
1791
func NewJSMessageTTLDisabledError(opts ...ErrorOption) *ApiError {
7✔
1792
        eopts := parseOpts(opts)
7✔
1793
        if ae, ok := eopts.err.(*ApiError); ok {
7✔
1794
                return ae
×
1795
        }
×
1796

1797
        return ApiErrors[JSMessageTTLDisabledErr]
7✔
1798
}
1799

1800
// NewJSMessageTTLInvalidError creates a new JSMessageTTLInvalidErr error: "invalid per-message TTL"
1801
func NewJSMessageTTLInvalidError(opts ...ErrorOption) *ApiError {
18✔
1802
        eopts := parseOpts(opts)
18✔
1803
        if ae, ok := eopts.err.(*ApiError); ok {
18✔
1804
                return ae
×
1805
        }
×
1806

1807
        return ApiErrors[JSMessageTTLInvalidErr]
18✔
1808
}
1809

1810
// NewJSMirrorConsumerSetupFailedError creates a new JSMirrorConsumerSetupFailedErrF error: "{err}"
1811
func NewJSMirrorConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
1812
        eopts := parseOpts(opts)
×
1813
        if ae, ok := eopts.err.(*ApiError); ok {
×
1814
                return ae
×
1815
        }
×
1816

1817
        e := ApiErrors[JSMirrorConsumerSetupFailedErrF]
×
1818
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1819
        return &ApiError{
×
1820
                Code:        e.Code,
×
1821
                ErrCode:     e.ErrCode,
×
1822
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1823
        }
×
1824
}
1825

1826
// NewJSMirrorInvalidStreamNameError creates a new JSMirrorInvalidStreamName error: "mirrored stream name is invalid"
1827
func NewJSMirrorInvalidStreamNameError(opts ...ErrorOption) *ApiError {
×
1828
        eopts := parseOpts(opts)
×
1829
        if ae, ok := eopts.err.(*ApiError); ok {
×
1830
                return ae
×
1831
        }
×
1832

1833
        return ApiErrors[JSMirrorInvalidStreamName]
×
1834
}
1835

1836
// NewJSMirrorInvalidSubjectFilterError creates a new JSMirrorInvalidSubjectFilter error: "mirror transform source: {err}"
1837
func NewJSMirrorInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
2✔
1838
        eopts := parseOpts(opts)
2✔
1839
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1840
                return ae
×
1841
        }
×
1842

1843
        e := ApiErrors[JSMirrorInvalidSubjectFilter]
2✔
1844
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2✔
1845
        return &ApiError{
2✔
1846
                Code:        e.Code,
2✔
1847
                ErrCode:     e.ErrCode,
2✔
1848
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1849
        }
2✔
1850
}
1851

1852
// NewJSMirrorInvalidTransformDestinationError creates a new JSMirrorInvalidTransformDestination error: "mirror transform: {err}"
1853
func NewJSMirrorInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
2✔
1854
        eopts := parseOpts(opts)
2✔
1855
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1856
                return ae
×
1857
        }
×
1858

1859
        e := ApiErrors[JSMirrorInvalidTransformDestination]
2✔
1860
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2✔
1861
        return &ApiError{
2✔
1862
                Code:        e.Code,
2✔
1863
                ErrCode:     e.ErrCode,
2✔
1864
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1865
        }
2✔
1866
}
1867

1868
// NewJSMirrorMaxMessageSizeTooBigError creates a new JSMirrorMaxMessageSizeTooBigErr error: "stream mirror must have max message size >= source"
1869
func NewJSMirrorMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
1870
        eopts := parseOpts(opts)
×
1871
        if ae, ok := eopts.err.(*ApiError); ok {
×
1872
                return ae
×
1873
        }
×
1874

1875
        return ApiErrors[JSMirrorMaxMessageSizeTooBigErr]
×
1876
}
1877

1878
// NewJSMirrorMultipleFiltersNotAllowedError creates a new JSMirrorMultipleFiltersNotAllowed error: "mirror with multiple subject transforms cannot also have a single subject filter"
1879
func NewJSMirrorMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
1880
        eopts := parseOpts(opts)
1✔
1881
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1882
                return ae
×
1883
        }
×
1884

1885
        return ApiErrors[JSMirrorMultipleFiltersNotAllowed]
1✔
1886
}
1887

1888
// NewJSMirrorOverlappingSubjectFiltersError creates a new JSMirrorOverlappingSubjectFilters error: "mirror subject filters can not overlap"
1889
func NewJSMirrorOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
2✔
1890
        eopts := parseOpts(opts)
2✔
1891
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1892
                return ae
×
1893
        }
×
1894

1895
        return ApiErrors[JSMirrorOverlappingSubjectFilters]
2✔
1896
}
1897

1898
// NewJSMirrorWithCountersError creates a new JSMirrorWithCountersErr error: "stream mirrors can not also calculate counters"
1899
func NewJSMirrorWithCountersError(opts ...ErrorOption) *ApiError {
4✔
1900
        eopts := parseOpts(opts)
4✔
1901
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1902
                return ae
×
1903
        }
×
1904

1905
        return ApiErrors[JSMirrorWithCountersErr]
4✔
1906
}
1907

1908
// NewJSMirrorWithFirstSeqError creates a new JSMirrorWithFirstSeqErr error: "stream mirrors can not have first sequence configured"
1909
func NewJSMirrorWithFirstSeqError(opts ...ErrorOption) *ApiError {
2✔
1910
        eopts := parseOpts(opts)
2✔
1911
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1912
                return ae
×
1913
        }
×
1914

1915
        return ApiErrors[JSMirrorWithFirstSeqErr]
2✔
1916
}
1917

1918
// NewJSMirrorWithSourcesError creates a new JSMirrorWithSourcesErr error: "stream mirrors can not also contain other sources"
1919
func NewJSMirrorWithSourcesError(opts ...ErrorOption) *ApiError {
×
1920
        eopts := parseOpts(opts)
×
1921
        if ae, ok := eopts.err.(*ApiError); ok {
×
1922
                return ae
×
1923
        }
×
1924

1925
        return ApiErrors[JSMirrorWithSourcesErr]
×
1926
}
1927

1928
// NewJSMirrorWithStartSeqAndTimeError creates a new JSMirrorWithStartSeqAndTimeErr error: "stream mirrors can not have both start seq and start time configured"
1929
func NewJSMirrorWithStartSeqAndTimeError(opts ...ErrorOption) *ApiError {
×
1930
        eopts := parseOpts(opts)
×
1931
        if ae, ok := eopts.err.(*ApiError); ok {
×
1932
                return ae
×
1933
        }
×
1934

1935
        return ApiErrors[JSMirrorWithStartSeqAndTimeErr]
×
1936
}
1937

1938
// NewJSMirrorWithSubjectFiltersError creates a new JSMirrorWithSubjectFiltersErr error: "stream mirrors can not contain filtered subjects"
1939
func NewJSMirrorWithSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
1940
        eopts := parseOpts(opts)
×
1941
        if ae, ok := eopts.err.(*ApiError); ok {
×
1942
                return ae
×
1943
        }
×
1944

1945
        return ApiErrors[JSMirrorWithSubjectFiltersErr]
×
1946
}
1947

1948
// NewJSMirrorWithSubjectsError creates a new JSMirrorWithSubjectsErr error: "stream mirrors can not contain subjects"
1949
func NewJSMirrorWithSubjectsError(opts ...ErrorOption) *ApiError {
2✔
1950
        eopts := parseOpts(opts)
2✔
1951
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1952
                return ae
×
1953
        }
×
1954

1955
        return ApiErrors[JSMirrorWithSubjectsErr]
2✔
1956
}
1957

1958
// NewJSNoAccountError creates a new JSNoAccountErr error: "account not found"
1959
func NewJSNoAccountError(opts ...ErrorOption) *ApiError {
1✔
1960
        eopts := parseOpts(opts)
1✔
1961
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1962
                return ae
×
1963
        }
×
1964

1965
        return ApiErrors[JSNoAccountErr]
1✔
1966
}
1967

1968
// NewJSNoLimitsError creates a new JSNoLimitsErr error: "no JetStream default or applicable tiered limit present"
1969
func NewJSNoLimitsError(opts ...ErrorOption) *ApiError {
4✔
1970
        eopts := parseOpts(opts)
4✔
1971
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1972
                return ae
×
1973
        }
×
1974

1975
        return ApiErrors[JSNoLimitsErr]
4✔
1976
}
1977

1978
// NewJSNoMessageFoundError creates a new JSNoMessageFoundErr error: "no message found"
1979
func NewJSNoMessageFoundError(opts ...ErrorOption) *ApiError {
460✔
1980
        eopts := parseOpts(opts)
460✔
1981
        if ae, ok := eopts.err.(*ApiError); ok {
460✔
1982
                return ae
×
1983
        }
×
1984

1985
        return ApiErrors[JSNoMessageFoundErr]
460✔
1986
}
1987

1988
// NewJSNotEmptyRequestError creates a new JSNotEmptyRequestErr error: "expected an empty request payload"
1989
func NewJSNotEmptyRequestError(opts ...ErrorOption) *ApiError {
3✔
1990
        eopts := parseOpts(opts)
3✔
1991
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1992
                return ae
×
1993
        }
×
1994

1995
        return ApiErrors[JSNotEmptyRequestErr]
3✔
1996
}
1997

1998
// NewJSNotEnabledError creates a new JSNotEnabledErr error: "JetStream not enabled"
1999
func NewJSNotEnabledError(opts ...ErrorOption) *ApiError {
10✔
2000
        eopts := parseOpts(opts)
10✔
2001
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2002
                return ae
×
2003
        }
×
2004

2005
        return ApiErrors[JSNotEnabledErr]
10✔
2006
}
2007

2008
// NewJSNotEnabledForAccountError creates a new JSNotEnabledForAccountErr error: "JetStream not enabled for account"
2009
func NewJSNotEnabledForAccountError(opts ...ErrorOption) *ApiError {
329✔
2010
        eopts := parseOpts(opts)
329✔
2011
        if ae, ok := eopts.err.(*ApiError); ok {
329✔
2012
                return ae
×
2013
        }
×
2014

2015
        return ApiErrors[JSNotEnabledForAccountErr]
329✔
2016
}
2017

2018
// NewJSPedanticError creates a new JSPedanticErrF error: "pedantic mode: {err}"
2019
func NewJSPedanticError(err error, opts ...ErrorOption) *ApiError {
40✔
2020
        eopts := parseOpts(opts)
40✔
2021
        if ae, ok := eopts.err.(*ApiError); ok {
40✔
2022
                return ae
×
2023
        }
×
2024

2025
        e := ApiErrors[JSPedanticErrF]
40✔
2026
        args := e.toReplacerArgs([]interface{}{"{err}", err})
40✔
2027
        return &ApiError{
40✔
2028
                Code:        e.Code,
40✔
2029
                ErrCode:     e.ErrCode,
40✔
2030
                Description: strings.NewReplacer(args...).Replace(e.Description),
40✔
2031
        }
40✔
2032
}
2033

2034
// NewJSPeerRemapError creates a new JSPeerRemapErr error: "peer remap failed"
2035
func NewJSPeerRemapError(opts ...ErrorOption) *ApiError {
5✔
2036
        eopts := parseOpts(opts)
5✔
2037
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2038
                return ae
1✔
2039
        }
1✔
2040

2041
        return ApiErrors[JSPeerRemapErr]
4✔
2042
}
2043

2044
// NewJSRaftGeneralError creates a new JSRaftGeneralErrF error: "{err}"
2045
func NewJSRaftGeneralError(err error, opts ...ErrorOption) *ApiError {
×
2046
        eopts := parseOpts(opts)
×
2047
        if ae, ok := eopts.err.(*ApiError); ok {
×
2048
                return ae
×
2049
        }
×
2050

2051
        e := ApiErrors[JSRaftGeneralErrF]
×
2052
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2053
        return &ApiError{
×
2054
                Code:        e.Code,
×
2055
                ErrCode:     e.ErrCode,
×
2056
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2057
        }
×
2058
}
2059

2060
// NewJSReplicasCountCannotBeNegativeError creates a new JSReplicasCountCannotBeNegative error: "replicas count cannot be negative"
2061
func NewJSReplicasCountCannotBeNegativeError(opts ...ErrorOption) *ApiError {
16✔
2062
        eopts := parseOpts(opts)
16✔
2063
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2064
                return ae
×
2065
        }
×
2066

2067
        return ApiErrors[JSReplicasCountCannotBeNegative]
16✔
2068
}
2069

2070
// NewJSRequiredApiLevelError creates a new JSRequiredApiLevelErr error: "JetStream minimum api level required"
2071
func NewJSRequiredApiLevelError(opts ...ErrorOption) *ApiError {
56✔
2072
        eopts := parseOpts(opts)
56✔
2073
        if ae, ok := eopts.err.(*ApiError); ok {
56✔
2074
                return ae
×
2075
        }
×
2076

2077
        return ApiErrors[JSRequiredApiLevelErr]
56✔
2078
}
2079

2080
// NewJSRestoreSubscribeFailedError creates a new JSRestoreSubscribeFailedErrF error: "JetStream unable to subscribe to restore snapshot {subject}: {err}"
2081
func NewJSRestoreSubscribeFailedError(err error, subject interface{}, opts ...ErrorOption) *ApiError {
1✔
2082
        eopts := parseOpts(opts)
1✔
2083
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2084
                return ae
×
2085
        }
×
2086

2087
        e := ApiErrors[JSRestoreSubscribeFailedErrF]
1✔
2088
        args := e.toReplacerArgs([]interface{}{"{err}", err, "{subject}", subject})
1✔
2089
        return &ApiError{
1✔
2090
                Code:        e.Code,
1✔
2091
                ErrCode:     e.ErrCode,
1✔
2092
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2093
        }
1✔
2094
}
2095

2096
// NewJSSequenceNotFoundError creates a new JSSequenceNotFoundErrF error: "sequence {seq} not found"
2097
func NewJSSequenceNotFoundError(seq uint64, opts ...ErrorOption) *ApiError {
×
2098
        eopts := parseOpts(opts)
×
2099
        if ae, ok := eopts.err.(*ApiError); ok {
×
2100
                return ae
×
2101
        }
×
2102

2103
        e := ApiErrors[JSSequenceNotFoundErrF]
×
2104
        args := e.toReplacerArgs([]interface{}{"{seq}", seq})
×
2105
        return &ApiError{
×
2106
                Code:        e.Code,
×
2107
                ErrCode:     e.ErrCode,
×
2108
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2109
        }
×
2110
}
2111

2112
// NewJSSnapshotDeliverSubjectInvalidError creates a new JSSnapshotDeliverSubjectInvalidErr error: "deliver subject not valid"
2113
func NewJSSnapshotDeliverSubjectInvalidError(opts ...ErrorOption) *ApiError {
1✔
2114
        eopts := parseOpts(opts)
1✔
2115
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2116
                return ae
×
2117
        }
×
2118

2119
        return ApiErrors[JSSnapshotDeliverSubjectInvalidErr]
1✔
2120
}
2121

2122
// NewJSSourceConsumerSetupFailedError creates a new JSSourceConsumerSetupFailedErrF error: "{err}"
2123
func NewJSSourceConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
2124
        eopts := parseOpts(opts)
×
2125
        if ae, ok := eopts.err.(*ApiError); ok {
×
2126
                return ae
×
2127
        }
×
2128

2129
        e := ApiErrors[JSSourceConsumerSetupFailedErrF]
×
2130
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2131
        return &ApiError{
×
2132
                Code:        e.Code,
×
2133
                ErrCode:     e.ErrCode,
×
2134
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2135
        }
×
2136
}
2137

2138
// NewJSSourceDuplicateDetectedError creates a new JSSourceDuplicateDetected error: "duplicate source configuration detected"
2139
func NewJSSourceDuplicateDetectedError(opts ...ErrorOption) *ApiError {
×
2140
        eopts := parseOpts(opts)
×
2141
        if ae, ok := eopts.err.(*ApiError); ok {
×
2142
                return ae
×
2143
        }
×
2144

2145
        return ApiErrors[JSSourceDuplicateDetected]
×
2146
}
2147

2148
// NewJSSourceInvalidStreamNameError creates a new JSSourceInvalidStreamName error: "sourced stream name is invalid"
2149
func NewJSSourceInvalidStreamNameError(opts ...ErrorOption) *ApiError {
1✔
2150
        eopts := parseOpts(opts)
1✔
2151
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2152
                return ae
×
2153
        }
×
2154

2155
        return ApiErrors[JSSourceInvalidStreamName]
1✔
2156
}
2157

2158
// NewJSSourceInvalidSubjectFilterError creates a new JSSourceInvalidSubjectFilter error: "source transform source: {err}"
2159
func NewJSSourceInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
1✔
2160
        eopts := parseOpts(opts)
1✔
2161
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2162
                return ae
×
2163
        }
×
2164

2165
        e := ApiErrors[JSSourceInvalidSubjectFilter]
1✔
2166
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2167
        return &ApiError{
1✔
2168
                Code:        e.Code,
1✔
2169
                ErrCode:     e.ErrCode,
1✔
2170
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2171
        }
1✔
2172
}
2173

2174
// NewJSSourceInvalidTransformDestinationError creates a new JSSourceInvalidTransformDestination error: "source transform: {err}"
2175
func NewJSSourceInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
2176
        eopts := parseOpts(opts)
1✔
2177
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2178
                return ae
×
2179
        }
×
2180

2181
        e := ApiErrors[JSSourceInvalidTransformDestination]
1✔
2182
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2183
        return &ApiError{
1✔
2184
                Code:        e.Code,
1✔
2185
                ErrCode:     e.ErrCode,
1✔
2186
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2187
        }
1✔
2188
}
2189

2190
// NewJSSourceMaxMessageSizeTooBigError creates a new JSSourceMaxMessageSizeTooBigErr error: "stream source must have max message size >= target"
2191
func NewJSSourceMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
2192
        eopts := parseOpts(opts)
×
2193
        if ae, ok := eopts.err.(*ApiError); ok {
×
2194
                return ae
×
2195
        }
×
2196

2197
        return ApiErrors[JSSourceMaxMessageSizeTooBigErr]
×
2198
}
2199

2200
// NewJSSourceMultipleFiltersNotAllowedError creates a new JSSourceMultipleFiltersNotAllowed error: "source with multiple subject transforms cannot also have a single subject filter"
2201
func NewJSSourceMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
×
2202
        eopts := parseOpts(opts)
×
2203
        if ae, ok := eopts.err.(*ApiError); ok {
×
2204
                return ae
×
2205
        }
×
2206

2207
        return ApiErrors[JSSourceMultipleFiltersNotAllowed]
×
2208
}
2209

2210
// NewJSSourceOverlappingSubjectFiltersError creates a new JSSourceOverlappingSubjectFilters error: "source filters can not overlap"
2211
func NewJSSourceOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
2212
        eopts := parseOpts(opts)
×
2213
        if ae, ok := eopts.err.(*ApiError); ok {
×
2214
                return ae
×
2215
        }
×
2216

2217
        return ApiErrors[JSSourceOverlappingSubjectFilters]
×
2218
}
2219

2220
// NewJSStorageResourcesExceededError creates a new JSStorageResourcesExceededErr error: "insufficient storage resources available"
2221
func NewJSStorageResourcesExceededError(opts ...ErrorOption) *ApiError {
25✔
2222
        eopts := parseOpts(opts)
25✔
2223
        if ae, ok := eopts.err.(*ApiError); ok {
25✔
2224
                return ae
×
2225
        }
×
2226

2227
        return ApiErrors[JSStorageResourcesExceededErr]
25✔
2228
}
2229

2230
// NewJSStreamAssignmentError creates a new JSStreamAssignmentErrF error: "{err}"
2231
func NewJSStreamAssignmentError(err error, opts ...ErrorOption) *ApiError {
×
2232
        eopts := parseOpts(opts)
×
2233
        if ae, ok := eopts.err.(*ApiError); ok {
×
2234
                return ae
×
2235
        }
×
2236

2237
        e := ApiErrors[JSStreamAssignmentErrF]
×
2238
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2239
        return &ApiError{
×
2240
                Code:        e.Code,
×
2241
                ErrCode:     e.ErrCode,
×
2242
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2243
        }
×
2244
}
2245

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

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

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

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

2278
// NewJSStreamDuplicateMessageConflictError creates a new JSStreamDuplicateMessageConflict error: "duplicate message id is in process"
2279
func NewJSStreamDuplicateMessageConflictError(opts ...ErrorOption) *ApiError {
74✔
2280
        eopts := parseOpts(opts)
74✔
2281
        if ae, ok := eopts.err.(*ApiError); ok {
74✔
2282
                return ae
×
2283
        }
×
2284

2285
        return ApiErrors[JSStreamDuplicateMessageConflict]
74✔
2286
}
2287

2288
// NewJSStreamExpectedLastSeqPerSubjectNotReadyError creates a new JSStreamExpectedLastSeqPerSubjectNotReady error: "expected last sequence per subject temporarily unavailable"
2289
func NewJSStreamExpectedLastSeqPerSubjectNotReadyError(opts ...ErrorOption) *ApiError {
×
2290
        eopts := parseOpts(opts)
×
2291
        if ae, ok := eopts.err.(*ApiError); ok {
×
2292
                return ae
×
2293
        }
×
2294

2295
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectNotReady]
×
2296
}
2297

2298
// NewJSStreamExternalApiOverlapError creates a new JSStreamExternalApiOverlapErrF error: "stream external api prefix {prefix} must not overlap with {subject}"
2299
func NewJSStreamExternalApiOverlapError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
2✔
2300
        eopts := parseOpts(opts)
2✔
2301
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2302
                return ae
×
2303
        }
×
2304

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

2314
// NewJSStreamExternalDelPrefixOverlapsError creates a new JSStreamExternalDelPrefixOverlapsErrF error: "stream external delivery prefix {prefix} overlaps with stream subject {subject}"
2315
func NewJSStreamExternalDelPrefixOverlapsError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
×
2316
        eopts := parseOpts(opts)
×
2317
        if ae, ok := eopts.err.(*ApiError); ok {
×
2318
                return ae
×
2319
        }
×
2320

2321
        e := ApiErrors[JSStreamExternalDelPrefixOverlapsErrF]
×
2322
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
×
2323
        return &ApiError{
×
2324
                Code:        e.Code,
×
2325
                ErrCode:     e.ErrCode,
×
2326
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2327
        }
×
2328
}
2329

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

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

2346
// NewJSStreamHeaderExceedsMaximumError creates a new JSStreamHeaderExceedsMaximumErr error: "header size exceeds maximum allowed of 64k"
2347
func NewJSStreamHeaderExceedsMaximumError(opts ...ErrorOption) *ApiError {
1✔
2348
        eopts := parseOpts(opts)
1✔
2349
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2350
                return ae
×
2351
        }
×
2352

2353
        return ApiErrors[JSStreamHeaderExceedsMaximumErr]
1✔
2354
}
2355

2356
// NewJSStreamInfoMaxSubjectsError creates a new JSStreamInfoMaxSubjectsErr error: "subject details would exceed maximum allowed"
2357
func NewJSStreamInfoMaxSubjectsError(opts ...ErrorOption) *ApiError {
×
2358
        eopts := parseOpts(opts)
×
2359
        if ae, ok := eopts.err.(*ApiError); ok {
×
2360
                return ae
×
2361
        }
×
2362

2363
        return ApiErrors[JSStreamInfoMaxSubjectsErr]
×
2364
}
2365

2366
// NewJSStreamInvalidConfigError creates a new JSStreamInvalidConfigF error: "{err}"
2367
func NewJSStreamInvalidConfigError(err error, opts ...ErrorOption) *ApiError {
147✔
2368
        eopts := parseOpts(opts)
147✔
2369
        if ae, ok := eopts.err.(*ApiError); ok {
170✔
2370
                return ae
23✔
2371
        }
23✔
2372

2373
        e := ApiErrors[JSStreamInvalidConfigF]
124✔
2374
        args := e.toReplacerArgs([]interface{}{"{err}", err})
124✔
2375
        return &ApiError{
124✔
2376
                Code:        e.Code,
124✔
2377
                ErrCode:     e.ErrCode,
124✔
2378
                Description: strings.NewReplacer(args...).Replace(e.Description),
124✔
2379
        }
124✔
2380
}
2381

2382
// NewJSStreamInvalidError creates a new JSStreamInvalidErr error: "stream not valid"
2383
func NewJSStreamInvalidError(opts ...ErrorOption) *ApiError {
×
2384
        eopts := parseOpts(opts)
×
2385
        if ae, ok := eopts.err.(*ApiError); ok {
×
2386
                return ae
×
2387
        }
×
2388

2389
        return ApiErrors[JSStreamInvalidErr]
×
2390
}
2391

2392
// NewJSStreamInvalidExternalDeliverySubjError creates a new JSStreamInvalidExternalDeliverySubjErrF error: "stream external delivery prefix {prefix} must not contain wildcards"
2393
func NewJSStreamInvalidExternalDeliverySubjError(prefix interface{}, opts ...ErrorOption) *ApiError {
×
2394
        eopts := parseOpts(opts)
×
2395
        if ae, ok := eopts.err.(*ApiError); ok {
×
2396
                return ae
×
2397
        }
×
2398

2399
        e := ApiErrors[JSStreamInvalidExternalDeliverySubjErrF]
×
2400
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix})
×
2401
        return &ApiError{
×
2402
                Code:        e.Code,
×
2403
                ErrCode:     e.ErrCode,
×
2404
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2405
        }
×
2406
}
2407

2408
// NewJSStreamLimitsError creates a new JSStreamLimitsErrF error: "{err}"
2409
func NewJSStreamLimitsError(err error, opts ...ErrorOption) *ApiError {
8✔
2410
        eopts := parseOpts(opts)
8✔
2411
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2412
                return ae
8✔
2413
        }
8✔
2414

2415
        e := ApiErrors[JSStreamLimitsErrF]
×
2416
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2417
        return &ApiError{
×
2418
                Code:        e.Code,
×
2419
                ErrCode:     e.ErrCode,
×
2420
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2421
        }
×
2422
}
2423

2424
// NewJSStreamMaxBytesRequiredError creates a new JSStreamMaxBytesRequired error: "account requires a stream config to have max bytes set"
2425
func NewJSStreamMaxBytesRequiredError(opts ...ErrorOption) *ApiError {
3✔
2426
        eopts := parseOpts(opts)
3✔
2427
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2428
                return ae
×
2429
        }
×
2430

2431
        return ApiErrors[JSStreamMaxBytesRequired]
3✔
2432
}
2433

2434
// NewJSStreamMaxStreamBytesExceededError creates a new JSStreamMaxStreamBytesExceeded error: "stream max bytes exceeds account limit max stream bytes"
2435
func NewJSStreamMaxStreamBytesExceededError(opts ...ErrorOption) *ApiError {
2✔
2436
        eopts := parseOpts(opts)
2✔
2437
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2438
                return ae
×
2439
        }
×
2440

2441
        return ApiErrors[JSStreamMaxStreamBytesExceeded]
2✔
2442
}
2443

2444
// NewJSStreamMessageExceedsMaximumError creates a new JSStreamMessageExceedsMaximumErr error: "message size exceeds maximum allowed"
2445
func NewJSStreamMessageExceedsMaximumError(opts ...ErrorOption) *ApiError {
19✔
2446
        eopts := parseOpts(opts)
19✔
2447
        if ae, ok := eopts.err.(*ApiError); ok {
19✔
2448
                return ae
×
2449
        }
×
2450

2451
        return ApiErrors[JSStreamMessageExceedsMaximumErr]
19✔
2452
}
2453

2454
// NewJSStreamMinLastSeqError creates a new JSStreamMinLastSeqErr error: "min last sequence"
2455
func NewJSStreamMinLastSeqError(opts ...ErrorOption) *ApiError {
×
2456
        eopts := parseOpts(opts)
×
2457
        if ae, ok := eopts.err.(*ApiError); ok {
×
2458
                return ae
×
2459
        }
×
2460

2461
        return ApiErrors[JSStreamMinLastSeqErr]
×
2462
}
2463

2464
// NewJSStreamMirrorNotUpdatableError creates a new JSStreamMirrorNotUpdatableErr error: "stream mirror configuration can not be updated"
2465
func NewJSStreamMirrorNotUpdatableError(opts ...ErrorOption) *ApiError {
4✔
2466
        eopts := parseOpts(opts)
4✔
2467
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2468
                return ae
×
2469
        }
×
2470

2471
        return ApiErrors[JSStreamMirrorNotUpdatableErr]
4✔
2472
}
2473

2474
// NewJSStreamMismatchError creates a new JSStreamMismatchErr error: "stream name in subject does not match request"
2475
func NewJSStreamMismatchError(opts ...ErrorOption) *ApiError {
3✔
2476
        eopts := parseOpts(opts)
3✔
2477
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2478
                return ae
×
2479
        }
×
2480

2481
        return ApiErrors[JSStreamMismatchErr]
3✔
2482
}
2483

2484
// NewJSStreamMoveAndScaleError creates a new JSStreamMoveAndScaleErr error: "can not move and scale a stream in a single update"
2485
func NewJSStreamMoveAndScaleError(opts ...ErrorOption) *ApiError {
4✔
2486
        eopts := parseOpts(opts)
4✔
2487
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2488
                return ae
×
2489
        }
×
2490

2491
        return ApiErrors[JSStreamMoveAndScaleErr]
4✔
2492
}
2493

2494
// NewJSStreamMoveInProgressError creates a new JSStreamMoveInProgressF error: "stream move already in progress: {msg}"
2495
func NewJSStreamMoveInProgressError(msg interface{}, opts ...ErrorOption) *ApiError {
2✔
2496
        eopts := parseOpts(opts)
2✔
2497
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2498
                return ae
×
2499
        }
×
2500

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

2510
// NewJSStreamMoveNotInProgressError creates a new JSStreamMoveNotInProgress error: "stream move not in progress"
2511
func NewJSStreamMoveNotInProgressError(opts ...ErrorOption) *ApiError {
×
2512
        eopts := parseOpts(opts)
×
2513
        if ae, ok := eopts.err.(*ApiError); ok {
×
2514
                return ae
×
2515
        }
×
2516

2517
        return ApiErrors[JSStreamMoveNotInProgress]
×
2518
}
2519

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

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

2536
// NewJSStreamNameContainsPathSeparatorsError creates a new JSStreamNameContainsPathSeparatorsErr error: "Stream name can not contain path separators"
2537
func NewJSStreamNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
6✔
2538
        eopts := parseOpts(opts)
6✔
2539
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2540
                return ae
×
2541
        }
×
2542

2543
        return ApiErrors[JSStreamNameContainsPathSeparatorsErr]
6✔
2544
}
2545

2546
// NewJSStreamNameExistError creates a new JSStreamNameExistErr error: "stream name already in use with a different configuration"
2547
func NewJSStreamNameExistError(opts ...ErrorOption) *ApiError {
×
2548
        eopts := parseOpts(opts)
×
2549
        if ae, ok := eopts.err.(*ApiError); ok {
×
2550
                return ae
×
2551
        }
×
2552

2553
        return ApiErrors[JSStreamNameExistErr]
×
2554
}
2555

2556
// NewJSStreamNameExistRestoreFailedError creates a new JSStreamNameExistRestoreFailedErr error: "stream name already in use, cannot restore"
2557
func NewJSStreamNameExistRestoreFailedError(opts ...ErrorOption) *ApiError {
3✔
2558
        eopts := parseOpts(opts)
3✔
2559
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2560
                return ae
×
2561
        }
×
2562

2563
        return ApiErrors[JSStreamNameExistRestoreFailedErr]
3✔
2564
}
2565

2566
// NewJSStreamNotFoundError creates a new JSStreamNotFoundErr error: "stream not found"
2567
func NewJSStreamNotFoundError(opts ...ErrorOption) *ApiError {
25,141✔
2568
        eopts := parseOpts(opts)
25,141✔
2569
        if ae, ok := eopts.err.(*ApiError); ok {
25,809✔
2570
                return ae
668✔
2571
        }
668✔
2572

2573
        return ApiErrors[JSStreamNotFoundErr]
24,473✔
2574
}
2575

2576
// NewJSStreamNotMatchError creates a new JSStreamNotMatchErr error: "expected stream does not match"
2577
func NewJSStreamNotMatchError(opts ...ErrorOption) *ApiError {
5✔
2578
        eopts := parseOpts(opts)
5✔
2579
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2580
                return ae
×
2581
        }
×
2582

2583
        return ApiErrors[JSStreamNotMatchErr]
5✔
2584
}
2585

2586
// NewJSStreamOfflineError creates a new JSStreamOfflineErr error: "stream is offline"
2587
func NewJSStreamOfflineError(opts ...ErrorOption) *ApiError {
6✔
2588
        eopts := parseOpts(opts)
6✔
2589
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2590
                return ae
×
2591
        }
×
2592

2593
        return ApiErrors[JSStreamOfflineErr]
6✔
2594
}
2595

2596
// NewJSStreamPurgeFailedError creates a new JSStreamPurgeFailedF error: "{err}"
2597
func NewJSStreamPurgeFailedError(err error, opts ...ErrorOption) *ApiError {
1✔
2598
        eopts := parseOpts(opts)
1✔
2599
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2600
                return ae
×
2601
        }
×
2602

2603
        e := ApiErrors[JSStreamPurgeFailedF]
1✔
2604
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2605
        return &ApiError{
1✔
2606
                Code:        e.Code,
1✔
2607
                ErrCode:     e.ErrCode,
1✔
2608
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2609
        }
1✔
2610
}
2611

2612
// NewJSStreamReplicasNotSupportedError creates a new JSStreamReplicasNotSupportedErr error: "replicas > 1 not supported in non-clustered mode"
2613
func NewJSStreamReplicasNotSupportedError(opts ...ErrorOption) *ApiError {
1✔
2614
        eopts := parseOpts(opts)
1✔
2615
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2616
                return ae
×
2617
        }
×
2618

2619
        return ApiErrors[JSStreamReplicasNotSupportedErr]
1✔
2620
}
2621

2622
// NewJSStreamReplicasNotUpdatableError creates a new JSStreamReplicasNotUpdatableErr error: "Replicas configuration can not be updated"
2623
func NewJSStreamReplicasNotUpdatableError(opts ...ErrorOption) *ApiError {
×
2624
        eopts := parseOpts(opts)
×
2625
        if ae, ok := eopts.err.(*ApiError); ok {
×
2626
                return ae
×
2627
        }
×
2628

2629
        return ApiErrors[JSStreamReplicasNotUpdatableErr]
×
2630
}
2631

2632
// NewJSStreamRestoreError creates a new JSStreamRestoreErrF error: "restore failed: {err}"
2633
func NewJSStreamRestoreError(err error, opts ...ErrorOption) *ApiError {
7✔
2634
        eopts := parseOpts(opts)
7✔
2635
        if ae, ok := eopts.err.(*ApiError); ok {
9✔
2636
                return ae
2✔
2637
        }
2✔
2638

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

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

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

2664
// NewJSStreamSealedError creates a new JSStreamSealedErr error: "invalid operation on sealed stream"
2665
func NewJSStreamSealedError(opts ...ErrorOption) *ApiError {
10✔
2666
        eopts := parseOpts(opts)
10✔
2667
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2668
                return ae
×
2669
        }
×
2670

2671
        return ApiErrors[JSStreamSealedErr]
10✔
2672
}
2673

2674
// NewJSStreamSequenceNotMatchError creates a new JSStreamSequenceNotMatchErr error: "expected stream sequence does not match"
2675
func NewJSStreamSequenceNotMatchError(opts ...ErrorOption) *ApiError {
×
2676
        eopts := parseOpts(opts)
×
2677
        if ae, ok := eopts.err.(*ApiError); ok {
×
2678
                return ae
×
2679
        }
×
2680

2681
        return ApiErrors[JSStreamSequenceNotMatchErr]
×
2682
}
2683

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

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

2700
// NewJSStreamStoreFailedError creates a new JSStreamStoreFailedF error: "{err}"
2701
func NewJSStreamStoreFailedError(err error, opts ...ErrorOption) *ApiError {
1,031✔
2702
        eopts := parseOpts(opts)
1,031✔
2703
        if ae, ok := eopts.err.(*ApiError); ok {
1,031✔
2704
                return ae
×
2705
        }
×
2706

2707
        e := ApiErrors[JSStreamStoreFailedF]
1,031✔
2708
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1,031✔
2709
        return &ApiError{
1,031✔
2710
                Code:        e.Code,
1,031✔
2711
                ErrCode:     e.ErrCode,
1,031✔
2712
                Description: strings.NewReplacer(args...).Replace(e.Description),
1,031✔
2713
        }
1,031✔
2714
}
2715

2716
// NewJSStreamSubjectOverlapError creates a new JSStreamSubjectOverlapErr error: "subjects overlap with an existing stream"
2717
func NewJSStreamSubjectOverlapError(opts ...ErrorOption) *ApiError {
31✔
2718
        eopts := parseOpts(opts)
31✔
2719
        if ae, ok := eopts.err.(*ApiError); ok {
31✔
2720
                return ae
×
2721
        }
×
2722

2723
        return ApiErrors[JSStreamSubjectOverlapErr]
31✔
2724
}
2725

2726
// NewJSStreamTemplateCreateError creates a new JSStreamTemplateCreateErrF error: "{err}"
2727
func NewJSStreamTemplateCreateError(err error, opts ...ErrorOption) *ApiError {
×
2728
        eopts := parseOpts(opts)
×
2729
        if ae, ok := eopts.err.(*ApiError); ok {
×
2730
                return ae
×
2731
        }
×
2732

2733
        e := ApiErrors[JSStreamTemplateCreateErrF]
×
2734
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2735
        return &ApiError{
×
2736
                Code:        e.Code,
×
2737
                ErrCode:     e.ErrCode,
×
2738
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2739
        }
×
2740
}
2741

2742
// NewJSStreamTemplateDeleteError creates a new JSStreamTemplateDeleteErrF error: "{err}"
2743
func NewJSStreamTemplateDeleteError(err error, opts ...ErrorOption) *ApiError {
1✔
2744
        eopts := parseOpts(opts)
1✔
2745
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2746
                return ae
1✔
2747
        }
1✔
2748

2749
        e := ApiErrors[JSStreamTemplateDeleteErrF]
×
2750
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2751
        return &ApiError{
×
2752
                Code:        e.Code,
×
2753
                ErrCode:     e.ErrCode,
×
2754
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2755
        }
×
2756
}
2757

2758
// NewJSStreamTemplateNotFoundError creates a new JSStreamTemplateNotFoundErr error: "template not found"
2759
func NewJSStreamTemplateNotFoundError(opts ...ErrorOption) *ApiError {
4✔
2760
        eopts := parseOpts(opts)
4✔
2761
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2762
                return ae
×
2763
        }
×
2764

2765
        return ApiErrors[JSStreamTemplateNotFoundErr]
4✔
2766
}
2767

2768
// NewJSStreamTooManyRequestsError creates a new JSStreamTooManyRequests error: "too many requests"
2769
func NewJSStreamTooManyRequestsError(opts ...ErrorOption) *ApiError {
216✔
2770
        eopts := parseOpts(opts)
216✔
2771
        if ae, ok := eopts.err.(*ApiError); ok {
216✔
2772
                return ae
×
2773
        }
×
2774

2775
        return ApiErrors[JSStreamTooManyRequests]
216✔
2776
}
2777

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

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

2794
// NewJSStreamTransformInvalidSourceError creates a new JSStreamTransformInvalidSource error: "stream transform source: {err}"
2795
func NewJSStreamTransformInvalidSourceError(err error, opts ...ErrorOption) *ApiError {
1✔
2796
        eopts := parseOpts(opts)
1✔
2797
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2798
                return ae
×
2799
        }
×
2800

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

2810
// NewJSStreamUpdateError creates a new JSStreamUpdateErrF error: "{err}"
2811
func NewJSStreamUpdateError(err error, opts ...ErrorOption) *ApiError {
23✔
2812
        eopts := parseOpts(opts)
23✔
2813
        if ae, ok := eopts.err.(*ApiError); ok {
40✔
2814
                return ae
17✔
2815
        }
17✔
2816

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

2826
// NewJSStreamWrongLastMsgIDError creates a new JSStreamWrongLastMsgIDErrF error: "wrong last msg ID: {id}"
2827
func NewJSStreamWrongLastMsgIDError(id interface{}, opts ...ErrorOption) *ApiError {
5✔
2828
        eopts := parseOpts(opts)
5✔
2829
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2830
                return ae
×
2831
        }
×
2832

2833
        e := ApiErrors[JSStreamWrongLastMsgIDErrF]
5✔
2834
        args := e.toReplacerArgs([]interface{}{"{id}", id})
5✔
2835
        return &ApiError{
5✔
2836
                Code:        e.Code,
5✔
2837
                ErrCode:     e.ErrCode,
5✔
2838
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
2839
        }
5✔
2840
}
2841

2842
// NewJSStreamWrongLastSequenceConstantError creates a new JSStreamWrongLastSequenceConstantErr error: "wrong last sequence"
2843
func NewJSStreamWrongLastSequenceConstantError(opts ...ErrorOption) *ApiError {
23✔
2844
        eopts := parseOpts(opts)
23✔
2845
        if ae, ok := eopts.err.(*ApiError); ok {
23✔
2846
                return ae
×
2847
        }
×
2848

2849
        return ApiErrors[JSStreamWrongLastSequenceConstantErr]
23✔
2850
}
2851

2852
// NewJSStreamWrongLastSequenceError creates a new JSStreamWrongLastSequenceErrF error: "wrong last sequence: {seq}"
2853
func NewJSStreamWrongLastSequenceError(seq uint64, opts ...ErrorOption) *ApiError {
61✔
2854
        eopts := parseOpts(opts)
61✔
2855
        if ae, ok := eopts.err.(*ApiError); ok {
61✔
2856
                return ae
×
2857
        }
×
2858

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

2868
// NewJSTempStorageFailedError creates a new JSTempStorageFailedErr error: "JetStream unable to open temp storage for restore"
2869
func NewJSTempStorageFailedError(opts ...ErrorOption) *ApiError {
×
2870
        eopts := parseOpts(opts)
×
2871
        if ae, ok := eopts.err.(*ApiError); ok {
×
2872
                return ae
×
2873
        }
×
2874

2875
        return ApiErrors[JSTempStorageFailedErr]
×
2876
}
2877

2878
// NewJSTemplateNameNotMatchSubjectError creates a new JSTemplateNameNotMatchSubjectErr error: "template name in subject does not match request"
2879
func NewJSTemplateNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
1✔
2880
        eopts := parseOpts(opts)
1✔
2881
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2882
                return ae
×
2883
        }
×
2884

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