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

nats-io / nats-server / 21739445944

05 Feb 2026 04:15PM UTC coverage: 84.633% (-0.2%) from 84.791%
21739445944

push

github

web-flow
(2.14?) NRG: WAL must align with snapshot (#7620)

The Raft log can have three states:
- no snapshot, and an empty WAL
- no snapshot, and a WAL that starts from the very first entry with N
entries
- a snapshot, and the WAL continues onward from the snapshot with N
entries

We previously were not checking that these align, this would allow for
the snapshot to be non-existent but the WAL to be way ahead or there to
be a gap (somehow) between the snapshot and WAL itself. Both could lead
to data loss.
Normally this shouldn't be an issue though, as these will always align.
But, could potentially happen if a snapshot and the tail of the WAL were
durably written, but somehow the head of the WAL was not.

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

74540 of 88074 relevant lines covered (84.63%)

344585.42 hits per line

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

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

3
package server
4

5
import "strings"
6

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

11
        // JSAtomicPublishContainsDuplicateMessageErr atomic publish batch contains duplicate message id
12
        JSAtomicPublishContainsDuplicateMessageErr ErrorIdentifier = 10201
13

14
        // JSAtomicPublishDisabledErr atomic publish is disabled
15
        JSAtomicPublishDisabledErr ErrorIdentifier = 10174
16

17
        // JSAtomicPublishIncompleteBatchErr atomic publish batch is incomplete
18
        JSAtomicPublishIncompleteBatchErr ErrorIdentifier = 10176
19

20
        // JSAtomicPublishInvalidBatchCommitErr atomic publish batch commit is invalid
21
        JSAtomicPublishInvalidBatchCommitErr ErrorIdentifier = 10200
22

23
        // JSAtomicPublishInvalidBatchIDErr atomic publish batch ID is invalid
24
        JSAtomicPublishInvalidBatchIDErr ErrorIdentifier = 10179
25

26
        // JSAtomicPublishMissingSeqErr atomic publish sequence is missing
27
        JSAtomicPublishMissingSeqErr ErrorIdentifier = 10175
28

29
        // JSAtomicPublishTooLargeBatchErrF atomic publish batch is too large: {size}
30
        JSAtomicPublishTooLargeBatchErrF ErrorIdentifier = 10199
31

32
        // JSAtomicPublishUnsupportedHeaderBatchErr atomic publish unsupported header used: {header}
33
        JSAtomicPublishUnsupportedHeaderBatchErr ErrorIdentifier = 10177
34

35
        // JSBadRequestErr bad request
36
        JSBadRequestErr ErrorIdentifier = 10003
37

38
        // JSClusterIncompleteErr incomplete results
39
        JSClusterIncompleteErr ErrorIdentifier = 10004
40

41
        // JSClusterNoPeersErrF Error causing no peers to be available ({err})
42
        JSClusterNoPeersErrF ErrorIdentifier = 10005
43

44
        // JSClusterNotActiveErr JetStream not in clustered mode
45
        JSClusterNotActiveErr ErrorIdentifier = 10006
46

47
        // JSClusterNotAssignedErr JetStream cluster not assigned to this server
48
        JSClusterNotAssignedErr ErrorIdentifier = 10007
49

50
        // JSClusterNotAvailErr JetStream system temporarily unavailable
51
        JSClusterNotAvailErr ErrorIdentifier = 10008
52

53
        // JSClusterNotLeaderErr JetStream cluster can not handle request
54
        JSClusterNotLeaderErr ErrorIdentifier = 10009
55

56
        // JSClusterPeerNotMemberErr peer not a member
57
        JSClusterPeerNotMemberErr ErrorIdentifier = 10040
58

59
        // JSClusterRequiredErr JetStream clustering support required
60
        JSClusterRequiredErr ErrorIdentifier = 10010
61

62
        // JSClusterServerMemberChangeInflightErr cluster member change is in progress
63
        JSClusterServerMemberChangeInflightErr ErrorIdentifier = 10202
64

65
        // JSClusterServerNotMemberErr server is not a member of the cluster
66
        JSClusterServerNotMemberErr ErrorIdentifier = 10044
67

68
        // JSClusterTagsErr tags placement not supported for operation
69
        JSClusterTagsErr ErrorIdentifier = 10011
70

71
        // JSClusterUnSupportFeatureErr not currently supported in clustered mode
72
        JSClusterUnSupportFeatureErr ErrorIdentifier = 10036
73

74
        // JSConsumerAckPolicyInvalidErr consumer ack policy invalid
75
        JSConsumerAckPolicyInvalidErr ErrorIdentifier = 10181
76

77
        // JSConsumerAckWaitNegativeErr consumer ack wait needs to be positive
78
        JSConsumerAckWaitNegativeErr ErrorIdentifier = 10183
79

80
        // JSConsumerAlreadyExists action CREATE is used for a existing consumer with a different config (consumer already exists)
81
        JSConsumerAlreadyExists ErrorIdentifier = 10148
82

83
        // JSConsumerBackOffNegativeErr consumer backoff needs to be positive
84
        JSConsumerBackOffNegativeErr ErrorIdentifier = 10184
85

86
        // JSConsumerBadDurableNameErr durable name can not contain '.', '*', '>'
87
        JSConsumerBadDurableNameErr ErrorIdentifier = 10103
88

89
        // JSConsumerConfigRequiredErr consumer config required
90
        JSConsumerConfigRequiredErr ErrorIdentifier = 10078
91

92
        // JSConsumerCreateDurableAndNameMismatch Consumer Durable and Name have to be equal if both are provided
93
        JSConsumerCreateDurableAndNameMismatch ErrorIdentifier = 10132
94

95
        // JSConsumerCreateErrF General consumer creation failure string ({err})
96
        JSConsumerCreateErrF ErrorIdentifier = 10012
97

98
        // JSConsumerCreateFilterSubjectMismatchErr Consumer create request did not match filtered subject from create subject
99
        JSConsumerCreateFilterSubjectMismatchErr ErrorIdentifier = 10131
100

101
        // JSConsumerDeliverCycleErr consumer deliver subject forms a cycle
102
        JSConsumerDeliverCycleErr ErrorIdentifier = 10081
103

104
        // JSConsumerDeliverToWildcardsErr consumer deliver subject has wildcards
105
        JSConsumerDeliverToWildcardsErr ErrorIdentifier = 10079
106

107
        // JSConsumerDescriptionTooLongErrF consumer description is too long, maximum allowed is {max}
108
        JSConsumerDescriptionTooLongErrF ErrorIdentifier = 10107
109

110
        // JSConsumerDirectRequiresEphemeralErr consumer direct requires an ephemeral consumer
111
        JSConsumerDirectRequiresEphemeralErr ErrorIdentifier = 10091
112

113
        // JSConsumerDirectRequiresPushErr consumer direct requires a push based consumer
114
        JSConsumerDirectRequiresPushErr ErrorIdentifier = 10090
115

116
        // JSConsumerDoesNotExist action UPDATE is used for a nonexisting consumer (consumer does not exist)
117
        JSConsumerDoesNotExist ErrorIdentifier = 10149
118

119
        // JSConsumerDuplicateFilterSubjects consumer cannot have both FilterSubject and FilterSubjects specified
120
        JSConsumerDuplicateFilterSubjects ErrorIdentifier = 10136
121

122
        // JSConsumerDurableNameNotInSubjectErr consumer expected to be durable but no durable name set in subject
123
        JSConsumerDurableNameNotInSubjectErr ErrorIdentifier = 10016
124

125
        // JSConsumerDurableNameNotMatchSubjectErr consumer name in subject does not match durable name in request
126
        JSConsumerDurableNameNotMatchSubjectErr ErrorIdentifier = 10017
127

128
        // JSConsumerDurableNameNotSetErr consumer expected to be durable but a durable name was not set
129
        JSConsumerDurableNameNotSetErr ErrorIdentifier = 10018
130

131
        // JSConsumerEmptyFilter consumer filter in FilterSubjects cannot be empty
132
        JSConsumerEmptyFilter ErrorIdentifier = 10139
133

134
        // JSConsumerEmptyGroupName Group name cannot be an empty string
135
        JSConsumerEmptyGroupName ErrorIdentifier = 10161
136

137
        // JSConsumerEphemeralWithDurableInSubjectErr consumer expected to be ephemeral but detected a durable name set in subject
138
        JSConsumerEphemeralWithDurableInSubjectErr ErrorIdentifier = 10019
139

140
        // JSConsumerEphemeralWithDurableNameErr consumer expected to be ephemeral but a durable name was set in request
141
        JSConsumerEphemeralWithDurableNameErr ErrorIdentifier = 10020
142

143
        // JSConsumerExistingActiveErr consumer already exists and is still active
144
        JSConsumerExistingActiveErr ErrorIdentifier = 10105
145

146
        // JSConsumerFCRequiresPushErr consumer flow control requires a push based consumer
147
        JSConsumerFCRequiresPushErr ErrorIdentifier = 10089
148

149
        // JSConsumerFilterNotSubsetErr consumer filter subject is not a valid subset of the interest subjects
150
        JSConsumerFilterNotSubsetErr ErrorIdentifier = 10093
151

152
        // JSConsumerHBRequiresPushErr consumer idle heartbeat requires a push based consumer
153
        JSConsumerHBRequiresPushErr ErrorIdentifier = 10088
154

155
        // JSConsumerInactiveThresholdExcess consumer inactive threshold exceeds system limit of {limit}
156
        JSConsumerInactiveThresholdExcess ErrorIdentifier = 10153
157

158
        // JSConsumerInvalidDeliverSubject invalid push consumer deliver subject
159
        JSConsumerInvalidDeliverSubject ErrorIdentifier = 10112
160

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

164
        // JSConsumerInvalidPolicyErrF Generic delivery policy error ({err})
165
        JSConsumerInvalidPolicyErrF ErrorIdentifier = 10094
166

167
        // JSConsumerInvalidPriorityGroupErr Provided priority group does not exist for this consumer
168
        JSConsumerInvalidPriorityGroupErr ErrorIdentifier = 10160
169

170
        // JSConsumerInvalidSamplingErrF failed to parse consumer sampling configuration: {err}
171
        JSConsumerInvalidSamplingErrF ErrorIdentifier = 10095
172

173
        // JSConsumerMaxDeliverBackoffErr max deliver is required to be > length of backoff values
174
        JSConsumerMaxDeliverBackoffErr ErrorIdentifier = 10116
175

176
        // JSConsumerMaxPendingAckExcessErrF consumer max ack pending exceeds system limit of {limit}
177
        JSConsumerMaxPendingAckExcessErrF ErrorIdentifier = 10121
178

179
        // JSConsumerMaxPendingAckPolicyRequiredErr consumer requires ack policy for max ack pending
180
        JSConsumerMaxPendingAckPolicyRequiredErr ErrorIdentifier = 10082
181

182
        // JSConsumerMaxRequestBatchExceededF consumer max request batch exceeds server limit of {limit}
183
        JSConsumerMaxRequestBatchExceededF ErrorIdentifier = 10125
184

185
        // JSConsumerMaxRequestBatchNegativeErr consumer max request batch needs to be > 0
186
        JSConsumerMaxRequestBatchNegativeErr ErrorIdentifier = 10114
187

188
        // JSConsumerMaxRequestExpiresTooSmall consumer max request expires needs to be >= 1ms
189
        JSConsumerMaxRequestExpiresTooSmall ErrorIdentifier = 10115
190

191
        // JSConsumerMaxWaitingNegativeErr consumer max waiting needs to be positive
192
        JSConsumerMaxWaitingNegativeErr ErrorIdentifier = 10087
193

194
        // JSConsumerMetadataLengthErrF consumer metadata exceeds maximum size of {limit}
195
        JSConsumerMetadataLengthErrF ErrorIdentifier = 10135
196

197
        // JSConsumerMultipleFiltersNotAllowed consumer with multiple subject filters cannot use subject based API
198
        JSConsumerMultipleFiltersNotAllowed ErrorIdentifier = 10137
199

200
        // JSConsumerNameContainsPathSeparatorsErr Consumer name can not contain path separators
201
        JSConsumerNameContainsPathSeparatorsErr ErrorIdentifier = 10127
202

203
        // JSConsumerNameExistErr consumer name already in use
204
        JSConsumerNameExistErr ErrorIdentifier = 10013
205

206
        // JSConsumerNameTooLongErrF consumer name is too long, maximum allowed is {max}
207
        JSConsumerNameTooLongErrF ErrorIdentifier = 10102
208

209
        // JSConsumerNotFoundErr consumer not found
210
        JSConsumerNotFoundErr ErrorIdentifier = 10014
211

212
        // JSConsumerOfflineErr consumer is offline
213
        JSConsumerOfflineErr ErrorIdentifier = 10119
214

215
        // JSConsumerOfflineReasonErrF consumer is offline: {err}
216
        JSConsumerOfflineReasonErrF ErrorIdentifier = 10195
217

218
        // JSConsumerOnMappedErr consumer direct on a mapped consumer
219
        JSConsumerOnMappedErr ErrorIdentifier = 10092
220

221
        // JSConsumerOverlappingSubjectFilters consumer subject filters cannot overlap
222
        JSConsumerOverlappingSubjectFilters ErrorIdentifier = 10138
223

224
        // JSConsumerPinnedTTLWithoutPriorityPolicyNone PinnedTTL cannot be set when PriorityPolicy is none
225
        JSConsumerPinnedTTLWithoutPriorityPolicyNone ErrorIdentifier = 10197
226

227
        // JSConsumerPriorityGroupWithPolicyNone consumer can not have priority groups when policy is none
228
        JSConsumerPriorityGroupWithPolicyNone ErrorIdentifier = 10196
229

230
        // JSConsumerPriorityPolicyWithoutGroup Setting PriorityPolicy requires at least one PriorityGroup to be set
231
        JSConsumerPriorityPolicyWithoutGroup ErrorIdentifier = 10159
232

233
        // JSConsumerPullNotDurableErr consumer in pull mode requires a durable name
234
        JSConsumerPullNotDurableErr ErrorIdentifier = 10085
235

236
        // JSConsumerPullRequiresAckErr consumer in pull mode requires explicit ack policy on workqueue stream
237
        JSConsumerPullRequiresAckErr ErrorIdentifier = 10084
238

239
        // JSConsumerPullWithRateLimitErr consumer in pull mode can not have rate limit set
240
        JSConsumerPullWithRateLimitErr ErrorIdentifier = 10086
241

242
        // JSConsumerPushMaxWaitingErr consumer in push mode can not set max waiting
243
        JSConsumerPushMaxWaitingErr ErrorIdentifier = 10080
244

245
        // JSConsumerPushWithPriorityGroupErr priority groups can not be used with push consumers
246
        JSConsumerPushWithPriorityGroupErr ErrorIdentifier = 10178
247

248
        // JSConsumerReplacementWithDifferentNameErr consumer replacement durable config not the same
249
        JSConsumerReplacementWithDifferentNameErr ErrorIdentifier = 10106
250

251
        // JSConsumerReplayPolicyInvalidErr consumer replay policy invalid
252
        JSConsumerReplayPolicyInvalidErr ErrorIdentifier = 10182
253

254
        // JSConsumerReplicasExceedsStream consumer config replica count exceeds parent stream
255
        JSConsumerReplicasExceedsStream ErrorIdentifier = 10126
256

257
        // JSConsumerReplicasShouldMatchStream consumer config replicas must match interest retention stream's replicas
258
        JSConsumerReplicasShouldMatchStream ErrorIdentifier = 10134
259

260
        // JSConsumerSmallHeartbeatErr consumer idle heartbeat needs to be >= 100ms
261
        JSConsumerSmallHeartbeatErr ErrorIdentifier = 10083
262

263
        // JSConsumerStoreFailedErrF error creating store for consumer: {err}
264
        JSConsumerStoreFailedErrF ErrorIdentifier = 10104
265

266
        // JSConsumerWQConsumerNotDeliverAllErr consumer must be deliver all on workqueue stream
267
        JSConsumerWQConsumerNotDeliverAllErr ErrorIdentifier = 10101
268

269
        // JSConsumerWQConsumerNotUniqueErr filtered consumer not unique on workqueue stream
270
        JSConsumerWQConsumerNotUniqueErr ErrorIdentifier = 10100
271

272
        // JSConsumerWQMultipleUnfilteredErr multiple non-filtered consumers not allowed on workqueue stream
273
        JSConsumerWQMultipleUnfilteredErr ErrorIdentifier = 10099
274

275
        // JSConsumerWQRequiresExplicitAckErr workqueue stream requires explicit ack
276
        JSConsumerWQRequiresExplicitAckErr ErrorIdentifier = 10098
277

278
        // JSConsumerWithFlowControlNeedsHeartbeats consumer with flow control also needs heartbeats
279
        JSConsumerWithFlowControlNeedsHeartbeats ErrorIdentifier = 10108
280

281
        // JSInsufficientResourcesErr insufficient resources
282
        JSInsufficientResourcesErr ErrorIdentifier = 10023
283

284
        // JSInvalidJSONErr invalid JSON: {err}
285
        JSInvalidJSONErr ErrorIdentifier = 10025
286

287
        // JSMaximumConsumersLimitErr maximum consumers limit reached
288
        JSMaximumConsumersLimitErr ErrorIdentifier = 10026
289

290
        // JSMaximumStreamsLimitErr maximum number of streams reached
291
        JSMaximumStreamsLimitErr ErrorIdentifier = 10027
292

293
        // JSMemoryResourcesExceededErr insufficient memory resources available
294
        JSMemoryResourcesExceededErr ErrorIdentifier = 10028
295

296
        // JSMessageCounterBrokenErr message counter is broken
297
        JSMessageCounterBrokenErr ErrorIdentifier = 10172
298

299
        // JSMessageIncrDisabledErr message counters is disabled
300
        JSMessageIncrDisabledErr ErrorIdentifier = 10168
301

302
        // JSMessageIncrInvalidErr message counter increment is invalid
303
        JSMessageIncrInvalidErr ErrorIdentifier = 10171
304

305
        // JSMessageIncrMissingErr message counter increment is missing
306
        JSMessageIncrMissingErr ErrorIdentifier = 10169
307

308
        // JSMessageIncrPayloadErr message counter has payload
309
        JSMessageIncrPayloadErr ErrorIdentifier = 10170
310

311
        // JSMessageSchedulesDisabledErr message schedules is disabled
312
        JSMessageSchedulesDisabledErr ErrorIdentifier = 10188
313

314
        // JSMessageSchedulesPatternInvalidErr message schedules pattern is invalid
315
        JSMessageSchedulesPatternInvalidErr ErrorIdentifier = 10189
316

317
        // JSMessageSchedulesRollupInvalidErr message schedules invalid rollup
318
        JSMessageSchedulesRollupInvalidErr ErrorIdentifier = 10192
319

320
        // JSMessageSchedulesSourceInvalidErr message schedules source is invalid
321
        JSMessageSchedulesSourceInvalidErr ErrorIdentifier = 10203
322

323
        // JSMessageSchedulesTTLInvalidErr message schedules invalid per-message TTL
324
        JSMessageSchedulesTTLInvalidErr ErrorIdentifier = 10191
325

326
        // JSMessageSchedulesTargetInvalidErr message schedules target is invalid
327
        JSMessageSchedulesTargetInvalidErr ErrorIdentifier = 10190
328

329
        // JSMessageTTLDisabledErr per-message TTL is disabled
330
        JSMessageTTLDisabledErr ErrorIdentifier = 10166
331

332
        // JSMessageTTLInvalidErr invalid per-message TTL
333
        JSMessageTTLInvalidErr ErrorIdentifier = 10165
334

335
        // JSMirrorConsumerSetupFailedErrF generic mirror consumer setup failure string ({err})
336
        JSMirrorConsumerSetupFailedErrF ErrorIdentifier = 10029
337

338
        // JSMirrorInvalidStreamName mirrored stream name is invalid
339
        JSMirrorInvalidStreamName ErrorIdentifier = 10142
340

341
        // JSMirrorInvalidSubjectFilter mirror transform source: {err}
342
        JSMirrorInvalidSubjectFilter ErrorIdentifier = 10151
343

344
        // JSMirrorInvalidTransformDestination mirror transform: {err}
345
        JSMirrorInvalidTransformDestination ErrorIdentifier = 10154
346

347
        // JSMirrorMaxMessageSizeTooBigErr stream mirror must have max message size >= source
348
        JSMirrorMaxMessageSizeTooBigErr ErrorIdentifier = 10030
349

350
        // JSMirrorMultipleFiltersNotAllowed mirror with multiple subject transforms cannot also have a single subject filter
351
        JSMirrorMultipleFiltersNotAllowed ErrorIdentifier = 10150
352

353
        // JSMirrorOverlappingSubjectFilters mirror subject filters can not overlap
354
        JSMirrorOverlappingSubjectFilters ErrorIdentifier = 10152
355

356
        // JSMirrorWithAtomicPublishErr stream mirrors can not also use atomic publishing
357
        JSMirrorWithAtomicPublishErr ErrorIdentifier = 10198
358

359
        // JSMirrorWithCountersErr stream mirrors can not also calculate counters
360
        JSMirrorWithCountersErr ErrorIdentifier = 10173
361

362
        // JSMirrorWithFirstSeqErr stream mirrors can not have first sequence configured
363
        JSMirrorWithFirstSeqErr ErrorIdentifier = 10143
364

365
        // JSMirrorWithMsgSchedulesErr stream mirrors can not also schedule messages
366
        JSMirrorWithMsgSchedulesErr ErrorIdentifier = 10186
367

368
        // JSMirrorWithSourcesErr stream mirrors can not also contain other sources
369
        JSMirrorWithSourcesErr ErrorIdentifier = 10031
370

371
        // JSMirrorWithStartSeqAndTimeErr stream mirrors can not have both start seq and start time configured
372
        JSMirrorWithStartSeqAndTimeErr ErrorIdentifier = 10032
373

374
        // JSMirrorWithSubjectFiltersErr stream mirrors can not contain filtered subjects
375
        JSMirrorWithSubjectFiltersErr ErrorIdentifier = 10033
376

377
        // JSMirrorWithSubjectsErr stream mirrors can not contain subjects
378
        JSMirrorWithSubjectsErr ErrorIdentifier = 10034
379

380
        // JSNoAccountErr account not found
381
        JSNoAccountErr ErrorIdentifier = 10035
382

383
        // JSNoLimitsErr no JetStream default or applicable tiered limit present
384
        JSNoLimitsErr ErrorIdentifier = 10120
385

386
        // JSNoMessageFoundErr no message found
387
        JSNoMessageFoundErr ErrorIdentifier = 10037
388

389
        // JSNotEmptyRequestErr expected an empty request payload
390
        JSNotEmptyRequestErr ErrorIdentifier = 10038
391

392
        // JSNotEnabledErr JetStream not enabled
393
        JSNotEnabledErr ErrorIdentifier = 10076
394

395
        // JSNotEnabledForAccountErr JetStream not enabled for account
396
        JSNotEnabledForAccountErr ErrorIdentifier = 10039
397

398
        // JSPedanticErrF pedantic mode: {err}
399
        JSPedanticErrF ErrorIdentifier = 10157
400

401
        // JSPeerRemapErr peer remap failed
402
        JSPeerRemapErr ErrorIdentifier = 10075
403

404
        // JSRaftGeneralErrF General RAFT error string ({err})
405
        JSRaftGeneralErrF ErrorIdentifier = 10041
406

407
        // JSReplicasCountCannotBeNegative replicas count cannot be negative
408
        JSReplicasCountCannotBeNegative ErrorIdentifier = 10133
409

410
        // JSRequiredApiLevelErr JetStream minimum api level required
411
        JSRequiredApiLevelErr ErrorIdentifier = 10185
412

413
        // JSRestoreSubscribeFailedErrF JetStream unable to subscribe to restore snapshot {subject}: {err}
414
        JSRestoreSubscribeFailedErrF ErrorIdentifier = 10042
415

416
        // JSSequenceNotFoundErrF sequence {seq} not found
417
        JSSequenceNotFoundErrF ErrorIdentifier = 10043
418

419
        // JSSnapshotDeliverSubjectInvalidErr deliver subject not valid
420
        JSSnapshotDeliverSubjectInvalidErr ErrorIdentifier = 10015
421

422
        // JSSourceConsumerSetupFailedErrF General source consumer setup failure string ({err})
423
        JSSourceConsumerSetupFailedErrF ErrorIdentifier = 10045
424

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

428
        // JSSourceInvalidStreamName sourced stream name is invalid
429
        JSSourceInvalidStreamName ErrorIdentifier = 10141
430

431
        // JSSourceInvalidSubjectFilter source transform source: {err}
432
        JSSourceInvalidSubjectFilter ErrorIdentifier = 10145
433

434
        // JSSourceInvalidTransformDestination source transform: {err}
435
        JSSourceInvalidTransformDestination ErrorIdentifier = 10146
436

437
        // JSSourceMaxMessageSizeTooBigErr stream source must have max message size >= target
438
        JSSourceMaxMessageSizeTooBigErr ErrorIdentifier = 10046
439

440
        // JSSourceMultipleFiltersNotAllowed source with multiple subject transforms cannot also have a single subject filter
441
        JSSourceMultipleFiltersNotAllowed ErrorIdentifier = 10144
442

443
        // JSSourceOverlappingSubjectFilters source filters can not overlap
444
        JSSourceOverlappingSubjectFilters ErrorIdentifier = 10147
445

446
        // JSSourceWithMsgSchedulesErr stream source can not also schedule messages
447
        JSSourceWithMsgSchedulesErr ErrorIdentifier = 10187
448

449
        // JSStorageResourcesExceededErr insufficient storage resources available
450
        JSStorageResourcesExceededErr ErrorIdentifier = 10047
451

452
        // JSStreamAssignmentErrF Generic stream assignment error string ({err})
453
        JSStreamAssignmentErrF ErrorIdentifier = 10048
454

455
        // JSStreamCreateErrF Generic stream creation error string ({err})
456
        JSStreamCreateErrF ErrorIdentifier = 10049
457

458
        // JSStreamDeleteErrF General stream deletion error string ({err})
459
        JSStreamDeleteErrF ErrorIdentifier = 10050
460

461
        // JSStreamDuplicateMessageConflict duplicate message id is in process
462
        JSStreamDuplicateMessageConflict ErrorIdentifier = 10158
463

464
        // JSStreamExpectedLastSeqPerSubjectInvalid missing sequence for expected last sequence per subject
465
        JSStreamExpectedLastSeqPerSubjectInvalid ErrorIdentifier = 10193
466

467
        // JSStreamExpectedLastSeqPerSubjectNotReady expected last sequence per subject temporarily unavailable
468
        JSStreamExpectedLastSeqPerSubjectNotReady ErrorIdentifier = 10163
469

470
        // JSStreamExternalApiOverlapErrF stream external api prefix {prefix} must not overlap with {subject}
471
        JSStreamExternalApiOverlapErrF ErrorIdentifier = 10021
472

473
        // JSStreamExternalDelPrefixOverlapsErrF stream external delivery prefix {prefix} overlaps with stream subject {subject}
474
        JSStreamExternalDelPrefixOverlapsErrF ErrorIdentifier = 10022
475

476
        // JSStreamGeneralErrorF General stream failure string ({err})
477
        JSStreamGeneralErrorF ErrorIdentifier = 10051
478

479
        // JSStreamHeaderExceedsMaximumErr header size exceeds maximum allowed of 64k
480
        JSStreamHeaderExceedsMaximumErr ErrorIdentifier = 10097
481

482
        // JSStreamInfoMaxSubjectsErr subject details would exceed maximum allowed
483
        JSStreamInfoMaxSubjectsErr ErrorIdentifier = 10117
484

485
        // JSStreamInvalidConfigF Stream configuration validation error string ({err})
486
        JSStreamInvalidConfigF ErrorIdentifier = 10052
487

488
        // JSStreamInvalidErr stream not valid
489
        JSStreamInvalidErr ErrorIdentifier = 10096
490

491
        // JSStreamInvalidExternalDeliverySubjErrF stream external delivery prefix {prefix} must not contain wildcards
492
        JSStreamInvalidExternalDeliverySubjErrF ErrorIdentifier = 10024
493

494
        // JSStreamLimitsErrF General stream limits exceeded error string ({err})
495
        JSStreamLimitsErrF ErrorIdentifier = 10053
496

497
        // JSStreamMaxBytesRequired account requires a stream config to have max bytes set
498
        JSStreamMaxBytesRequired ErrorIdentifier = 10113
499

500
        // JSStreamMaxStreamBytesExceeded stream max bytes exceeds account limit max stream bytes
501
        JSStreamMaxStreamBytesExceeded ErrorIdentifier = 10122
502

503
        // JSStreamMessageExceedsMaximumErr message size exceeds maximum allowed
504
        JSStreamMessageExceedsMaximumErr ErrorIdentifier = 10054
505

506
        // JSStreamMinLastSeqErr min last sequence
507
        JSStreamMinLastSeqErr ErrorIdentifier = 10180
508

509
        // JSStreamMirrorNotUpdatableErr stream mirror configuration can not be updated
510
        JSStreamMirrorNotUpdatableErr ErrorIdentifier = 10055
511

512
        // JSStreamMismatchErr stream name in subject does not match request
513
        JSStreamMismatchErr ErrorIdentifier = 10056
514

515
        // JSStreamMoveAndScaleErr can not move and scale a stream in a single update
516
        JSStreamMoveAndScaleErr ErrorIdentifier = 10123
517

518
        // JSStreamMoveInProgressF stream move already in progress: {msg}
519
        JSStreamMoveInProgressF ErrorIdentifier = 10124
520

521
        // JSStreamMoveNotInProgress stream move not in progress
522
        JSStreamMoveNotInProgress ErrorIdentifier = 10129
523

524
        // JSStreamMsgDeleteFailedF Generic message deletion failure error string ({err})
525
        JSStreamMsgDeleteFailedF ErrorIdentifier = 10057
526

527
        // JSStreamNameContainsPathSeparatorsErr Stream name can not contain path separators
528
        JSStreamNameContainsPathSeparatorsErr ErrorIdentifier = 10128
529

530
        // JSStreamNameExistErr stream name already in use with a different configuration
531
        JSStreamNameExistErr ErrorIdentifier = 10058
532

533
        // JSStreamNameExistRestoreFailedErr stream name already in use, cannot restore
534
        JSStreamNameExistRestoreFailedErr ErrorIdentifier = 10130
535

536
        // JSStreamNotFoundErr stream not found
537
        JSStreamNotFoundErr ErrorIdentifier = 10059
538

539
        // JSStreamNotMatchErr expected stream does not match
540
        JSStreamNotMatchErr ErrorIdentifier = 10060
541

542
        // JSStreamOfflineErr stream is offline
543
        JSStreamOfflineErr ErrorIdentifier = 10118
544

545
        // JSStreamOfflineReasonErrF stream is offline: {err}
546
        JSStreamOfflineReasonErrF ErrorIdentifier = 10194
547

548
        // JSStreamPurgeFailedF Generic stream purge failure error string ({err})
549
        JSStreamPurgeFailedF ErrorIdentifier = 10110
550

551
        // JSStreamReplicasNotSupportedErr replicas > 1 not supported in non-clustered mode
552
        JSStreamReplicasNotSupportedErr ErrorIdentifier = 10074
553

554
        // JSStreamReplicasNotUpdatableErr Replicas configuration can not be updated
555
        JSStreamReplicasNotUpdatableErr ErrorIdentifier = 10061
556

557
        // JSStreamRestoreErrF restore failed: {err}
558
        JSStreamRestoreErrF ErrorIdentifier = 10062
559

560
        // JSStreamRollupFailedF Generic stream rollup failure error string ({err})
561
        JSStreamRollupFailedF ErrorIdentifier = 10111
562

563
        // JSStreamSealedErr invalid operation on sealed stream
564
        JSStreamSealedErr ErrorIdentifier = 10109
565

566
        // JSStreamSequenceNotMatchErr expected stream sequence does not match
567
        JSStreamSequenceNotMatchErr ErrorIdentifier = 10063
568

569
        // JSStreamSnapshotErrF snapshot failed: {err}
570
        JSStreamSnapshotErrF ErrorIdentifier = 10064
571

572
        // JSStreamStoreFailedF Generic error when storing a message failed ({err})
573
        JSStreamStoreFailedF ErrorIdentifier = 10077
574

575
        // JSStreamSubjectOverlapErr subjects overlap with an existing stream
576
        JSStreamSubjectOverlapErr ErrorIdentifier = 10065
577

578
        // JSStreamTemplateCreateErrF Generic template creation failed string ({err})
579
        JSStreamTemplateCreateErrF ErrorIdentifier = 10066
580

581
        // JSStreamTemplateDeleteErrF Generic stream template deletion failed error string ({err})
582
        JSStreamTemplateDeleteErrF ErrorIdentifier = 10067
583

584
        // JSStreamTemplateNotFoundErr template not found
585
        JSStreamTemplateNotFoundErr ErrorIdentifier = 10068
586

587
        // JSStreamTooManyRequests too many requests
588
        JSStreamTooManyRequests ErrorIdentifier = 10167
589

590
        // JSStreamTransformInvalidDestination stream transform: {err}
591
        JSStreamTransformInvalidDestination ErrorIdentifier = 10156
592

593
        // JSStreamTransformInvalidSource stream transform source: {err}
594
        JSStreamTransformInvalidSource ErrorIdentifier = 10155
595

596
        // JSStreamUpdateErrF Generic stream update error string ({err})
597
        JSStreamUpdateErrF ErrorIdentifier = 10069
598

599
        // JSStreamWrongLastMsgIDErrF wrong last msg ID: {id}
600
        JSStreamWrongLastMsgIDErrF ErrorIdentifier = 10070
601

602
        // JSStreamWrongLastSequenceConstantErr wrong last sequence
603
        JSStreamWrongLastSequenceConstantErr ErrorIdentifier = 10164
604

605
        // JSStreamWrongLastSequenceErrF wrong last sequence: {seq}
606
        JSStreamWrongLastSequenceErrF ErrorIdentifier = 10071
607

608
        // JSTempStorageFailedErr JetStream unable to open temp storage for restore
609
        JSTempStorageFailedErr ErrorIdentifier = 10072
610

611
        // JSTemplateNameNotMatchSubjectErr template name in subject does not match request
612
        JSTemplateNameNotMatchSubjectErr ErrorIdentifier = 10073
613
)
614

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

844
// NewJSAccountResourcesExceededError creates a new JSAccountResourcesExceededErr error: "resource limits exceeded for account"
845
func NewJSAccountResourcesExceededError(opts ...ErrorOption) *ApiError {
20,059✔
846
        eopts := parseOpts(opts)
20,059✔
847
        if ae, ok := eopts.err.(*ApiError); ok {
20,059✔
848
                return ae
×
849
        }
×
850

851
        return ApiErrors[JSAccountResourcesExceededErr]
20,059✔
852
}
853

854
// NewJSAtomicPublishContainsDuplicateMessageError creates a new JSAtomicPublishContainsDuplicateMessageErr error: "atomic publish batch contains duplicate message id"
855
func NewJSAtomicPublishContainsDuplicateMessageError(opts ...ErrorOption) *ApiError {
22,066✔
856
        eopts := parseOpts(opts)
22,066✔
857
        if ae, ok := eopts.err.(*ApiError); ok {
22,066✔
858
                return ae
×
859
        }
×
860

861
        return ApiErrors[JSAtomicPublishContainsDuplicateMessageErr]
22,066✔
862
}
863

864
// NewJSAtomicPublishDisabledError creates a new JSAtomicPublishDisabledErr error: "atomic publish is disabled"
865
func NewJSAtomicPublishDisabledError(opts ...ErrorOption) *ApiError {
24✔
866
        eopts := parseOpts(opts)
24✔
867
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
868
                return ae
×
869
        }
×
870

871
        return ApiErrors[JSAtomicPublishDisabledErr]
24✔
872
}
873

874
// NewJSAtomicPublishIncompleteBatchError creates a new JSAtomicPublishIncompleteBatchErr error: "atomic publish batch is incomplete"
875
func NewJSAtomicPublishIncompleteBatchError(opts ...ErrorOption) *ApiError {
62✔
876
        eopts := parseOpts(opts)
62✔
877
        if ae, ok := eopts.err.(*ApiError); ok {
62✔
878
                return ae
×
879
        }
×
880

881
        return ApiErrors[JSAtomicPublishIncompleteBatchErr]
62✔
882
}
883

884
// NewJSAtomicPublishInvalidBatchCommitError creates a new JSAtomicPublishInvalidBatchCommitErr error: "atomic publish batch commit is invalid"
885
func NewJSAtomicPublishInvalidBatchCommitError(opts ...ErrorOption) *ApiError {
6✔
886
        eopts := parseOpts(opts)
6✔
887
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
888
                return ae
×
889
        }
×
890

891
        return ApiErrors[JSAtomicPublishInvalidBatchCommitErr]
6✔
892
}
893

894
// NewJSAtomicPublishInvalidBatchIDError creates a new JSAtomicPublishInvalidBatchIDErr error: "atomic publish batch ID is invalid"
895
func NewJSAtomicPublishInvalidBatchIDError(opts ...ErrorOption) *ApiError {
4✔
896
        eopts := parseOpts(opts)
4✔
897
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
898
                return ae
×
899
        }
×
900

901
        return ApiErrors[JSAtomicPublishInvalidBatchIDErr]
4✔
902
}
903

904
// NewJSAtomicPublishMissingSeqError creates a new JSAtomicPublishMissingSeqErr error: "atomic publish sequence is missing"
905
func NewJSAtomicPublishMissingSeqError(opts ...ErrorOption) *ApiError {
24✔
906
        eopts := parseOpts(opts)
24✔
907
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
908
                return ae
×
909
        }
×
910

911
        return ApiErrors[JSAtomicPublishMissingSeqErr]
24✔
912
}
913

914
// NewJSAtomicPublishTooLargeBatchError creates a new JSAtomicPublishTooLargeBatchErrF error: "atomic publish batch is too large: {size}"
915
func NewJSAtomicPublishTooLargeBatchError(size interface{}, opts ...ErrorOption) *ApiError {
10✔
916
        eopts := parseOpts(opts)
10✔
917
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
918
                return ae
×
919
        }
×
920

921
        e := ApiErrors[JSAtomicPublishTooLargeBatchErrF]
10✔
922
        args := e.toReplacerArgs([]interface{}{"{size}", size})
10✔
923
        return &ApiError{
10✔
924
                Code:        e.Code,
10✔
925
                ErrCode:     e.ErrCode,
10✔
926
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
927
        }
10✔
928
}
929

930
// NewJSAtomicPublishUnsupportedHeaderBatchError creates a new JSAtomicPublishUnsupportedHeaderBatchErr error: "atomic publish unsupported header used: {header}"
931
func NewJSAtomicPublishUnsupportedHeaderBatchError(header interface{}, opts ...ErrorOption) *ApiError {
4✔
932
        eopts := parseOpts(opts)
4✔
933
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
934
                return ae
×
935
        }
×
936

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

946
// NewJSBadRequestError creates a new JSBadRequestErr error: "bad request"
947
func NewJSBadRequestError(opts ...ErrorOption) *ApiError {
10✔
948
        eopts := parseOpts(opts)
10✔
949
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
950
                return ae
×
951
        }
×
952

953
        return ApiErrors[JSBadRequestErr]
10✔
954
}
955

956
// NewJSClusterIncompleteError creates a new JSClusterIncompleteErr error: "incomplete results"
957
func NewJSClusterIncompleteError(opts ...ErrorOption) *ApiError {
×
958
        eopts := parseOpts(opts)
×
959
        if ae, ok := eopts.err.(*ApiError); ok {
×
960
                return ae
×
961
        }
×
962

963
        return ApiErrors[JSClusterIncompleteErr]
×
964
}
965

966
// NewJSClusterNoPeersError creates a new JSClusterNoPeersErrF error: "{err}"
967
func NewJSClusterNoPeersError(err error, opts ...ErrorOption) *ApiError {
58✔
968
        eopts := parseOpts(opts)
58✔
969
        if ae, ok := eopts.err.(*ApiError); ok {
58✔
970
                return ae
×
971
        }
×
972

973
        e := ApiErrors[JSClusterNoPeersErrF]
58✔
974
        args := e.toReplacerArgs([]interface{}{"{err}", err})
58✔
975
        return &ApiError{
58✔
976
                Code:        e.Code,
58✔
977
                ErrCode:     e.ErrCode,
58✔
978
                Description: strings.NewReplacer(args...).Replace(e.Description),
58✔
979
        }
58✔
980
}
981

982
// NewJSClusterNotActiveError creates a new JSClusterNotActiveErr error: "JetStream not in clustered mode"
983
func NewJSClusterNotActiveError(opts ...ErrorOption) *ApiError {
1✔
984
        eopts := parseOpts(opts)
1✔
985
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
986
                return ae
×
987
        }
×
988

989
        return ApiErrors[JSClusterNotActiveErr]
1✔
990
}
991

992
// NewJSClusterNotAssignedError creates a new JSClusterNotAssignedErr error: "JetStream cluster not assigned to this server"
993
func NewJSClusterNotAssignedError(opts ...ErrorOption) *ApiError {
2✔
994
        eopts := parseOpts(opts)
2✔
995
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
996
                return ae
×
997
        }
×
998

999
        return ApiErrors[JSClusterNotAssignedErr]
2✔
1000
}
1001

1002
// NewJSClusterNotAvailError creates a new JSClusterNotAvailErr error: "JetStream system temporarily unavailable"
1003
func NewJSClusterNotAvailError(opts ...ErrorOption) *ApiError {
13✔
1004
        eopts := parseOpts(opts)
13✔
1005
        if ae, ok := eopts.err.(*ApiError); ok {
13✔
1006
                return ae
×
1007
        }
×
1008

1009
        return ApiErrors[JSClusterNotAvailErr]
13✔
1010
}
1011

1012
// NewJSClusterNotLeaderError creates a new JSClusterNotLeaderErr error: "JetStream cluster can not handle request"
1013
func NewJSClusterNotLeaderError(opts ...ErrorOption) *ApiError {
3✔
1014
        eopts := parseOpts(opts)
3✔
1015
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1016
                return ae
×
1017
        }
×
1018

1019
        return ApiErrors[JSClusterNotLeaderErr]
3✔
1020
}
1021

1022
// NewJSClusterPeerNotMemberError creates a new JSClusterPeerNotMemberErr error: "peer not a member"
1023
func NewJSClusterPeerNotMemberError(opts ...ErrorOption) *ApiError {
1✔
1024
        eopts := parseOpts(opts)
1✔
1025
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1026
                return ae
×
1027
        }
×
1028

1029
        return ApiErrors[JSClusterPeerNotMemberErr]
1✔
1030
}
1031

1032
// NewJSClusterRequiredError creates a new JSClusterRequiredErr error: "JetStream clustering support required"
1033
func NewJSClusterRequiredError(opts ...ErrorOption) *ApiError {
6✔
1034
        eopts := parseOpts(opts)
6✔
1035
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1036
                return ae
×
1037
        }
×
1038

1039
        return ApiErrors[JSClusterRequiredErr]
6✔
1040
}
1041

1042
// NewJSClusterServerMemberChangeInflightError creates a new JSClusterServerMemberChangeInflightErr error: "cluster member change is in progress"
1043
func NewJSClusterServerMemberChangeInflightError(opts ...ErrorOption) *ApiError {
6✔
1044
        eopts := parseOpts(opts)
6✔
1045
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1046
                return ae
×
1047
        }
×
1048

1049
        return ApiErrors[JSClusterServerMemberChangeInflightErr]
6✔
1050
}
1051

1052
// NewJSClusterServerNotMemberError creates a new JSClusterServerNotMemberErr error: "server is not a member of the cluster"
1053
func NewJSClusterServerNotMemberError(opts ...ErrorOption) *ApiError {
6✔
1054
        eopts := parseOpts(opts)
6✔
1055
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1056
                return ae
×
1057
        }
×
1058

1059
        return ApiErrors[JSClusterServerNotMemberErr]
6✔
1060
}
1061

1062
// NewJSClusterTagsError creates a new JSClusterTagsErr error: "tags placement not supported for operation"
1063
func NewJSClusterTagsError(opts ...ErrorOption) *ApiError {
×
1064
        eopts := parseOpts(opts)
×
1065
        if ae, ok := eopts.err.(*ApiError); ok {
×
1066
                return ae
×
1067
        }
×
1068

1069
        return ApiErrors[JSClusterTagsErr]
×
1070
}
1071

1072
// NewJSClusterUnSupportFeatureError creates a new JSClusterUnSupportFeatureErr error: "not currently supported in clustered mode"
1073
func NewJSClusterUnSupportFeatureError(opts ...ErrorOption) *ApiError {
×
1074
        eopts := parseOpts(opts)
×
1075
        if ae, ok := eopts.err.(*ApiError); ok {
×
1076
                return ae
×
1077
        }
×
1078

1079
        return ApiErrors[JSClusterUnSupportFeatureErr]
×
1080
}
1081

1082
// NewJSConsumerAckPolicyInvalidError creates a new JSConsumerAckPolicyInvalidErr error: "consumer ack policy invalid"
1083
func NewJSConsumerAckPolicyInvalidError(opts ...ErrorOption) *ApiError {
2✔
1084
        eopts := parseOpts(opts)
2✔
1085
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1086
                return ae
×
1087
        }
×
1088

1089
        return ApiErrors[JSConsumerAckPolicyInvalidErr]
2✔
1090
}
1091

1092
// NewJSConsumerAckWaitNegativeError creates a new JSConsumerAckWaitNegativeErr error: "consumer ack wait needs to be positive"
1093
func NewJSConsumerAckWaitNegativeError(opts ...ErrorOption) *ApiError {
2✔
1094
        eopts := parseOpts(opts)
2✔
1095
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1096
                return ae
×
1097
        }
×
1098

1099
        return ApiErrors[JSConsumerAckWaitNegativeErr]
2✔
1100
}
1101

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

1109
        return ApiErrors[JSConsumerAlreadyExists]
5✔
1110
}
1111

1112
// NewJSConsumerBackOffNegativeError creates a new JSConsumerBackOffNegativeErr error: "consumer backoff needs to be positive"
1113
func NewJSConsumerBackOffNegativeError(opts ...ErrorOption) *ApiError {
2✔
1114
        eopts := parseOpts(opts)
2✔
1115
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1116
                return ae
×
1117
        }
×
1118

1119
        return ApiErrors[JSConsumerBackOffNegativeErr]
2✔
1120
}
1121

1122
// NewJSConsumerBadDurableNameError creates a new JSConsumerBadDurableNameErr error: "durable name can not contain '.', '*', '>'"
1123
func NewJSConsumerBadDurableNameError(opts ...ErrorOption) *ApiError {
×
1124
        eopts := parseOpts(opts)
×
1125
        if ae, ok := eopts.err.(*ApiError); ok {
×
1126
                return ae
×
1127
        }
×
1128

1129
        return ApiErrors[JSConsumerBadDurableNameErr]
×
1130
}
1131

1132
// NewJSConsumerConfigRequiredError creates a new JSConsumerConfigRequiredErr error: "consumer config required"
1133
func NewJSConsumerConfigRequiredError(opts ...ErrorOption) *ApiError {
2✔
1134
        eopts := parseOpts(opts)
2✔
1135
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1136
                return ae
×
1137
        }
×
1138

1139
        return ApiErrors[JSConsumerConfigRequiredErr]
2✔
1140
}
1141

1142
// NewJSConsumerCreateDurableAndNameMismatchError creates a new JSConsumerCreateDurableAndNameMismatch error: "Consumer Durable and Name have to be equal if both are provided"
1143
func NewJSConsumerCreateDurableAndNameMismatchError(opts ...ErrorOption) *ApiError {
1✔
1144
        eopts := parseOpts(opts)
1✔
1145
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1146
                return ae
×
1147
        }
×
1148

1149
        return ApiErrors[JSConsumerCreateDurableAndNameMismatch]
1✔
1150
}
1151

1152
// NewJSConsumerCreateError creates a new JSConsumerCreateErrF error: "{err}"
1153
func NewJSConsumerCreateError(err error, opts ...ErrorOption) *ApiError {
71✔
1154
        eopts := parseOpts(opts)
71✔
1155
        if ae, ok := eopts.err.(*ApiError); ok {
124✔
1156
                return ae
53✔
1157
        }
53✔
1158

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

1168
// NewJSConsumerCreateFilterSubjectMismatchError creates a new JSConsumerCreateFilterSubjectMismatchErr error: "Consumer create request did not match filtered subject from create subject"
1169
func NewJSConsumerCreateFilterSubjectMismatchError(opts ...ErrorOption) *ApiError {
2✔
1170
        eopts := parseOpts(opts)
2✔
1171
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1172
                return ae
×
1173
        }
×
1174

1175
        return ApiErrors[JSConsumerCreateFilterSubjectMismatchErr]
2✔
1176
}
1177

1178
// NewJSConsumerDeliverCycleError creates a new JSConsumerDeliverCycleErr error: "consumer deliver subject forms a cycle"
1179
func NewJSConsumerDeliverCycleError(opts ...ErrorOption) *ApiError {
4✔
1180
        eopts := parseOpts(opts)
4✔
1181
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1182
                return ae
×
1183
        }
×
1184

1185
        return ApiErrors[JSConsumerDeliverCycleErr]
4✔
1186
}
1187

1188
// NewJSConsumerDeliverToWildcardsError creates a new JSConsumerDeliverToWildcardsErr error: "consumer deliver subject has wildcards"
1189
func NewJSConsumerDeliverToWildcardsError(opts ...ErrorOption) *ApiError {
4✔
1190
        eopts := parseOpts(opts)
4✔
1191
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1192
                return ae
×
1193
        }
×
1194

1195
        return ApiErrors[JSConsumerDeliverToWildcardsErr]
4✔
1196
}
1197

1198
// NewJSConsumerDescriptionTooLongError creates a new JSConsumerDescriptionTooLongErrF error: "consumer description is too long, maximum allowed is {max}"
1199
func NewJSConsumerDescriptionTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
1✔
1200
        eopts := parseOpts(opts)
1✔
1201
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1202
                return ae
×
1203
        }
×
1204

1205
        e := ApiErrors[JSConsumerDescriptionTooLongErrF]
1✔
1206
        args := e.toReplacerArgs([]interface{}{"{max}", max})
1✔
1207
        return &ApiError{
1✔
1208
                Code:        e.Code,
1✔
1209
                ErrCode:     e.ErrCode,
1✔
1210
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1211
        }
1✔
1212
}
1213

1214
// NewJSConsumerDirectRequiresEphemeralError creates a new JSConsumerDirectRequiresEphemeralErr error: "consumer direct requires an ephemeral consumer"
1215
func NewJSConsumerDirectRequiresEphemeralError(opts ...ErrorOption) *ApiError {
×
1216
        eopts := parseOpts(opts)
×
1217
        if ae, ok := eopts.err.(*ApiError); ok {
×
1218
                return ae
×
1219
        }
×
1220

1221
        return ApiErrors[JSConsumerDirectRequiresEphemeralErr]
×
1222
}
1223

1224
// NewJSConsumerDirectRequiresPushError creates a new JSConsumerDirectRequiresPushErr error: "consumer direct requires a push based consumer"
1225
func NewJSConsumerDirectRequiresPushError(opts ...ErrorOption) *ApiError {
×
1226
        eopts := parseOpts(opts)
×
1227
        if ae, ok := eopts.err.(*ApiError); ok {
×
1228
                return ae
×
1229
        }
×
1230

1231
        return ApiErrors[JSConsumerDirectRequiresPushErr]
×
1232
}
1233

1234
// NewJSConsumerDoesNotExistError creates a new JSConsumerDoesNotExist error: "consumer does not exist"
1235
func NewJSConsumerDoesNotExistError(opts ...ErrorOption) *ApiError {
3✔
1236
        eopts := parseOpts(opts)
3✔
1237
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1238
                return ae
×
1239
        }
×
1240

1241
        return ApiErrors[JSConsumerDoesNotExist]
3✔
1242
}
1243

1244
// NewJSConsumerDuplicateFilterSubjectsError creates a new JSConsumerDuplicateFilterSubjects error: "consumer cannot have both FilterSubject and FilterSubjects specified"
1245
func NewJSConsumerDuplicateFilterSubjectsError(opts ...ErrorOption) *ApiError {
1✔
1246
        eopts := parseOpts(opts)
1✔
1247
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1248
                return ae
×
1249
        }
×
1250

1251
        return ApiErrors[JSConsumerDuplicateFilterSubjects]
1✔
1252
}
1253

1254
// NewJSConsumerDurableNameNotInSubjectError creates a new JSConsumerDurableNameNotInSubjectErr error: "consumer expected to be durable but no durable name set in subject"
1255
func NewJSConsumerDurableNameNotInSubjectError(opts ...ErrorOption) *ApiError {
×
1256
        eopts := parseOpts(opts)
×
1257
        if ae, ok := eopts.err.(*ApiError); ok {
×
1258
                return ae
×
1259
        }
×
1260

1261
        return ApiErrors[JSConsumerDurableNameNotInSubjectErr]
×
1262
}
1263

1264
// NewJSConsumerDurableNameNotMatchSubjectError creates a new JSConsumerDurableNameNotMatchSubjectErr error: "consumer name in subject does not match durable name in request"
1265
func NewJSConsumerDurableNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
×
1266
        eopts := parseOpts(opts)
×
1267
        if ae, ok := eopts.err.(*ApiError); ok {
×
1268
                return ae
×
1269
        }
×
1270

1271
        return ApiErrors[JSConsumerDurableNameNotMatchSubjectErr]
×
1272
}
1273

1274
// NewJSConsumerDurableNameNotSetError creates a new JSConsumerDurableNameNotSetErr error: "consumer expected to be durable but a durable name was not set"
1275
func NewJSConsumerDurableNameNotSetError(opts ...ErrorOption) *ApiError {
1✔
1276
        eopts := parseOpts(opts)
1✔
1277
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1278
                return ae
×
1279
        }
×
1280

1281
        return ApiErrors[JSConsumerDurableNameNotSetErr]
1✔
1282
}
1283

1284
// NewJSConsumerEmptyFilterError creates a new JSConsumerEmptyFilter error: "consumer filter in FilterSubjects cannot be empty"
1285
func NewJSConsumerEmptyFilterError(opts ...ErrorOption) *ApiError {
1✔
1286
        eopts := parseOpts(opts)
1✔
1287
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1288
                return ae
×
1289
        }
×
1290

1291
        return ApiErrors[JSConsumerEmptyFilter]
1✔
1292
}
1293

1294
// NewJSConsumerEmptyGroupNameError creates a new JSConsumerEmptyGroupName error: "Group name cannot be an empty string"
1295
func NewJSConsumerEmptyGroupNameError(opts ...ErrorOption) *ApiError {
4✔
1296
        eopts := parseOpts(opts)
4✔
1297
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1298
                return ae
×
1299
        }
×
1300

1301
        return ApiErrors[JSConsumerEmptyGroupName]
4✔
1302
}
1303

1304
// NewJSConsumerEphemeralWithDurableInSubjectError creates a new JSConsumerEphemeralWithDurableInSubjectErr error: "consumer expected to be ephemeral but detected a durable name set in subject"
1305
func NewJSConsumerEphemeralWithDurableInSubjectError(opts ...ErrorOption) *ApiError {
×
1306
        eopts := parseOpts(opts)
×
1307
        if ae, ok := eopts.err.(*ApiError); ok {
×
1308
                return ae
×
1309
        }
×
1310

1311
        return ApiErrors[JSConsumerEphemeralWithDurableInSubjectErr]
×
1312
}
1313

1314
// NewJSConsumerEphemeralWithDurableNameError creates a new JSConsumerEphemeralWithDurableNameErr error: "consumer expected to be ephemeral but a durable name was set in request"
1315
func NewJSConsumerEphemeralWithDurableNameError(opts ...ErrorOption) *ApiError {
3✔
1316
        eopts := parseOpts(opts)
3✔
1317
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1318
                return ae
×
1319
        }
×
1320

1321
        return ApiErrors[JSConsumerEphemeralWithDurableNameErr]
3✔
1322
}
1323

1324
// NewJSConsumerExistingActiveError creates a new JSConsumerExistingActiveErr error: "consumer already exists and is still active"
1325
func NewJSConsumerExistingActiveError(opts ...ErrorOption) *ApiError {
×
1326
        eopts := parseOpts(opts)
×
1327
        if ae, ok := eopts.err.(*ApiError); ok {
×
1328
                return ae
×
1329
        }
×
1330

1331
        return ApiErrors[JSConsumerExistingActiveErr]
×
1332
}
1333

1334
// NewJSConsumerFCRequiresPushError creates a new JSConsumerFCRequiresPushErr error: "consumer flow control requires a push based consumer"
1335
func NewJSConsumerFCRequiresPushError(opts ...ErrorOption) *ApiError {
×
1336
        eopts := parseOpts(opts)
×
1337
        if ae, ok := eopts.err.(*ApiError); ok {
×
1338
                return ae
×
1339
        }
×
1340

1341
        return ApiErrors[JSConsumerFCRequiresPushErr]
×
1342
}
1343

1344
// NewJSConsumerFilterNotSubsetError creates a new JSConsumerFilterNotSubsetErr error: "consumer filter subject is not a valid subset of the interest subjects"
1345
func NewJSConsumerFilterNotSubsetError(opts ...ErrorOption) *ApiError {
×
1346
        eopts := parseOpts(opts)
×
1347
        if ae, ok := eopts.err.(*ApiError); ok {
×
1348
                return ae
×
1349
        }
×
1350

1351
        return ApiErrors[JSConsumerFilterNotSubsetErr]
×
1352
}
1353

1354
// NewJSConsumerHBRequiresPushError creates a new JSConsumerHBRequiresPushErr error: "consumer idle heartbeat requires a push based consumer"
1355
func NewJSConsumerHBRequiresPushError(opts ...ErrorOption) *ApiError {
×
1356
        eopts := parseOpts(opts)
×
1357
        if ae, ok := eopts.err.(*ApiError); ok {
×
1358
                return ae
×
1359
        }
×
1360

1361
        return ApiErrors[JSConsumerHBRequiresPushErr]
×
1362
}
1363

1364
// NewJSConsumerInactiveThresholdExcessError creates a new JSConsumerInactiveThresholdExcess error: "consumer inactive threshold exceeds system limit of {limit}"
1365
func NewJSConsumerInactiveThresholdExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
2✔
1366
        eopts := parseOpts(opts)
2✔
1367
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1368
                return ae
×
1369
        }
×
1370

1371
        e := ApiErrors[JSConsumerInactiveThresholdExcess]
2✔
1372
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
2✔
1373
        return &ApiError{
2✔
1374
                Code:        e.Code,
2✔
1375
                ErrCode:     e.ErrCode,
2✔
1376
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1377
        }
2✔
1378
}
1379

1380
// NewJSConsumerInvalidDeliverSubjectError creates a new JSConsumerInvalidDeliverSubject error: "invalid push consumer deliver subject"
1381
func NewJSConsumerInvalidDeliverSubjectError(opts ...ErrorOption) *ApiError {
2✔
1382
        eopts := parseOpts(opts)
2✔
1383
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1384
                return ae
×
1385
        }
×
1386

1387
        return ApiErrors[JSConsumerInvalidDeliverSubject]
2✔
1388
}
1389

1390
// NewJSConsumerInvalidGroupNameError creates a new JSConsumerInvalidGroupNameErr error: "Valid priority group name must match A-Z, a-z, 0-9, -_/=)+ and may not exceed 16 characters"
1391
func NewJSConsumerInvalidGroupNameError(opts ...ErrorOption) *ApiError {
2✔
1392
        eopts := parseOpts(opts)
2✔
1393
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1394
                return ae
×
1395
        }
×
1396

1397
        return ApiErrors[JSConsumerInvalidGroupNameErr]
2✔
1398
}
1399

1400
// NewJSConsumerInvalidPolicyError creates a new JSConsumerInvalidPolicyErrF error: "{err}"
1401
func NewJSConsumerInvalidPolicyError(err error, opts ...ErrorOption) *ApiError {
10✔
1402
        eopts := parseOpts(opts)
10✔
1403
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1404
                return ae
×
1405
        }
×
1406

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

1416
// NewJSConsumerInvalidPriorityGroupError creates a new JSConsumerInvalidPriorityGroupErr error: "Provided priority group does not exist for this consumer"
1417
func NewJSConsumerInvalidPriorityGroupError(opts ...ErrorOption) *ApiError {
2✔
1418
        eopts := parseOpts(opts)
2✔
1419
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1420
                return ae
×
1421
        }
×
1422

1423
        return ApiErrors[JSConsumerInvalidPriorityGroupErr]
2✔
1424
}
1425

1426
// NewJSConsumerInvalidSamplingError creates a new JSConsumerInvalidSamplingErrF error: "failed to parse consumer sampling configuration: {err}"
1427
func NewJSConsumerInvalidSamplingError(err error, opts ...ErrorOption) *ApiError {
×
1428
        eopts := parseOpts(opts)
×
1429
        if ae, ok := eopts.err.(*ApiError); ok {
×
1430
                return ae
×
1431
        }
×
1432

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

1442
// NewJSConsumerMaxDeliverBackoffError creates a new JSConsumerMaxDeliverBackoffErr error: "max deliver is required to be > length of backoff values"
1443
func NewJSConsumerMaxDeliverBackoffError(opts ...ErrorOption) *ApiError {
3✔
1444
        eopts := parseOpts(opts)
3✔
1445
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1446
                return ae
×
1447
        }
×
1448

1449
        return ApiErrors[JSConsumerMaxDeliverBackoffErr]
3✔
1450
}
1451

1452
// NewJSConsumerMaxPendingAckExcessError creates a new JSConsumerMaxPendingAckExcessErrF error: "consumer max ack pending exceeds system limit of {limit}"
1453
func NewJSConsumerMaxPendingAckExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
12✔
1454
        eopts := parseOpts(opts)
12✔
1455
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
1456
                return ae
×
1457
        }
×
1458

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

1468
// NewJSConsumerMaxPendingAckPolicyRequiredError creates a new JSConsumerMaxPendingAckPolicyRequiredErr error: "consumer requires ack policy for max ack pending"
1469
func NewJSConsumerMaxPendingAckPolicyRequiredError(opts ...ErrorOption) *ApiError {
2✔
1470
        eopts := parseOpts(opts)
2✔
1471
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1472
                return ae
×
1473
        }
×
1474

1475
        return ApiErrors[JSConsumerMaxPendingAckPolicyRequiredErr]
2✔
1476
}
1477

1478
// NewJSConsumerMaxRequestBatchExceededError creates a new JSConsumerMaxRequestBatchExceededF error: "consumer max request batch exceeds server limit of {limit}"
1479
func NewJSConsumerMaxRequestBatchExceededError(limit interface{}, opts ...ErrorOption) *ApiError {
4✔
1480
        eopts := parseOpts(opts)
4✔
1481
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1482
                return ae
×
1483
        }
×
1484

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

1494
// NewJSConsumerMaxRequestBatchNegativeError creates a new JSConsumerMaxRequestBatchNegativeErr error: "consumer max request batch needs to be > 0"
1495
func NewJSConsumerMaxRequestBatchNegativeError(opts ...ErrorOption) *ApiError {
×
1496
        eopts := parseOpts(opts)
×
1497
        if ae, ok := eopts.err.(*ApiError); ok {
×
1498
                return ae
×
1499
        }
×
1500

1501
        return ApiErrors[JSConsumerMaxRequestBatchNegativeErr]
×
1502
}
1503

1504
// NewJSConsumerMaxRequestExpiresTooSmallError creates a new JSConsumerMaxRequestExpiresTooSmall error: "consumer max request expires needs to be >= 1ms"
1505
func NewJSConsumerMaxRequestExpiresTooSmallError(opts ...ErrorOption) *ApiError {
×
1506
        eopts := parseOpts(opts)
×
1507
        if ae, ok := eopts.err.(*ApiError); ok {
×
1508
                return ae
×
1509
        }
×
1510

1511
        return ApiErrors[JSConsumerMaxRequestExpiresTooSmall]
×
1512
}
1513

1514
// NewJSConsumerMaxWaitingNegativeError creates a new JSConsumerMaxWaitingNegativeErr error: "consumer max waiting needs to be positive"
1515
func NewJSConsumerMaxWaitingNegativeError(opts ...ErrorOption) *ApiError {
×
1516
        eopts := parseOpts(opts)
×
1517
        if ae, ok := eopts.err.(*ApiError); ok {
×
1518
                return ae
×
1519
        }
×
1520

1521
        return ApiErrors[JSConsumerMaxWaitingNegativeErr]
×
1522
}
1523

1524
// NewJSConsumerMetadataLengthError creates a new JSConsumerMetadataLengthErrF error: "consumer metadata exceeds maximum size of {limit}"
1525
func NewJSConsumerMetadataLengthError(limit interface{}, opts ...ErrorOption) *ApiError {
1✔
1526
        eopts := parseOpts(opts)
1✔
1527
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1528
                return ae
×
1529
        }
×
1530

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

1540
// NewJSConsumerMultipleFiltersNotAllowedError creates a new JSConsumerMultipleFiltersNotAllowed error: "consumer with multiple subject filters cannot use subject based API"
1541
func NewJSConsumerMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
1542
        eopts := parseOpts(opts)
1✔
1543
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1544
                return ae
×
1545
        }
×
1546

1547
        return ApiErrors[JSConsumerMultipleFiltersNotAllowed]
1✔
1548
}
1549

1550
// NewJSConsumerNameContainsPathSeparatorsError creates a new JSConsumerNameContainsPathSeparatorsErr error: "Consumer name can not contain path separators"
1551
func NewJSConsumerNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
8✔
1552
        eopts := parseOpts(opts)
8✔
1553
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1554
                return ae
×
1555
        }
×
1556

1557
        return ApiErrors[JSConsumerNameContainsPathSeparatorsErr]
8✔
1558
}
1559

1560
// NewJSConsumerNameExistError creates a new JSConsumerNameExistErr error: "consumer name already in use"
1561
func NewJSConsumerNameExistError(opts ...ErrorOption) *ApiError {
2✔
1562
        eopts := parseOpts(opts)
2✔
1563
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1564
                return ae
×
1565
        }
×
1566

1567
        return ApiErrors[JSConsumerNameExistErr]
2✔
1568
}
1569

1570
// NewJSConsumerNameTooLongError creates a new JSConsumerNameTooLongErrF error: "consumer name is too long, maximum allowed is {max}"
1571
func NewJSConsumerNameTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
×
1572
        eopts := parseOpts(opts)
×
1573
        if ae, ok := eopts.err.(*ApiError); ok {
×
1574
                return ae
×
1575
        }
×
1576

1577
        e := ApiErrors[JSConsumerNameTooLongErrF]
×
1578
        args := e.toReplacerArgs([]interface{}{"{max}", max})
×
1579
        return &ApiError{
×
1580
                Code:        e.Code,
×
1581
                ErrCode:     e.ErrCode,
×
1582
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1583
        }
×
1584
}
1585

1586
// NewJSConsumerNotFoundError creates a new JSConsumerNotFoundErr error: "consumer not found"
1587
func NewJSConsumerNotFoundError(opts ...ErrorOption) *ApiError {
2,824✔
1588
        eopts := parseOpts(opts)
2,824✔
1589
        if ae, ok := eopts.err.(*ApiError); ok {
2,824✔
1590
                return ae
×
1591
        }
×
1592

1593
        return ApiErrors[JSConsumerNotFoundErr]
2,824✔
1594
}
1595

1596
// NewJSConsumerOfflineError creates a new JSConsumerOfflineErr error: "consumer is offline"
1597
func NewJSConsumerOfflineError(opts ...ErrorOption) *ApiError {
6✔
1598
        eopts := parseOpts(opts)
6✔
1599
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1600
                return ae
×
1601
        }
×
1602

1603
        return ApiErrors[JSConsumerOfflineErr]
6✔
1604
}
1605

1606
// NewJSConsumerOfflineReasonError creates a new JSConsumerOfflineReasonErrF error: "consumer is offline: {err}"
1607
func NewJSConsumerOfflineReasonError(err error, opts ...ErrorOption) *ApiError {
24✔
1608
        eopts := parseOpts(opts)
24✔
1609
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
1610
                return ae
×
1611
        }
×
1612

1613
        e := ApiErrors[JSConsumerOfflineReasonErrF]
24✔
1614
        args := e.toReplacerArgs([]interface{}{"{err}", err})
24✔
1615
        return &ApiError{
24✔
1616
                Code:        e.Code,
24✔
1617
                ErrCode:     e.ErrCode,
24✔
1618
                Description: strings.NewReplacer(args...).Replace(e.Description),
24✔
1619
        }
24✔
1620
}
1621

1622
// NewJSConsumerOnMappedError creates a new JSConsumerOnMappedErr error: "consumer direct on a mapped consumer"
1623
func NewJSConsumerOnMappedError(opts ...ErrorOption) *ApiError {
×
1624
        eopts := parseOpts(opts)
×
1625
        if ae, ok := eopts.err.(*ApiError); ok {
×
1626
                return ae
×
1627
        }
×
1628

1629
        return ApiErrors[JSConsumerOnMappedErr]
×
1630
}
1631

1632
// NewJSConsumerOverlappingSubjectFiltersError creates a new JSConsumerOverlappingSubjectFilters error: "consumer subject filters cannot overlap"
1633
func NewJSConsumerOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
1✔
1634
        eopts := parseOpts(opts)
1✔
1635
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1636
                return ae
×
1637
        }
×
1638

1639
        return ApiErrors[JSConsumerOverlappingSubjectFilters]
1✔
1640
}
1641

1642
// NewJSConsumerPinnedTTLWithoutPriorityPolicyNoneError creates a new JSConsumerPinnedTTLWithoutPriorityPolicyNone error: "PinnedTTL cannot be set when PriorityPolicy is none"
1643
func NewJSConsumerPinnedTTLWithoutPriorityPolicyNoneError(opts ...ErrorOption) *ApiError {
1✔
1644
        eopts := parseOpts(opts)
1✔
1645
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1646
                return ae
×
1647
        }
×
1648

1649
        return ApiErrors[JSConsumerPinnedTTLWithoutPriorityPolicyNone]
1✔
1650
}
1651

1652
// NewJSConsumerPriorityGroupWithPolicyNoneError creates a new JSConsumerPriorityGroupWithPolicyNone error: "consumer can not have priority groups when policy is none"
1653
func NewJSConsumerPriorityGroupWithPolicyNoneError(opts ...ErrorOption) *ApiError {
1✔
1654
        eopts := parseOpts(opts)
1✔
1655
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1656
                return ae
×
1657
        }
×
1658

1659
        return ApiErrors[JSConsumerPriorityGroupWithPolicyNone]
1✔
1660
}
1661

1662
// NewJSConsumerPriorityPolicyWithoutGroupError creates a new JSConsumerPriorityPolicyWithoutGroup error: "Setting PriorityPolicy requires at least one PriorityGroup to be set"
1663
func NewJSConsumerPriorityPolicyWithoutGroupError(opts ...ErrorOption) *ApiError {
4✔
1664
        eopts := parseOpts(opts)
4✔
1665
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1666
                return ae
×
1667
        }
×
1668

1669
        return ApiErrors[JSConsumerPriorityPolicyWithoutGroup]
4✔
1670
}
1671

1672
// NewJSConsumerPullNotDurableError creates a new JSConsumerPullNotDurableErr error: "consumer in pull mode requires a durable name"
1673
func NewJSConsumerPullNotDurableError(opts ...ErrorOption) *ApiError {
×
1674
        eopts := parseOpts(opts)
×
1675
        if ae, ok := eopts.err.(*ApiError); ok {
×
1676
                return ae
×
1677
        }
×
1678

1679
        return ApiErrors[JSConsumerPullNotDurableErr]
×
1680
}
1681

1682
// NewJSConsumerPullRequiresAckError creates a new JSConsumerPullRequiresAckErr error: "consumer in pull mode requires explicit ack policy on workqueue stream"
1683
func NewJSConsumerPullRequiresAckError(opts ...ErrorOption) *ApiError {
6✔
1684
        eopts := parseOpts(opts)
6✔
1685
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1686
                return ae
×
1687
        }
×
1688

1689
        return ApiErrors[JSConsumerPullRequiresAckErr]
6✔
1690
}
1691

1692
// NewJSConsumerPullWithRateLimitError creates a new JSConsumerPullWithRateLimitErr error: "consumer in pull mode can not have rate limit set"
1693
func NewJSConsumerPullWithRateLimitError(opts ...ErrorOption) *ApiError {
1✔
1694
        eopts := parseOpts(opts)
1✔
1695
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1696
                return ae
×
1697
        }
×
1698

1699
        return ApiErrors[JSConsumerPullWithRateLimitErr]
1✔
1700
}
1701

1702
// NewJSConsumerPushMaxWaitingError creates a new JSConsumerPushMaxWaitingErr error: "consumer in push mode can not set max waiting"
1703
func NewJSConsumerPushMaxWaitingError(opts ...ErrorOption) *ApiError {
3✔
1704
        eopts := parseOpts(opts)
3✔
1705
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1706
                return ae
×
1707
        }
×
1708

1709
        return ApiErrors[JSConsumerPushMaxWaitingErr]
3✔
1710
}
1711

1712
// NewJSConsumerPushWithPriorityGroupError creates a new JSConsumerPushWithPriorityGroupErr error: "priority groups can not be used with push consumers"
1713
func NewJSConsumerPushWithPriorityGroupError(opts ...ErrorOption) *ApiError {
1✔
1714
        eopts := parseOpts(opts)
1✔
1715
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1716
                return ae
×
1717
        }
×
1718

1719
        return ApiErrors[JSConsumerPushWithPriorityGroupErr]
1✔
1720
}
1721

1722
// NewJSConsumerReplacementWithDifferentNameError creates a new JSConsumerReplacementWithDifferentNameErr error: "consumer replacement durable config not the same"
1723
func NewJSConsumerReplacementWithDifferentNameError(opts ...ErrorOption) *ApiError {
×
1724
        eopts := parseOpts(opts)
×
1725
        if ae, ok := eopts.err.(*ApiError); ok {
×
1726
                return ae
×
1727
        }
×
1728

1729
        return ApiErrors[JSConsumerReplacementWithDifferentNameErr]
×
1730
}
1731

1732
// NewJSConsumerReplayPolicyInvalidError creates a new JSConsumerReplayPolicyInvalidErr error: "consumer replay policy invalid"
1733
func NewJSConsumerReplayPolicyInvalidError(opts ...ErrorOption) *ApiError {
2✔
1734
        eopts := parseOpts(opts)
2✔
1735
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1736
                return ae
×
1737
        }
×
1738

1739
        return ApiErrors[JSConsumerReplayPolicyInvalidErr]
2✔
1740
}
1741

1742
// NewJSConsumerReplicasExceedsStreamError creates a new JSConsumerReplicasExceedsStream error: "consumer config replica count exceeds parent stream"
1743
func NewJSConsumerReplicasExceedsStreamError(opts ...ErrorOption) *ApiError {
1✔
1744
        eopts := parseOpts(opts)
1✔
1745
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1746
                return ae
×
1747
        }
×
1748

1749
        return ApiErrors[JSConsumerReplicasExceedsStream]
1✔
1750
}
1751

1752
// NewJSConsumerReplicasShouldMatchStreamError creates a new JSConsumerReplicasShouldMatchStream error: "consumer config replicas must match interest retention stream's replicas"
1753
func NewJSConsumerReplicasShouldMatchStreamError(opts ...ErrorOption) *ApiError {
2✔
1754
        eopts := parseOpts(opts)
2✔
1755
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1756
                return ae
×
1757
        }
×
1758

1759
        return ApiErrors[JSConsumerReplicasShouldMatchStream]
2✔
1760
}
1761

1762
// NewJSConsumerSmallHeartbeatError creates a new JSConsumerSmallHeartbeatErr error: "consumer idle heartbeat needs to be >= 100ms"
1763
func NewJSConsumerSmallHeartbeatError(opts ...ErrorOption) *ApiError {
1✔
1764
        eopts := parseOpts(opts)
1✔
1765
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1766
                return ae
×
1767
        }
×
1768

1769
        return ApiErrors[JSConsumerSmallHeartbeatErr]
1✔
1770
}
1771

1772
// NewJSConsumerStoreFailedError creates a new JSConsumerStoreFailedErrF error: "error creating store for consumer: {err}"
1773
func NewJSConsumerStoreFailedError(err error, opts ...ErrorOption) *ApiError {
9✔
1774
        eopts := parseOpts(opts)
9✔
1775
        if ae, ok := eopts.err.(*ApiError); ok {
9✔
1776
                return ae
×
1777
        }
×
1778

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

1788
// NewJSConsumerWQConsumerNotDeliverAllError creates a new JSConsumerWQConsumerNotDeliverAllErr error: "consumer must be deliver all on workqueue stream"
1789
func NewJSConsumerWQConsumerNotDeliverAllError(opts ...ErrorOption) *ApiError {
×
1790
        eopts := parseOpts(opts)
×
1791
        if ae, ok := eopts.err.(*ApiError); ok {
×
1792
                return ae
×
1793
        }
×
1794

1795
        return ApiErrors[JSConsumerWQConsumerNotDeliverAllErr]
×
1796
}
1797

1798
// NewJSConsumerWQConsumerNotUniqueError creates a new JSConsumerWQConsumerNotUniqueErr error: "filtered consumer not unique on workqueue stream"
1799
func NewJSConsumerWQConsumerNotUniqueError(opts ...ErrorOption) *ApiError {
11✔
1800
        eopts := parseOpts(opts)
11✔
1801
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
1802
                return ae
×
1803
        }
×
1804

1805
        return ApiErrors[JSConsumerWQConsumerNotUniqueErr]
11✔
1806
}
1807

1808
// NewJSConsumerWQMultipleUnfilteredError creates a new JSConsumerWQMultipleUnfilteredErr error: "multiple non-filtered consumers not allowed on workqueue stream"
1809
func NewJSConsumerWQMultipleUnfilteredError(opts ...ErrorOption) *ApiError {
2✔
1810
        eopts := parseOpts(opts)
2✔
1811
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1812
                return ae
×
1813
        }
×
1814

1815
        return ApiErrors[JSConsumerWQMultipleUnfilteredErr]
2✔
1816
}
1817

1818
// NewJSConsumerWQRequiresExplicitAckError creates a new JSConsumerWQRequiresExplicitAckErr error: "workqueue stream requires explicit ack"
1819
func NewJSConsumerWQRequiresExplicitAckError(opts ...ErrorOption) *ApiError {
×
1820
        eopts := parseOpts(opts)
×
1821
        if ae, ok := eopts.err.(*ApiError); ok {
×
1822
                return ae
×
1823
        }
×
1824

1825
        return ApiErrors[JSConsumerWQRequiresExplicitAckErr]
×
1826
}
1827

1828
// NewJSConsumerWithFlowControlNeedsHeartbeatsError creates a new JSConsumerWithFlowControlNeedsHeartbeats error: "consumer with flow control also needs heartbeats"
1829
func NewJSConsumerWithFlowControlNeedsHeartbeatsError(opts ...ErrorOption) *ApiError {
4✔
1830
        eopts := parseOpts(opts)
4✔
1831
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1832
                return ae
×
1833
        }
×
1834

1835
        return ApiErrors[JSConsumerWithFlowControlNeedsHeartbeats]
4✔
1836
}
1837

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

1845
        return ApiErrors[JSInsufficientResourcesErr]
12✔
1846
}
1847

1848
// NewJSInvalidJSONError creates a new JSInvalidJSONErr error: "invalid JSON: {err}"
1849
func NewJSInvalidJSONError(err error, opts ...ErrorOption) *ApiError {
8✔
1850
        eopts := parseOpts(opts)
8✔
1851
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1852
                return ae
×
1853
        }
×
1854

1855
        e := ApiErrors[JSInvalidJSONErr]
8✔
1856
        args := e.toReplacerArgs([]interface{}{"{err}", err})
8✔
1857
        return &ApiError{
8✔
1858
                Code:        e.Code,
8✔
1859
                ErrCode:     e.ErrCode,
8✔
1860
                Description: strings.NewReplacer(args...).Replace(e.Description),
8✔
1861
        }
8✔
1862
}
1863

1864
// NewJSMaximumConsumersLimitError creates a new JSMaximumConsumersLimitErr error: "maximum consumers limit reached"
1865
func NewJSMaximumConsumersLimitError(opts ...ErrorOption) *ApiError {
31✔
1866
        eopts := parseOpts(opts)
31✔
1867
        if ae, ok := eopts.err.(*ApiError); ok {
31✔
1868
                return ae
×
1869
        }
×
1870

1871
        return ApiErrors[JSMaximumConsumersLimitErr]
31✔
1872
}
1873

1874
// NewJSMaximumStreamsLimitError creates a new JSMaximumStreamsLimitErr error: "maximum number of streams reached"
1875
func NewJSMaximumStreamsLimitError(opts ...ErrorOption) *ApiError {
16✔
1876
        eopts := parseOpts(opts)
16✔
1877
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
1878
                return ae
×
1879
        }
×
1880

1881
        return ApiErrors[JSMaximumStreamsLimitErr]
16✔
1882
}
1883

1884
// NewJSMemoryResourcesExceededError creates a new JSMemoryResourcesExceededErr error: "insufficient memory resources available"
1885
func NewJSMemoryResourcesExceededError(opts ...ErrorOption) *ApiError {
4✔
1886
        eopts := parseOpts(opts)
4✔
1887
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1888
                return ae
×
1889
        }
×
1890

1891
        return ApiErrors[JSMemoryResourcesExceededErr]
4✔
1892
}
1893

1894
// NewJSMessageCounterBrokenError creates a new JSMessageCounterBrokenErr error: "message counter is broken"
1895
func NewJSMessageCounterBrokenError(opts ...ErrorOption) *ApiError {
4✔
1896
        eopts := parseOpts(opts)
4✔
1897
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1898
                return ae
×
1899
        }
×
1900

1901
        return ApiErrors[JSMessageCounterBrokenErr]
4✔
1902
}
1903

1904
// NewJSMessageIncrDisabledError creates a new JSMessageIncrDisabledErr error: "message counters is disabled"
1905
func NewJSMessageIncrDisabledError(opts ...ErrorOption) *ApiError {
4✔
1906
        eopts := parseOpts(opts)
4✔
1907
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1908
                return ae
×
1909
        }
×
1910

1911
        return ApiErrors[JSMessageIncrDisabledErr]
4✔
1912
}
1913

1914
// NewJSMessageIncrInvalidError creates a new JSMessageIncrInvalidErr error: "message counter increment is invalid"
1915
func NewJSMessageIncrInvalidError(opts ...ErrorOption) *ApiError {
24✔
1916
        eopts := parseOpts(opts)
24✔
1917
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
1918
                return ae
×
1919
        }
×
1920

1921
        return ApiErrors[JSMessageIncrInvalidErr]
24✔
1922
}
1923

1924
// NewJSMessageIncrMissingError creates a new JSMessageIncrMissingErr error: "message counter increment is missing"
1925
func NewJSMessageIncrMissingError(opts ...ErrorOption) *ApiError {
8✔
1926
        eopts := parseOpts(opts)
8✔
1927
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1928
                return ae
×
1929
        }
×
1930

1931
        return ApiErrors[JSMessageIncrMissingErr]
8✔
1932
}
1933

1934
// NewJSMessageIncrPayloadError creates a new JSMessageIncrPayloadErr error: "message counter has payload"
1935
func NewJSMessageIncrPayloadError(opts ...ErrorOption) *ApiError {
4✔
1936
        eopts := parseOpts(opts)
4✔
1937
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1938
                return ae
×
1939
        }
×
1940

1941
        return ApiErrors[JSMessageIncrPayloadErr]
4✔
1942
}
1943

1944
// NewJSMessageSchedulesDisabledError creates a new JSMessageSchedulesDisabledErr error: "message schedules is disabled"
1945
func NewJSMessageSchedulesDisabledError(opts ...ErrorOption) *ApiError {
20✔
1946
        eopts := parseOpts(opts)
20✔
1947
        if ae, ok := eopts.err.(*ApiError); ok {
20✔
1948
                return ae
×
1949
        }
×
1950

1951
        return ApiErrors[JSMessageSchedulesDisabledErr]
20✔
1952
}
1953

1954
// NewJSMessageSchedulesPatternInvalidError creates a new JSMessageSchedulesPatternInvalidErr error: "message schedules pattern is invalid"
1955
func NewJSMessageSchedulesPatternInvalidError(opts ...ErrorOption) *ApiError {
15✔
1956
        eopts := parseOpts(opts)
15✔
1957
        if ae, ok := eopts.err.(*ApiError); ok {
15✔
1958
                return ae
×
1959
        }
×
1960

1961
        return ApiErrors[JSMessageSchedulesPatternInvalidErr]
15✔
1962
}
1963

1964
// NewJSMessageSchedulesRollupInvalidError creates a new JSMessageSchedulesRollupInvalidErr error: "message schedules invalid rollup"
1965
func NewJSMessageSchedulesRollupInvalidError(opts ...ErrorOption) *ApiError {
8✔
1966
        eopts := parseOpts(opts)
8✔
1967
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1968
                return ae
×
1969
        }
×
1970

1971
        return ApiErrors[JSMessageSchedulesRollupInvalidErr]
8✔
1972
}
1973

1974
// NewJSMessageSchedulesSourceInvalidError creates a new JSMessageSchedulesSourceInvalidErr error: "message schedules source is invalid"
1975
func NewJSMessageSchedulesSourceInvalidError(opts ...ErrorOption) *ApiError {
32✔
1976
        eopts := parseOpts(opts)
32✔
1977
        if ae, ok := eopts.err.(*ApiError); ok {
32✔
1978
                return ae
×
1979
        }
×
1980

1981
        return ApiErrors[JSMessageSchedulesSourceInvalidErr]
32✔
1982
}
1983

1984
// NewJSMessageSchedulesTTLInvalidError creates a new JSMessageSchedulesTTLInvalidErr error: "message schedules invalid per-message TTL"
1985
func NewJSMessageSchedulesTTLInvalidError(opts ...ErrorOption) *ApiError {
10✔
1986
        eopts := parseOpts(opts)
10✔
1987
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1988
                return ae
×
1989
        }
×
1990

1991
        return ApiErrors[JSMessageSchedulesTTLInvalidErr]
10✔
1992
}
1993

1994
// NewJSMessageSchedulesTargetInvalidError creates a new JSMessageSchedulesTargetInvalidErr error: "message schedules target is invalid"
1995
func NewJSMessageSchedulesTargetInvalidError(opts ...ErrorOption) *ApiError {
30✔
1996
        eopts := parseOpts(opts)
30✔
1997
        if ae, ok := eopts.err.(*ApiError); ok {
30✔
1998
                return ae
×
1999
        }
×
2000

2001
        return ApiErrors[JSMessageSchedulesTargetInvalidErr]
30✔
2002
}
2003

2004
// NewJSMessageTTLDisabledError creates a new JSMessageTTLDisabledErr error: "per-message TTL is disabled"
2005
func NewJSMessageTTLDisabledError(opts ...ErrorOption) *ApiError {
16✔
2006
        eopts := parseOpts(opts)
16✔
2007
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2008
                return ae
×
2009
        }
×
2010

2011
        return ApiErrors[JSMessageTTLDisabledErr]
16✔
2012
}
2013

2014
// NewJSMessageTTLInvalidError creates a new JSMessageTTLInvalidErr error: "invalid per-message TTL"
2015
func NewJSMessageTTLInvalidError(opts ...ErrorOption) *ApiError {
23✔
2016
        eopts := parseOpts(opts)
23✔
2017
        if ae, ok := eopts.err.(*ApiError); ok {
23✔
2018
                return ae
×
2019
        }
×
2020

2021
        return ApiErrors[JSMessageTTLInvalidErr]
23✔
2022
}
2023

2024
// NewJSMirrorConsumerSetupFailedError creates a new JSMirrorConsumerSetupFailedErrF error: "{err}"
2025
func NewJSMirrorConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
2026
        eopts := parseOpts(opts)
×
2027
        if ae, ok := eopts.err.(*ApiError); ok {
×
2028
                return ae
×
2029
        }
×
2030

2031
        e := ApiErrors[JSMirrorConsumerSetupFailedErrF]
×
2032
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2033
        return &ApiError{
×
2034
                Code:        e.Code,
×
2035
                ErrCode:     e.ErrCode,
×
2036
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2037
        }
×
2038
}
2039

2040
// NewJSMirrorInvalidStreamNameError creates a new JSMirrorInvalidStreamName error: "mirrored stream name is invalid"
2041
func NewJSMirrorInvalidStreamNameError(opts ...ErrorOption) *ApiError {
×
2042
        eopts := parseOpts(opts)
×
2043
        if ae, ok := eopts.err.(*ApiError); ok {
×
2044
                return ae
×
2045
        }
×
2046

2047
        return ApiErrors[JSMirrorInvalidStreamName]
×
2048
}
2049

2050
// NewJSMirrorInvalidSubjectFilterError creates a new JSMirrorInvalidSubjectFilter error: "mirror transform source: {err}"
2051
func NewJSMirrorInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
2✔
2052
        eopts := parseOpts(opts)
2✔
2053
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2054
                return ae
×
2055
        }
×
2056

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

2066
// NewJSMirrorInvalidTransformDestinationError creates a new JSMirrorInvalidTransformDestination error: "mirror transform: {err}"
2067
func NewJSMirrorInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
2✔
2068
        eopts := parseOpts(opts)
2✔
2069
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2070
                return ae
×
2071
        }
×
2072

2073
        e := ApiErrors[JSMirrorInvalidTransformDestination]
2✔
2074
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2✔
2075
        return &ApiError{
2✔
2076
                Code:        e.Code,
2✔
2077
                ErrCode:     e.ErrCode,
2✔
2078
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2079
        }
2✔
2080
}
2081

2082
// NewJSMirrorMaxMessageSizeTooBigError creates a new JSMirrorMaxMessageSizeTooBigErr error: "stream mirror must have max message size >= source"
2083
func NewJSMirrorMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
2084
        eopts := parseOpts(opts)
×
2085
        if ae, ok := eopts.err.(*ApiError); ok {
×
2086
                return ae
×
2087
        }
×
2088

2089
        return ApiErrors[JSMirrorMaxMessageSizeTooBigErr]
×
2090
}
2091

2092
// NewJSMirrorMultipleFiltersNotAllowedError creates a new JSMirrorMultipleFiltersNotAllowed error: "mirror with multiple subject transforms cannot also have a single subject filter"
2093
func NewJSMirrorMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
2094
        eopts := parseOpts(opts)
1✔
2095
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2096
                return ae
×
2097
        }
×
2098

2099
        return ApiErrors[JSMirrorMultipleFiltersNotAllowed]
1✔
2100
}
2101

2102
// NewJSMirrorOverlappingSubjectFiltersError creates a new JSMirrorOverlappingSubjectFilters error: "mirror subject filters can not overlap"
2103
func NewJSMirrorOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
2✔
2104
        eopts := parseOpts(opts)
2✔
2105
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2106
                return ae
×
2107
        }
×
2108

2109
        return ApiErrors[JSMirrorOverlappingSubjectFilters]
2✔
2110
}
2111

2112
// NewJSMirrorWithAtomicPublishError creates a new JSMirrorWithAtomicPublishErr error: "stream mirrors can not also use atomic publishing"
2113
func NewJSMirrorWithAtomicPublishError(opts ...ErrorOption) *ApiError {
4✔
2114
        eopts := parseOpts(opts)
4✔
2115
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2116
                return ae
×
2117
        }
×
2118

2119
        return ApiErrors[JSMirrorWithAtomicPublishErr]
4✔
2120
}
2121

2122
// NewJSMirrorWithCountersError creates a new JSMirrorWithCountersErr error: "stream mirrors can not also calculate counters"
2123
func NewJSMirrorWithCountersError(opts ...ErrorOption) *ApiError {
4✔
2124
        eopts := parseOpts(opts)
4✔
2125
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2126
                return ae
×
2127
        }
×
2128

2129
        return ApiErrors[JSMirrorWithCountersErr]
4✔
2130
}
2131

2132
// NewJSMirrorWithFirstSeqError creates a new JSMirrorWithFirstSeqErr error: "stream mirrors can not have first sequence configured"
2133
func NewJSMirrorWithFirstSeqError(opts ...ErrorOption) *ApiError {
2✔
2134
        eopts := parseOpts(opts)
2✔
2135
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2136
                return ae
×
2137
        }
×
2138

2139
        return ApiErrors[JSMirrorWithFirstSeqErr]
2✔
2140
}
2141

2142
// NewJSMirrorWithMsgSchedulesError creates a new JSMirrorWithMsgSchedulesErr error: "stream mirrors can not also schedule messages"
2143
func NewJSMirrorWithMsgSchedulesError(opts ...ErrorOption) *ApiError {
2✔
2144
        eopts := parseOpts(opts)
2✔
2145
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2146
                return ae
×
2147
        }
×
2148

2149
        return ApiErrors[JSMirrorWithMsgSchedulesErr]
2✔
2150
}
2151

2152
// NewJSMirrorWithSourcesError creates a new JSMirrorWithSourcesErr error: "stream mirrors can not also contain other sources"
2153
func NewJSMirrorWithSourcesError(opts ...ErrorOption) *ApiError {
×
2154
        eopts := parseOpts(opts)
×
2155
        if ae, ok := eopts.err.(*ApiError); ok {
×
2156
                return ae
×
2157
        }
×
2158

2159
        return ApiErrors[JSMirrorWithSourcesErr]
×
2160
}
2161

2162
// NewJSMirrorWithStartSeqAndTimeError creates a new JSMirrorWithStartSeqAndTimeErr error: "stream mirrors can not have both start seq and start time configured"
2163
func NewJSMirrorWithStartSeqAndTimeError(opts ...ErrorOption) *ApiError {
×
2164
        eopts := parseOpts(opts)
×
2165
        if ae, ok := eopts.err.(*ApiError); ok {
×
2166
                return ae
×
2167
        }
×
2168

2169
        return ApiErrors[JSMirrorWithStartSeqAndTimeErr]
×
2170
}
2171

2172
// NewJSMirrorWithSubjectFiltersError creates a new JSMirrorWithSubjectFiltersErr error: "stream mirrors can not contain filtered subjects"
2173
func NewJSMirrorWithSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
2174
        eopts := parseOpts(opts)
×
2175
        if ae, ok := eopts.err.(*ApiError); ok {
×
2176
                return ae
×
2177
        }
×
2178

2179
        return ApiErrors[JSMirrorWithSubjectFiltersErr]
×
2180
}
2181

2182
// NewJSMirrorWithSubjectsError creates a new JSMirrorWithSubjectsErr error: "stream mirrors can not contain subjects"
2183
func NewJSMirrorWithSubjectsError(opts ...ErrorOption) *ApiError {
2✔
2184
        eopts := parseOpts(opts)
2✔
2185
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2186
                return ae
×
2187
        }
×
2188

2189
        return ApiErrors[JSMirrorWithSubjectsErr]
2✔
2190
}
2191

2192
// NewJSNoAccountError creates a new JSNoAccountErr error: "account not found"
2193
func NewJSNoAccountError(opts ...ErrorOption) *ApiError {
1✔
2194
        eopts := parseOpts(opts)
1✔
2195
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2196
                return ae
×
2197
        }
×
2198

2199
        return ApiErrors[JSNoAccountErr]
1✔
2200
}
2201

2202
// NewJSNoLimitsError creates a new JSNoLimitsErr error: "no JetStream default or applicable tiered limit present"
2203
func NewJSNoLimitsError(opts ...ErrorOption) *ApiError {
4✔
2204
        eopts := parseOpts(opts)
4✔
2205
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2206
                return ae
×
2207
        }
×
2208

2209
        return ApiErrors[JSNoLimitsErr]
4✔
2210
}
2211

2212
// NewJSNoMessageFoundError creates a new JSNoMessageFoundErr error: "no message found"
2213
func NewJSNoMessageFoundError(opts ...ErrorOption) *ApiError {
846✔
2214
        eopts := parseOpts(opts)
846✔
2215
        if ae, ok := eopts.err.(*ApiError); ok {
846✔
2216
                return ae
×
2217
        }
×
2218

2219
        return ApiErrors[JSNoMessageFoundErr]
846✔
2220
}
2221

2222
// NewJSNotEmptyRequestError creates a new JSNotEmptyRequestErr error: "expected an empty request payload"
2223
func NewJSNotEmptyRequestError(opts ...ErrorOption) *ApiError {
3✔
2224
        eopts := parseOpts(opts)
3✔
2225
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2226
                return ae
×
2227
        }
×
2228

2229
        return ApiErrors[JSNotEmptyRequestErr]
3✔
2230
}
2231

2232
// NewJSNotEnabledError creates a new JSNotEnabledErr error: "JetStream not enabled"
2233
func NewJSNotEnabledError(opts ...ErrorOption) *ApiError {
11✔
2234
        eopts := parseOpts(opts)
11✔
2235
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
2236
                return ae
×
2237
        }
×
2238

2239
        return ApiErrors[JSNotEnabledErr]
11✔
2240
}
2241

2242
// NewJSNotEnabledForAccountError creates a new JSNotEnabledForAccountErr error: "JetStream not enabled for account"
2243
func NewJSNotEnabledForAccountError(opts ...ErrorOption) *ApiError {
316✔
2244
        eopts := parseOpts(opts)
316✔
2245
        if ae, ok := eopts.err.(*ApiError); ok {
316✔
2246
                return ae
×
2247
        }
×
2248

2249
        return ApiErrors[JSNotEnabledForAccountErr]
316✔
2250
}
2251

2252
// NewJSPedanticError creates a new JSPedanticErrF error: "pedantic mode: {err}"
2253
func NewJSPedanticError(err error, opts ...ErrorOption) *ApiError {
36✔
2254
        eopts := parseOpts(opts)
36✔
2255
        if ae, ok := eopts.err.(*ApiError); ok {
36✔
2256
                return ae
×
2257
        }
×
2258

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

2268
// NewJSPeerRemapError creates a new JSPeerRemapErr error: "peer remap failed"
2269
func NewJSPeerRemapError(opts ...ErrorOption) *ApiError {
5✔
2270
        eopts := parseOpts(opts)
5✔
2271
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2272
                return ae
1✔
2273
        }
1✔
2274

2275
        return ApiErrors[JSPeerRemapErr]
4✔
2276
}
2277

2278
// NewJSRaftGeneralError creates a new JSRaftGeneralErrF error: "{err}"
2279
func NewJSRaftGeneralError(err error, opts ...ErrorOption) *ApiError {
×
2280
        eopts := parseOpts(opts)
×
2281
        if ae, ok := eopts.err.(*ApiError); ok {
×
2282
                return ae
×
2283
        }
×
2284

2285
        e := ApiErrors[JSRaftGeneralErrF]
×
2286
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2287
        return &ApiError{
×
2288
                Code:        e.Code,
×
2289
                ErrCode:     e.ErrCode,
×
2290
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2291
        }
×
2292
}
2293

2294
// NewJSReplicasCountCannotBeNegativeError creates a new JSReplicasCountCannotBeNegative error: "replicas count cannot be negative"
2295
func NewJSReplicasCountCannotBeNegativeError(opts ...ErrorOption) *ApiError {
16✔
2296
        eopts := parseOpts(opts)
16✔
2297
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2298
                return ae
×
2299
        }
×
2300

2301
        return ApiErrors[JSReplicasCountCannotBeNegative]
16✔
2302
}
2303

2304
// NewJSRequiredApiLevelError creates a new JSRequiredApiLevelErr error: "JetStream minimum api level required"
2305
func NewJSRequiredApiLevelError(opts ...ErrorOption) *ApiError {
44✔
2306
        eopts := parseOpts(opts)
44✔
2307
        if ae, ok := eopts.err.(*ApiError); ok {
44✔
2308
                return ae
×
2309
        }
×
2310

2311
        return ApiErrors[JSRequiredApiLevelErr]
44✔
2312
}
2313

2314
// NewJSRestoreSubscribeFailedError creates a new JSRestoreSubscribeFailedErrF error: "JetStream unable to subscribe to restore snapshot {subject}: {err}"
2315
func NewJSRestoreSubscribeFailedError(err error, subject interface{}, opts ...ErrorOption) *ApiError {
1✔
2316
        eopts := parseOpts(opts)
1✔
2317
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2318
                return ae
×
2319
        }
×
2320

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

2330
// NewJSSequenceNotFoundError creates a new JSSequenceNotFoundErrF error: "sequence {seq} not found"
2331
func NewJSSequenceNotFoundError(seq uint64, opts ...ErrorOption) *ApiError {
1,128✔
2332
        eopts := parseOpts(opts)
1,128✔
2333
        if ae, ok := eopts.err.(*ApiError); ok {
1,128✔
2334
                return ae
×
2335
        }
×
2336

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

2346
// NewJSSnapshotDeliverSubjectInvalidError creates a new JSSnapshotDeliverSubjectInvalidErr error: "deliver subject not valid"
2347
func NewJSSnapshotDeliverSubjectInvalidError(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[JSSnapshotDeliverSubjectInvalidErr]
1✔
2354
}
2355

2356
// NewJSSourceConsumerSetupFailedError creates a new JSSourceConsumerSetupFailedErrF error: "{err}"
2357
func NewJSSourceConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
2358
        eopts := parseOpts(opts)
×
2359
        if ae, ok := eopts.err.(*ApiError); ok {
×
2360
                return ae
×
2361
        }
×
2362

2363
        e := ApiErrors[JSSourceConsumerSetupFailedErrF]
×
2364
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2365
        return &ApiError{
×
2366
                Code:        e.Code,
×
2367
                ErrCode:     e.ErrCode,
×
2368
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2369
        }
×
2370
}
2371

2372
// NewJSSourceDuplicateDetectedError creates a new JSSourceDuplicateDetected error: "duplicate source configuration detected"
2373
func NewJSSourceDuplicateDetectedError(opts ...ErrorOption) *ApiError {
×
2374
        eopts := parseOpts(opts)
×
2375
        if ae, ok := eopts.err.(*ApiError); ok {
×
2376
                return ae
×
2377
        }
×
2378

2379
        return ApiErrors[JSSourceDuplicateDetected]
×
2380
}
2381

2382
// NewJSSourceInvalidStreamNameError creates a new JSSourceInvalidStreamName error: "sourced stream name is invalid"
2383
func NewJSSourceInvalidStreamNameError(opts ...ErrorOption) *ApiError {
2✔
2384
        eopts := parseOpts(opts)
2✔
2385
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2386
                return ae
×
2387
        }
×
2388

2389
        return ApiErrors[JSSourceInvalidStreamName]
2✔
2390
}
2391

2392
// NewJSSourceInvalidSubjectFilterError creates a new JSSourceInvalidSubjectFilter error: "source transform source: {err}"
2393
func NewJSSourceInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
1✔
2394
        eopts := parseOpts(opts)
1✔
2395
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2396
                return ae
×
2397
        }
×
2398

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

2408
// NewJSSourceInvalidTransformDestinationError creates a new JSSourceInvalidTransformDestination error: "source transform: {err}"
2409
func NewJSSourceInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
2410
        eopts := parseOpts(opts)
1✔
2411
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2412
                return ae
×
2413
        }
×
2414

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

2424
// NewJSSourceMaxMessageSizeTooBigError creates a new JSSourceMaxMessageSizeTooBigErr error: "stream source must have max message size >= target"
2425
func NewJSSourceMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
2426
        eopts := parseOpts(opts)
×
2427
        if ae, ok := eopts.err.(*ApiError); ok {
×
2428
                return ae
×
2429
        }
×
2430

2431
        return ApiErrors[JSSourceMaxMessageSizeTooBigErr]
×
2432
}
2433

2434
// NewJSSourceMultipleFiltersNotAllowedError creates a new JSSourceMultipleFiltersNotAllowed error: "source with multiple subject transforms cannot also have a single subject filter"
2435
func NewJSSourceMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
×
2436
        eopts := parseOpts(opts)
×
2437
        if ae, ok := eopts.err.(*ApiError); ok {
×
2438
                return ae
×
2439
        }
×
2440

2441
        return ApiErrors[JSSourceMultipleFiltersNotAllowed]
×
2442
}
2443

2444
// NewJSSourceOverlappingSubjectFiltersError creates a new JSSourceOverlappingSubjectFilters error: "source filters can not overlap"
2445
func NewJSSourceOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
2446
        eopts := parseOpts(opts)
×
2447
        if ae, ok := eopts.err.(*ApiError); ok {
×
2448
                return ae
×
2449
        }
×
2450

2451
        return ApiErrors[JSSourceOverlappingSubjectFilters]
×
2452
}
2453

2454
// NewJSSourceWithMsgSchedulesError creates a new JSSourceWithMsgSchedulesErr error: "stream source can not also schedule messages"
2455
func NewJSSourceWithMsgSchedulesError(opts ...ErrorOption) *ApiError {
2✔
2456
        eopts := parseOpts(opts)
2✔
2457
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2458
                return ae
×
2459
        }
×
2460

2461
        return ApiErrors[JSSourceWithMsgSchedulesErr]
2✔
2462
}
2463

2464
// NewJSStorageResourcesExceededError creates a new JSStorageResourcesExceededErr error: "insufficient storage resources available"
2465
func NewJSStorageResourcesExceededError(opts ...ErrorOption) *ApiError {
23✔
2466
        eopts := parseOpts(opts)
23✔
2467
        if ae, ok := eopts.err.(*ApiError); ok {
23✔
2468
                return ae
×
2469
        }
×
2470

2471
        return ApiErrors[JSStorageResourcesExceededErr]
23✔
2472
}
2473

2474
// NewJSStreamAssignmentError creates a new JSStreamAssignmentErrF error: "{err}"
2475
func NewJSStreamAssignmentError(err error, opts ...ErrorOption) *ApiError {
×
2476
        eopts := parseOpts(opts)
×
2477
        if ae, ok := eopts.err.(*ApiError); ok {
×
2478
                return ae
×
2479
        }
×
2480

2481
        e := ApiErrors[JSStreamAssignmentErrF]
×
2482
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2483
        return &ApiError{
×
2484
                Code:        e.Code,
×
2485
                ErrCode:     e.ErrCode,
×
2486
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2487
        }
×
2488
}
2489

2490
// NewJSStreamCreateError creates a new JSStreamCreateErrF error: "{err}"
2491
func NewJSStreamCreateError(err error, opts ...ErrorOption) *ApiError {
58✔
2492
        eopts := parseOpts(opts)
58✔
2493
        if ae, ok := eopts.err.(*ApiError); ok {
113✔
2494
                return ae
55✔
2495
        }
55✔
2496

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

2506
// NewJSStreamDeleteError creates a new JSStreamDeleteErrF error: "{err}"
2507
func NewJSStreamDeleteError(err error, opts ...ErrorOption) *ApiError {
×
2508
        eopts := parseOpts(opts)
×
2509
        if ae, ok := eopts.err.(*ApiError); ok {
×
2510
                return ae
×
2511
        }
×
2512

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

2522
// NewJSStreamDuplicateMessageConflictError creates a new JSStreamDuplicateMessageConflict error: "duplicate message id is in process"
2523
func NewJSStreamDuplicateMessageConflictError(opts ...ErrorOption) *ApiError {
17✔
2524
        eopts := parseOpts(opts)
17✔
2525
        if ae, ok := eopts.err.(*ApiError); ok {
17✔
2526
                return ae
×
2527
        }
×
2528

2529
        return ApiErrors[JSStreamDuplicateMessageConflict]
17✔
2530
}
2531

2532
// NewJSStreamExpectedLastSeqPerSubjectInvalidError creates a new JSStreamExpectedLastSeqPerSubjectInvalid error: "missing sequence for expected last sequence per subject"
2533
func NewJSStreamExpectedLastSeqPerSubjectInvalidError(opts ...ErrorOption) *ApiError {
8✔
2534
        eopts := parseOpts(opts)
8✔
2535
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
2536
                return ae
×
2537
        }
×
2538

2539
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectInvalid]
8✔
2540
}
2541

2542
// NewJSStreamExpectedLastSeqPerSubjectNotReadyError creates a new JSStreamExpectedLastSeqPerSubjectNotReady error: "expected last sequence per subject temporarily unavailable"
2543
func NewJSStreamExpectedLastSeqPerSubjectNotReadyError(opts ...ErrorOption) *ApiError {
×
2544
        eopts := parseOpts(opts)
×
2545
        if ae, ok := eopts.err.(*ApiError); ok {
×
2546
                return ae
×
2547
        }
×
2548

2549
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectNotReady]
×
2550
}
2551

2552
// NewJSStreamExternalApiOverlapError creates a new JSStreamExternalApiOverlapErrF error: "stream external api prefix {prefix} must not overlap with {subject}"
2553
func NewJSStreamExternalApiOverlapError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
2✔
2554
        eopts := parseOpts(opts)
2✔
2555
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2556
                return ae
×
2557
        }
×
2558

2559
        e := ApiErrors[JSStreamExternalApiOverlapErrF]
2✔
2560
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
2✔
2561
        return &ApiError{
2✔
2562
                Code:        e.Code,
2✔
2563
                ErrCode:     e.ErrCode,
2✔
2564
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2565
        }
2✔
2566
}
2567

2568
// NewJSStreamExternalDelPrefixOverlapsError creates a new JSStreamExternalDelPrefixOverlapsErrF error: "stream external delivery prefix {prefix} overlaps with stream subject {subject}"
2569
func NewJSStreamExternalDelPrefixOverlapsError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
×
2570
        eopts := parseOpts(opts)
×
2571
        if ae, ok := eopts.err.(*ApiError); ok {
×
2572
                return ae
×
2573
        }
×
2574

2575
        e := ApiErrors[JSStreamExternalDelPrefixOverlapsErrF]
×
2576
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
×
2577
        return &ApiError{
×
2578
                Code:        e.Code,
×
2579
                ErrCode:     e.ErrCode,
×
2580
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2581
        }
×
2582
}
2583

2584
// NewJSStreamGeneralError creates a new JSStreamGeneralErrorF error: "{err}"
2585
func NewJSStreamGeneralError(err error, opts ...ErrorOption) *ApiError {
3✔
2586
        eopts := parseOpts(opts)
3✔
2587
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2588
                return ae
×
2589
        }
×
2590

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

2600
// NewJSStreamHeaderExceedsMaximumError creates a new JSStreamHeaderExceedsMaximumErr error: "header size exceeds maximum allowed of 64k"
2601
func NewJSStreamHeaderExceedsMaximumError(opts ...ErrorOption) *ApiError {
1✔
2602
        eopts := parseOpts(opts)
1✔
2603
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2604
                return ae
×
2605
        }
×
2606

2607
        return ApiErrors[JSStreamHeaderExceedsMaximumErr]
1✔
2608
}
2609

2610
// NewJSStreamInfoMaxSubjectsError creates a new JSStreamInfoMaxSubjectsErr error: "subject details would exceed maximum allowed"
2611
func NewJSStreamInfoMaxSubjectsError(opts ...ErrorOption) *ApiError {
×
2612
        eopts := parseOpts(opts)
×
2613
        if ae, ok := eopts.err.(*ApiError); ok {
×
2614
                return ae
×
2615
        }
×
2616

2617
        return ApiErrors[JSStreamInfoMaxSubjectsErr]
×
2618
}
2619

2620
// NewJSStreamInvalidConfigError creates a new JSStreamInvalidConfigF error: "{err}"
2621
func NewJSStreamInvalidConfigError(err error, opts ...ErrorOption) *ApiError {
167✔
2622
        eopts := parseOpts(opts)
167✔
2623
        if ae, ok := eopts.err.(*ApiError); ok {
188✔
2624
                return ae
21✔
2625
        }
21✔
2626

2627
        e := ApiErrors[JSStreamInvalidConfigF]
146✔
2628
        args := e.toReplacerArgs([]interface{}{"{err}", err})
146✔
2629
        return &ApiError{
146✔
2630
                Code:        e.Code,
146✔
2631
                ErrCode:     e.ErrCode,
146✔
2632
                Description: strings.NewReplacer(args...).Replace(e.Description),
146✔
2633
        }
146✔
2634
}
2635

2636
// NewJSStreamInvalidError creates a new JSStreamInvalidErr error: "stream not valid"
2637
func NewJSStreamInvalidError(opts ...ErrorOption) *ApiError {
×
2638
        eopts := parseOpts(opts)
×
2639
        if ae, ok := eopts.err.(*ApiError); ok {
×
2640
                return ae
×
2641
        }
×
2642

2643
        return ApiErrors[JSStreamInvalidErr]
×
2644
}
2645

2646
// NewJSStreamInvalidExternalDeliverySubjError creates a new JSStreamInvalidExternalDeliverySubjErrF error: "stream external delivery prefix {prefix} must not contain wildcards"
2647
func NewJSStreamInvalidExternalDeliverySubjError(prefix interface{}, opts ...ErrorOption) *ApiError {
×
2648
        eopts := parseOpts(opts)
×
2649
        if ae, ok := eopts.err.(*ApiError); ok {
×
2650
                return ae
×
2651
        }
×
2652

2653
        e := ApiErrors[JSStreamInvalidExternalDeliverySubjErrF]
×
2654
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix})
×
2655
        return &ApiError{
×
2656
                Code:        e.Code,
×
2657
                ErrCode:     e.ErrCode,
×
2658
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2659
        }
×
2660
}
2661

2662
// NewJSStreamLimitsError creates a new JSStreamLimitsErrF error: "{err}"
2663
func NewJSStreamLimitsError(err error, opts ...ErrorOption) *ApiError {
9✔
2664
        eopts := parseOpts(opts)
9✔
2665
        if ae, ok := eopts.err.(*ApiError); ok {
18✔
2666
                return ae
9✔
2667
        }
9✔
2668

2669
        e := ApiErrors[JSStreamLimitsErrF]
×
2670
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2671
        return &ApiError{
×
2672
                Code:        e.Code,
×
2673
                ErrCode:     e.ErrCode,
×
2674
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2675
        }
×
2676
}
2677

2678
// NewJSStreamMaxBytesRequiredError creates a new JSStreamMaxBytesRequired error: "account requires a stream config to have max bytes set"
2679
func NewJSStreamMaxBytesRequiredError(opts ...ErrorOption) *ApiError {
3✔
2680
        eopts := parseOpts(opts)
3✔
2681
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2682
                return ae
×
2683
        }
×
2684

2685
        return ApiErrors[JSStreamMaxBytesRequired]
3✔
2686
}
2687

2688
// NewJSStreamMaxStreamBytesExceededError creates a new JSStreamMaxStreamBytesExceeded error: "stream max bytes exceeds account limit max stream bytes"
2689
func NewJSStreamMaxStreamBytesExceededError(opts ...ErrorOption) *ApiError {
2✔
2690
        eopts := parseOpts(opts)
2✔
2691
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2692
                return ae
×
2693
        }
×
2694

2695
        return ApiErrors[JSStreamMaxStreamBytesExceeded]
2✔
2696
}
2697

2698
// NewJSStreamMessageExceedsMaximumError creates a new JSStreamMessageExceedsMaximumErr error: "message size exceeds maximum allowed"
2699
func NewJSStreamMessageExceedsMaximumError(opts ...ErrorOption) *ApiError {
19✔
2700
        eopts := parseOpts(opts)
19✔
2701
        if ae, ok := eopts.err.(*ApiError); ok {
19✔
2702
                return ae
×
2703
        }
×
2704

2705
        return ApiErrors[JSStreamMessageExceedsMaximumErr]
19✔
2706
}
2707

2708
// NewJSStreamMinLastSeqError creates a new JSStreamMinLastSeqErr error: "min last sequence"
2709
func NewJSStreamMinLastSeqError(opts ...ErrorOption) *ApiError {
×
2710
        eopts := parseOpts(opts)
×
2711
        if ae, ok := eopts.err.(*ApiError); ok {
×
2712
                return ae
×
2713
        }
×
2714

2715
        return ApiErrors[JSStreamMinLastSeqErr]
×
2716
}
2717

2718
// NewJSStreamMirrorNotUpdatableError creates a new JSStreamMirrorNotUpdatableErr error: "stream mirror configuration can not be updated"
2719
func NewJSStreamMirrorNotUpdatableError(opts ...ErrorOption) *ApiError {
2✔
2720
        eopts := parseOpts(opts)
2✔
2721
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2722
                return ae
×
2723
        }
×
2724

2725
        return ApiErrors[JSStreamMirrorNotUpdatableErr]
2✔
2726
}
2727

2728
// NewJSStreamMismatchError creates a new JSStreamMismatchErr error: "stream name in subject does not match request"
2729
func NewJSStreamMismatchError(opts ...ErrorOption) *ApiError {
3✔
2730
        eopts := parseOpts(opts)
3✔
2731
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2732
                return ae
×
2733
        }
×
2734

2735
        return ApiErrors[JSStreamMismatchErr]
3✔
2736
}
2737

2738
// NewJSStreamMoveAndScaleError creates a new JSStreamMoveAndScaleErr error: "can not move and scale a stream in a single update"
2739
func NewJSStreamMoveAndScaleError(opts ...ErrorOption) *ApiError {
4✔
2740
        eopts := parseOpts(opts)
4✔
2741
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2742
                return ae
×
2743
        }
×
2744

2745
        return ApiErrors[JSStreamMoveAndScaleErr]
4✔
2746
}
2747

2748
// NewJSStreamMoveInProgressError creates a new JSStreamMoveInProgressF error: "stream move already in progress: {msg}"
2749
func NewJSStreamMoveInProgressError(msg interface{}, opts ...ErrorOption) *ApiError {
2✔
2750
        eopts := parseOpts(opts)
2✔
2751
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2752
                return ae
×
2753
        }
×
2754

2755
        e := ApiErrors[JSStreamMoveInProgressF]
2✔
2756
        args := e.toReplacerArgs([]interface{}{"{msg}", msg})
2✔
2757
        return &ApiError{
2✔
2758
                Code:        e.Code,
2✔
2759
                ErrCode:     e.ErrCode,
2✔
2760
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2761
        }
2✔
2762
}
2763

2764
// NewJSStreamMoveNotInProgressError creates a new JSStreamMoveNotInProgress error: "stream move not in progress"
2765
func NewJSStreamMoveNotInProgressError(opts ...ErrorOption) *ApiError {
×
2766
        eopts := parseOpts(opts)
×
2767
        if ae, ok := eopts.err.(*ApiError); ok {
×
2768
                return ae
×
2769
        }
×
2770

2771
        return ApiErrors[JSStreamMoveNotInProgress]
×
2772
}
2773

2774
// NewJSStreamMsgDeleteFailedError creates a new JSStreamMsgDeleteFailedF error: "{err}"
2775
func NewJSStreamMsgDeleteFailedError(err error, opts ...ErrorOption) *ApiError {
7,076✔
2776
        eopts := parseOpts(opts)
7,076✔
2777
        if ae, ok := eopts.err.(*ApiError); ok {
7,076✔
2778
                return ae
×
2779
        }
×
2780

2781
        e := ApiErrors[JSStreamMsgDeleteFailedF]
7,076✔
2782
        args := e.toReplacerArgs([]interface{}{"{err}", err})
7,076✔
2783
        return &ApiError{
7,076✔
2784
                Code:        e.Code,
7,076✔
2785
                ErrCode:     e.ErrCode,
7,076✔
2786
                Description: strings.NewReplacer(args...).Replace(e.Description),
7,076✔
2787
        }
7,076✔
2788
}
2789

2790
// NewJSStreamNameContainsPathSeparatorsError creates a new JSStreamNameContainsPathSeparatorsErr error: "Stream name can not contain path separators"
2791
func NewJSStreamNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
6✔
2792
        eopts := parseOpts(opts)
6✔
2793
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2794
                return ae
×
2795
        }
×
2796

2797
        return ApiErrors[JSStreamNameContainsPathSeparatorsErr]
6✔
2798
}
2799

2800
// NewJSStreamNameExistError creates a new JSStreamNameExistErr error: "stream name already in use with a different configuration"
2801
func NewJSStreamNameExistError(opts ...ErrorOption) *ApiError {
10✔
2802
        eopts := parseOpts(opts)
10✔
2803
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2804
                return ae
×
2805
        }
×
2806

2807
        return ApiErrors[JSStreamNameExistErr]
10✔
2808
}
2809

2810
// NewJSStreamNameExistRestoreFailedError creates a new JSStreamNameExistRestoreFailedErr error: "stream name already in use, cannot restore"
2811
func NewJSStreamNameExistRestoreFailedError(opts ...ErrorOption) *ApiError {
3✔
2812
        eopts := parseOpts(opts)
3✔
2813
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2814
                return ae
×
2815
        }
×
2816

2817
        return ApiErrors[JSStreamNameExistRestoreFailedErr]
3✔
2818
}
2819

2820
// NewJSStreamNotFoundError creates a new JSStreamNotFoundErr error: "stream not found"
2821
func NewJSStreamNotFoundError(opts ...ErrorOption) *ApiError {
30,035✔
2822
        eopts := parseOpts(opts)
30,035✔
2823
        if ae, ok := eopts.err.(*ApiError); ok {
30,788✔
2824
                return ae
753✔
2825
        }
753✔
2826

2827
        return ApiErrors[JSStreamNotFoundErr]
29,282✔
2828
}
2829

2830
// NewJSStreamNotMatchError creates a new JSStreamNotMatchErr error: "expected stream does not match"
2831
func NewJSStreamNotMatchError(opts ...ErrorOption) *ApiError {
5✔
2832
        eopts := parseOpts(opts)
5✔
2833
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2834
                return ae
×
2835
        }
×
2836

2837
        return ApiErrors[JSStreamNotMatchErr]
5✔
2838
}
2839

2840
// NewJSStreamOfflineError creates a new JSStreamOfflineErr error: "stream is offline"
2841
func NewJSStreamOfflineError(opts ...ErrorOption) *ApiError {
6✔
2842
        eopts := parseOpts(opts)
6✔
2843
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2844
                return ae
×
2845
        }
×
2846

2847
        return ApiErrors[JSStreamOfflineErr]
6✔
2848
}
2849

2850
// NewJSStreamOfflineReasonError creates a new JSStreamOfflineReasonErrF error: "stream is offline: {err}"
2851
func NewJSStreamOfflineReasonError(err error, opts ...ErrorOption) *ApiError {
40✔
2852
        eopts := parseOpts(opts)
40✔
2853
        if ae, ok := eopts.err.(*ApiError); ok {
40✔
2854
                return ae
×
2855
        }
×
2856

2857
        e := ApiErrors[JSStreamOfflineReasonErrF]
40✔
2858
        args := e.toReplacerArgs([]interface{}{"{err}", err})
40✔
2859
        return &ApiError{
40✔
2860
                Code:        e.Code,
40✔
2861
                ErrCode:     e.ErrCode,
40✔
2862
                Description: strings.NewReplacer(args...).Replace(e.Description),
40✔
2863
        }
40✔
2864
}
2865

2866
// NewJSStreamPurgeFailedError creates a new JSStreamPurgeFailedF error: "{err}"
2867
func NewJSStreamPurgeFailedError(err error, opts ...ErrorOption) *ApiError {
1✔
2868
        eopts := parseOpts(opts)
1✔
2869
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2870
                return ae
×
2871
        }
×
2872

2873
        e := ApiErrors[JSStreamPurgeFailedF]
1✔
2874
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2875
        return &ApiError{
1✔
2876
                Code:        e.Code,
1✔
2877
                ErrCode:     e.ErrCode,
1✔
2878
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2879
        }
1✔
2880
}
2881

2882
// NewJSStreamReplicasNotSupportedError creates a new JSStreamReplicasNotSupportedErr error: "replicas > 1 not supported in non-clustered mode"
2883
func NewJSStreamReplicasNotSupportedError(opts ...ErrorOption) *ApiError {
1✔
2884
        eopts := parseOpts(opts)
1✔
2885
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2886
                return ae
×
2887
        }
×
2888

2889
        return ApiErrors[JSStreamReplicasNotSupportedErr]
1✔
2890
}
2891

2892
// NewJSStreamReplicasNotUpdatableError creates a new JSStreamReplicasNotUpdatableErr error: "Replicas configuration can not be updated"
2893
func NewJSStreamReplicasNotUpdatableError(opts ...ErrorOption) *ApiError {
×
2894
        eopts := parseOpts(opts)
×
2895
        if ae, ok := eopts.err.(*ApiError); ok {
×
2896
                return ae
×
2897
        }
×
2898

2899
        return ApiErrors[JSStreamReplicasNotUpdatableErr]
×
2900
}
2901

2902
// NewJSStreamRestoreError creates a new JSStreamRestoreErrF error: "restore failed: {err}"
2903
func NewJSStreamRestoreError(err error, opts ...ErrorOption) *ApiError {
7✔
2904
        eopts := parseOpts(opts)
7✔
2905
        if ae, ok := eopts.err.(*ApiError); ok {
9✔
2906
                return ae
2✔
2907
        }
2✔
2908

2909
        e := ApiErrors[JSStreamRestoreErrF]
5✔
2910
        args := e.toReplacerArgs([]interface{}{"{err}", err})
5✔
2911
        return &ApiError{
5✔
2912
                Code:        e.Code,
5✔
2913
                ErrCode:     e.ErrCode,
5✔
2914
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
2915
        }
5✔
2916
}
2917

2918
// NewJSStreamRollupFailedError creates a new JSStreamRollupFailedF error: "{err}"
2919
func NewJSStreamRollupFailedError(err error, opts ...ErrorOption) *ApiError {
13✔
2920
        eopts := parseOpts(opts)
13✔
2921
        if ae, ok := eopts.err.(*ApiError); ok {
13✔
2922
                return ae
×
2923
        }
×
2924

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

2934
// NewJSStreamSealedError creates a new JSStreamSealedErr error: "invalid operation on sealed stream"
2935
func NewJSStreamSealedError(opts ...ErrorOption) *ApiError {
10✔
2936
        eopts := parseOpts(opts)
10✔
2937
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2938
                return ae
×
2939
        }
×
2940

2941
        return ApiErrors[JSStreamSealedErr]
10✔
2942
}
2943

2944
// NewJSStreamSequenceNotMatchError creates a new JSStreamSequenceNotMatchErr error: "expected stream sequence does not match"
2945
func NewJSStreamSequenceNotMatchError(opts ...ErrorOption) *ApiError {
×
2946
        eopts := parseOpts(opts)
×
2947
        if ae, ok := eopts.err.(*ApiError); ok {
×
2948
                return ae
×
2949
        }
×
2950

2951
        return ApiErrors[JSStreamSequenceNotMatchErr]
×
2952
}
2953

2954
// NewJSStreamSnapshotError creates a new JSStreamSnapshotErrF error: "snapshot failed: {err}"
2955
func NewJSStreamSnapshotError(err error, opts ...ErrorOption) *ApiError {
×
2956
        eopts := parseOpts(opts)
×
2957
        if ae, ok := eopts.err.(*ApiError); ok {
×
2958
                return ae
×
2959
        }
×
2960

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

2970
// NewJSStreamStoreFailedError creates a new JSStreamStoreFailedF error: "{err}"
2971
func NewJSStreamStoreFailedError(err error, opts ...ErrorOption) *ApiError {
2,489✔
2972
        eopts := parseOpts(opts)
2,489✔
2973
        if ae, ok := eopts.err.(*ApiError); ok {
2,489✔
2974
                return ae
×
2975
        }
×
2976

2977
        e := ApiErrors[JSStreamStoreFailedF]
2,489✔
2978
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2,489✔
2979
        return &ApiError{
2,489✔
2980
                Code:        e.Code,
2,489✔
2981
                ErrCode:     e.ErrCode,
2,489✔
2982
                Description: strings.NewReplacer(args...).Replace(e.Description),
2,489✔
2983
        }
2,489✔
2984
}
2985

2986
// NewJSStreamSubjectOverlapError creates a new JSStreamSubjectOverlapErr error: "subjects overlap with an existing stream"
2987
func NewJSStreamSubjectOverlapError(opts ...ErrorOption) *ApiError {
25✔
2988
        eopts := parseOpts(opts)
25✔
2989
        if ae, ok := eopts.err.(*ApiError); ok {
25✔
2990
                return ae
×
2991
        }
×
2992

2993
        return ApiErrors[JSStreamSubjectOverlapErr]
25✔
2994
}
2995

2996
// NewJSStreamTemplateCreateError creates a new JSStreamTemplateCreateErrF error: "{err}"
2997
func NewJSStreamTemplateCreateError(err error, opts ...ErrorOption) *ApiError {
×
2998
        eopts := parseOpts(opts)
×
2999
        if ae, ok := eopts.err.(*ApiError); ok {
×
3000
                return ae
×
3001
        }
×
3002

3003
        e := ApiErrors[JSStreamTemplateCreateErrF]
×
3004
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
3005
        return &ApiError{
×
3006
                Code:        e.Code,
×
3007
                ErrCode:     e.ErrCode,
×
3008
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
3009
        }
×
3010
}
3011

3012
// NewJSStreamTemplateDeleteError creates a new JSStreamTemplateDeleteErrF error: "{err}"
3013
func NewJSStreamTemplateDeleteError(err error, opts ...ErrorOption) *ApiError {
×
3014
        eopts := parseOpts(opts)
×
3015
        if ae, ok := eopts.err.(*ApiError); ok {
×
3016
                return ae
×
3017
        }
×
3018

3019
        e := ApiErrors[JSStreamTemplateDeleteErrF]
×
3020
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
3021
        return &ApiError{
×
3022
                Code:        e.Code,
×
3023
                ErrCode:     e.ErrCode,
×
3024
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
3025
        }
×
3026
}
3027

3028
// NewJSStreamTemplateNotFoundError creates a new JSStreamTemplateNotFoundErr error: "template not found"
3029
func NewJSStreamTemplateNotFoundError(opts ...ErrorOption) *ApiError {
×
3030
        eopts := parseOpts(opts)
×
3031
        if ae, ok := eopts.err.(*ApiError); ok {
×
3032
                return ae
×
3033
        }
×
3034

3035
        return ApiErrors[JSStreamTemplateNotFoundErr]
×
3036
}
3037

3038
// NewJSStreamTooManyRequestsError creates a new JSStreamTooManyRequests error: "too many requests"
3039
func NewJSStreamTooManyRequestsError(opts ...ErrorOption) *ApiError {
195✔
3040
        eopts := parseOpts(opts)
195✔
3041
        if ae, ok := eopts.err.(*ApiError); ok {
195✔
3042
                return ae
×
3043
        }
×
3044

3045
        return ApiErrors[JSStreamTooManyRequests]
195✔
3046
}
3047

3048
// NewJSStreamTransformInvalidDestinationError creates a new JSStreamTransformInvalidDestination error: "stream transform: {err}"
3049
func NewJSStreamTransformInvalidDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
3050
        eopts := parseOpts(opts)
1✔
3051
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3052
                return ae
×
3053
        }
×
3054

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

3064
// NewJSStreamTransformInvalidSourceError creates a new JSStreamTransformInvalidSource error: "stream transform source: {err}"
3065
func NewJSStreamTransformInvalidSourceError(err error, opts ...ErrorOption) *ApiError {
1✔
3066
        eopts := parseOpts(opts)
1✔
3067
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3068
                return ae
×
3069
        }
×
3070

3071
        e := ApiErrors[JSStreamTransformInvalidSource]
1✔
3072
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
3073
        return &ApiError{
1✔
3074
                Code:        e.Code,
1✔
3075
                ErrCode:     e.ErrCode,
1✔
3076
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
3077
        }
1✔
3078
}
3079

3080
// NewJSStreamUpdateError creates a new JSStreamUpdateErrF error: "{err}"
3081
func NewJSStreamUpdateError(err error, opts ...ErrorOption) *ApiError {
30✔
3082
        eopts := parseOpts(opts)
30✔
3083
        if ae, ok := eopts.err.(*ApiError); ok {
54✔
3084
                return ae
24✔
3085
        }
24✔
3086

3087
        e := ApiErrors[JSStreamUpdateErrF]
6✔
3088
        args := e.toReplacerArgs([]interface{}{"{err}", err})
6✔
3089
        return &ApiError{
6✔
3090
                Code:        e.Code,
6✔
3091
                ErrCode:     e.ErrCode,
6✔
3092
                Description: strings.NewReplacer(args...).Replace(e.Description),
6✔
3093
        }
6✔
3094
}
3095

3096
// NewJSStreamWrongLastMsgIDError creates a new JSStreamWrongLastMsgIDErrF error: "wrong last msg ID: {id}"
3097
func NewJSStreamWrongLastMsgIDError(id interface{}, opts ...ErrorOption) *ApiError {
5✔
3098
        eopts := parseOpts(opts)
5✔
3099
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
3100
                return ae
×
3101
        }
×
3102

3103
        e := ApiErrors[JSStreamWrongLastMsgIDErrF]
5✔
3104
        args := e.toReplacerArgs([]interface{}{"{id}", id})
5✔
3105
        return &ApiError{
5✔
3106
                Code:        e.Code,
5✔
3107
                ErrCode:     e.ErrCode,
5✔
3108
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
3109
        }
5✔
3110
}
3111

3112
// NewJSStreamWrongLastSequenceConstantError creates a new JSStreamWrongLastSequenceConstantErr error: "wrong last sequence"
3113
func NewJSStreamWrongLastSequenceConstantError(opts ...ErrorOption) *ApiError {
23✔
3114
        eopts := parseOpts(opts)
23✔
3115
        if ae, ok := eopts.err.(*ApiError); ok {
23✔
3116
                return ae
×
3117
        }
×
3118

3119
        return ApiErrors[JSStreamWrongLastSequenceConstantErr]
23✔
3120
}
3121

3122
// NewJSStreamWrongLastSequenceError creates a new JSStreamWrongLastSequenceErrF error: "wrong last sequence: {seq}"
3123
func NewJSStreamWrongLastSequenceError(seq uint64, opts ...ErrorOption) *ApiError {
96✔
3124
        eopts := parseOpts(opts)
96✔
3125
        if ae, ok := eopts.err.(*ApiError); ok {
96✔
3126
                return ae
×
3127
        }
×
3128

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

3138
// NewJSTempStorageFailedError creates a new JSTempStorageFailedErr error: "JetStream unable to open temp storage for restore"
3139
func NewJSTempStorageFailedError(opts ...ErrorOption) *ApiError {
×
3140
        eopts := parseOpts(opts)
×
3141
        if ae, ok := eopts.err.(*ApiError); ok {
×
3142
                return ae
×
3143
        }
×
3144

3145
        return ApiErrors[JSTempStorageFailedErr]
×
3146
}
3147

3148
// NewJSTemplateNameNotMatchSubjectError creates a new JSTemplateNameNotMatchSubjectErr error: "template name in subject does not match request"
3149
func NewJSTemplateNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
×
3150
        eopts := parseOpts(opts)
×
3151
        if ae, ok := eopts.err.(*ApiError); ok {
×
3152
                return ae
×
3153
        }
×
3154

3155
        return ApiErrors[JSTemplateNameNotMatchSubjectErr]
×
3156
}
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