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

nats-io / nats-server / 18485734424

13 Oct 2025 01:55PM UTC coverage: 85.997% (-0.07%) from 86.068%
18485734424

push

github

web-flow
[ADDED] - `riscv64` support (#7411)

* New Features
* Added official `riscv64` build support for supported platforms (e.g.,
Linux), providing downloadable binaries for that architecture and
broadening platform availability.

* Chores
* Updated the release pipeline to include riscv64 in the build matrix
while excluding unsupported OS combinations to ensure reliable releases.
* No changes to application behavior, public APIs, or user workflows;
this is a build/configuration-only update.
  
[skip ci]

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>

74626 of 86777 relevant lines covered (86.0%)

335512.52 hits per line

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

55.49
/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
        // JSClusterServerNotMemberErr server is not a member of the cluster
63
        JSClusterServerNotMemberErr ErrorIdentifier = 10044
64

65
        // JSClusterTagsErr tags placement not supported for operation
66
        JSClusterTagsErr ErrorIdentifier = 10011
67

68
        // JSClusterUnSupportFeatureErr not currently supported in clustered mode
69
        JSClusterUnSupportFeatureErr ErrorIdentifier = 10036
70

71
        // JSConsumerAckPolicyInvalidErr consumer ack policy invalid
72
        JSConsumerAckPolicyInvalidErr ErrorIdentifier = 10181
73

74
        // JSConsumerAckWaitNegativeErr consumer ack wait needs to be positive
75
        JSConsumerAckWaitNegativeErr ErrorIdentifier = 10183
76

77
        // JSConsumerAlreadyExists action CREATE is used for a existing consumer with a different config (consumer already exists)
78
        JSConsumerAlreadyExists ErrorIdentifier = 10148
79

80
        // JSConsumerBackOffNegativeErr consumer backoff needs to be positive
81
        JSConsumerBackOffNegativeErr ErrorIdentifier = 10184
82

83
        // JSConsumerBadDurableNameErr durable name can not contain '.', '*', '>'
84
        JSConsumerBadDurableNameErr ErrorIdentifier = 10103
85

86
        // JSConsumerConfigRequiredErr consumer config required
87
        JSConsumerConfigRequiredErr ErrorIdentifier = 10078
88

89
        // JSConsumerCreateDurableAndNameMismatch Consumer Durable and Name have to be equal if both are provided
90
        JSConsumerCreateDurableAndNameMismatch ErrorIdentifier = 10132
91

92
        // JSConsumerCreateErrF General consumer creation failure string ({err})
93
        JSConsumerCreateErrF ErrorIdentifier = 10012
94

95
        // JSConsumerCreateFilterSubjectMismatchErr Consumer create request did not match filtered subject from create subject
96
        JSConsumerCreateFilterSubjectMismatchErr ErrorIdentifier = 10131
97

98
        // JSConsumerDeliverCycleErr consumer deliver subject forms a cycle
99
        JSConsumerDeliverCycleErr ErrorIdentifier = 10081
100

101
        // JSConsumerDeliverToWildcardsErr consumer deliver subject has wildcards
102
        JSConsumerDeliverToWildcardsErr ErrorIdentifier = 10079
103

104
        // JSConsumerDescriptionTooLongErrF consumer description is too long, maximum allowed is {max}
105
        JSConsumerDescriptionTooLongErrF ErrorIdentifier = 10107
106

107
        // JSConsumerDirectRequiresEphemeralErr consumer direct requires an ephemeral consumer
108
        JSConsumerDirectRequiresEphemeralErr ErrorIdentifier = 10091
109

110
        // JSConsumerDirectRequiresPushErr consumer direct requires a push based consumer
111
        JSConsumerDirectRequiresPushErr ErrorIdentifier = 10090
112

113
        // JSConsumerDoesNotExist action UPDATE is used for a nonexisting consumer (consumer does not exist)
114
        JSConsumerDoesNotExist ErrorIdentifier = 10149
115

116
        // JSConsumerDuplicateFilterSubjects consumer cannot have both FilterSubject and FilterSubjects specified
117
        JSConsumerDuplicateFilterSubjects ErrorIdentifier = 10136
118

119
        // JSConsumerDurableNameNotInSubjectErr consumer expected to be durable but no durable name set in subject
120
        JSConsumerDurableNameNotInSubjectErr ErrorIdentifier = 10016
121

122
        // JSConsumerDurableNameNotMatchSubjectErr consumer name in subject does not match durable name in request
123
        JSConsumerDurableNameNotMatchSubjectErr ErrorIdentifier = 10017
124

125
        // JSConsumerDurableNameNotSetErr consumer expected to be durable but a durable name was not set
126
        JSConsumerDurableNameNotSetErr ErrorIdentifier = 10018
127

128
        // JSConsumerEmptyFilter consumer filter in FilterSubjects cannot be empty
129
        JSConsumerEmptyFilter ErrorIdentifier = 10139
130

131
        // JSConsumerEmptyGroupName Group name cannot be an empty string
132
        JSConsumerEmptyGroupName ErrorIdentifier = 10161
133

134
        // JSConsumerEphemeralWithDurableInSubjectErr consumer expected to be ephemeral but detected a durable name set in subject
135
        JSConsumerEphemeralWithDurableInSubjectErr ErrorIdentifier = 10019
136

137
        // JSConsumerEphemeralWithDurableNameErr consumer expected to be ephemeral but a durable name was set in request
138
        JSConsumerEphemeralWithDurableNameErr ErrorIdentifier = 10020
139

140
        // JSConsumerExistingActiveErr consumer already exists and is still active
141
        JSConsumerExistingActiveErr ErrorIdentifier = 10105
142

143
        // JSConsumerFCRequiresPushErr consumer flow control requires a push based consumer
144
        JSConsumerFCRequiresPushErr ErrorIdentifier = 10089
145

146
        // JSConsumerFilterNotSubsetErr consumer filter subject is not a valid subset of the interest subjects
147
        JSConsumerFilterNotSubsetErr ErrorIdentifier = 10093
148

149
        // JSConsumerHBRequiresPushErr consumer idle heartbeat requires a push based consumer
150
        JSConsumerHBRequiresPushErr ErrorIdentifier = 10088
151

152
        // JSConsumerInactiveThresholdExcess consumer inactive threshold exceeds system limit of {limit}
153
        JSConsumerInactiveThresholdExcess ErrorIdentifier = 10153
154

155
        // JSConsumerInvalidDeliverSubject invalid push consumer deliver subject
156
        JSConsumerInvalidDeliverSubject ErrorIdentifier = 10112
157

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

161
        // JSConsumerInvalidPolicyErrF Generic delivery policy error ({err})
162
        JSConsumerInvalidPolicyErrF ErrorIdentifier = 10094
163

164
        // JSConsumerInvalidPriorityGroupErr Provided priority group does not exist for this consumer
165
        JSConsumerInvalidPriorityGroupErr ErrorIdentifier = 10160
166

167
        // JSConsumerInvalidSamplingErrF failed to parse consumer sampling configuration: {err}
168
        JSConsumerInvalidSamplingErrF ErrorIdentifier = 10095
169

170
        // JSConsumerMaxDeliverBackoffErr max deliver is required to be > length of backoff values
171
        JSConsumerMaxDeliverBackoffErr ErrorIdentifier = 10116
172

173
        // JSConsumerMaxPendingAckExcessErrF consumer max ack pending exceeds system limit of {limit}
174
        JSConsumerMaxPendingAckExcessErrF ErrorIdentifier = 10121
175

176
        // JSConsumerMaxPendingAckPolicyRequiredErr consumer requires ack policy for max ack pending
177
        JSConsumerMaxPendingAckPolicyRequiredErr ErrorIdentifier = 10082
178

179
        // JSConsumerMaxRequestBatchExceededF consumer max request batch exceeds server limit of {limit}
180
        JSConsumerMaxRequestBatchExceededF ErrorIdentifier = 10125
181

182
        // JSConsumerMaxRequestBatchNegativeErr consumer max request batch needs to be > 0
183
        JSConsumerMaxRequestBatchNegativeErr ErrorIdentifier = 10114
184

185
        // JSConsumerMaxRequestExpiresTooSmall consumer max request expires needs to be >= 1ms
186
        JSConsumerMaxRequestExpiresTooSmall ErrorIdentifier = 10115
187

188
        // JSConsumerMaxWaitingNegativeErr consumer max waiting needs to be positive
189
        JSConsumerMaxWaitingNegativeErr ErrorIdentifier = 10087
190

191
        // JSConsumerMetadataLengthErrF consumer metadata exceeds maximum size of {limit}
192
        JSConsumerMetadataLengthErrF ErrorIdentifier = 10135
193

194
        // JSConsumerMultipleFiltersNotAllowed consumer with multiple subject filters cannot use subject based API
195
        JSConsumerMultipleFiltersNotAllowed ErrorIdentifier = 10137
196

197
        // JSConsumerNameContainsPathSeparatorsErr Consumer name can not contain path separators
198
        JSConsumerNameContainsPathSeparatorsErr ErrorIdentifier = 10127
199

200
        // JSConsumerNameExistErr consumer name already in use
201
        JSConsumerNameExistErr ErrorIdentifier = 10013
202

203
        // JSConsumerNameTooLongErrF consumer name is too long, maximum allowed is {max}
204
        JSConsumerNameTooLongErrF ErrorIdentifier = 10102
205

206
        // JSConsumerNotFoundErr consumer not found
207
        JSConsumerNotFoundErr ErrorIdentifier = 10014
208

209
        // JSConsumerOfflineErr consumer is offline
210
        JSConsumerOfflineErr ErrorIdentifier = 10119
211

212
        // JSConsumerOfflineReasonErrF consumer is offline: {err}
213
        JSConsumerOfflineReasonErrF ErrorIdentifier = 10195
214

215
        // JSConsumerOnMappedErr consumer direct on a mapped consumer
216
        JSConsumerOnMappedErr ErrorIdentifier = 10092
217

218
        // JSConsumerOverlappingSubjectFilters consumer subject filters cannot overlap
219
        JSConsumerOverlappingSubjectFilters ErrorIdentifier = 10138
220

221
        // JSConsumerPinnedTTLWithoutPriorityPolicyNone PinnedTTL cannot be set when PriorityPolicy is none
222
        JSConsumerPinnedTTLWithoutPriorityPolicyNone ErrorIdentifier = 10197
223

224
        // JSConsumerPriorityGroupWithPolicyNone consumer can not have priority groups when policy is none
225
        JSConsumerPriorityGroupWithPolicyNone ErrorIdentifier = 10196
226

227
        // JSConsumerPriorityPolicyWithoutGroup Setting PriorityPolicy requires at least one PriorityGroup to be set
228
        JSConsumerPriorityPolicyWithoutGroup ErrorIdentifier = 10159
229

230
        // JSConsumerPullNotDurableErr consumer in pull mode requires a durable name
231
        JSConsumerPullNotDurableErr ErrorIdentifier = 10085
232

233
        // JSConsumerPullRequiresAckErr consumer in pull mode requires explicit ack policy on workqueue stream
234
        JSConsumerPullRequiresAckErr ErrorIdentifier = 10084
235

236
        // JSConsumerPullWithRateLimitErr consumer in pull mode can not have rate limit set
237
        JSConsumerPullWithRateLimitErr ErrorIdentifier = 10086
238

239
        // JSConsumerPushMaxWaitingErr consumer in push mode can not set max waiting
240
        JSConsumerPushMaxWaitingErr ErrorIdentifier = 10080
241

242
        // JSConsumerPushWithPriorityGroupErr priority groups can not be used with push consumers
243
        JSConsumerPushWithPriorityGroupErr ErrorIdentifier = 10178
244

245
        // JSConsumerReplacementWithDifferentNameErr consumer replacement durable config not the same
246
        JSConsumerReplacementWithDifferentNameErr ErrorIdentifier = 10106
247

248
        // JSConsumerReplayPolicyInvalidErr consumer replay policy invalid
249
        JSConsumerReplayPolicyInvalidErr ErrorIdentifier = 10182
250

251
        // JSConsumerReplicasExceedsStream consumer config replica count exceeds parent stream
252
        JSConsumerReplicasExceedsStream ErrorIdentifier = 10126
253

254
        // JSConsumerReplicasShouldMatchStream consumer config replicas must match interest retention stream's replicas
255
        JSConsumerReplicasShouldMatchStream ErrorIdentifier = 10134
256

257
        // JSConsumerSmallHeartbeatErr consumer idle heartbeat needs to be >= 100ms
258
        JSConsumerSmallHeartbeatErr ErrorIdentifier = 10083
259

260
        // JSConsumerStoreFailedErrF error creating store for consumer: {err}
261
        JSConsumerStoreFailedErrF ErrorIdentifier = 10104
262

263
        // JSConsumerWQConsumerNotDeliverAllErr consumer must be deliver all on workqueue stream
264
        JSConsumerWQConsumerNotDeliverAllErr ErrorIdentifier = 10101
265

266
        // JSConsumerWQConsumerNotUniqueErr filtered consumer not unique on workqueue stream
267
        JSConsumerWQConsumerNotUniqueErr ErrorIdentifier = 10100
268

269
        // JSConsumerWQMultipleUnfilteredErr multiple non-filtered consumers not allowed on workqueue stream
270
        JSConsumerWQMultipleUnfilteredErr ErrorIdentifier = 10099
271

272
        // JSConsumerWQRequiresExplicitAckErr workqueue stream requires explicit ack
273
        JSConsumerWQRequiresExplicitAckErr ErrorIdentifier = 10098
274

275
        // JSConsumerWithFlowControlNeedsHeartbeats consumer with flow control also needs heartbeats
276
        JSConsumerWithFlowControlNeedsHeartbeats ErrorIdentifier = 10108
277

278
        // JSInsufficientResourcesErr insufficient resources
279
        JSInsufficientResourcesErr ErrorIdentifier = 10023
280

281
        // JSInvalidJSONErr invalid JSON: {err}
282
        JSInvalidJSONErr ErrorIdentifier = 10025
283

284
        // JSMaximumConsumersLimitErr maximum consumers limit reached
285
        JSMaximumConsumersLimitErr ErrorIdentifier = 10026
286

287
        // JSMaximumStreamsLimitErr maximum number of streams reached
288
        JSMaximumStreamsLimitErr ErrorIdentifier = 10027
289

290
        // JSMemoryResourcesExceededErr insufficient memory resources available
291
        JSMemoryResourcesExceededErr ErrorIdentifier = 10028
292

293
        // JSMessageCounterBrokenErr message counter is broken
294
        JSMessageCounterBrokenErr ErrorIdentifier = 10172
295

296
        // JSMessageIncrDisabledErr message counters is disabled
297
        JSMessageIncrDisabledErr ErrorIdentifier = 10168
298

299
        // JSMessageIncrInvalidErr message counter increment is invalid
300
        JSMessageIncrInvalidErr ErrorIdentifier = 10171
301

302
        // JSMessageIncrMissingErr message counter increment is missing
303
        JSMessageIncrMissingErr ErrorIdentifier = 10169
304

305
        // JSMessageIncrPayloadErr message counter has payload
306
        JSMessageIncrPayloadErr ErrorIdentifier = 10170
307

308
        // JSMessageSchedulesDisabledErr message schedules is disabled
309
        JSMessageSchedulesDisabledErr ErrorIdentifier = 10188
310

311
        // JSMessageSchedulesPatternInvalidErr message schedules pattern is invalid
312
        JSMessageSchedulesPatternInvalidErr ErrorIdentifier = 10189
313

314
        // JSMessageSchedulesRollupInvalidErr message schedules invalid rollup
315
        JSMessageSchedulesRollupInvalidErr ErrorIdentifier = 10192
316

317
        // JSMessageSchedulesTTLInvalidErr message schedules invalid per-message TTL
318
        JSMessageSchedulesTTLInvalidErr ErrorIdentifier = 10191
319

320
        // JSMessageSchedulesTargetInvalidErr message schedules target is invalid
321
        JSMessageSchedulesTargetInvalidErr ErrorIdentifier = 10190
322

323
        // JSMessageTTLDisabledErr per-message TTL is disabled
324
        JSMessageTTLDisabledErr ErrorIdentifier = 10166
325

326
        // JSMessageTTLInvalidErr invalid per-message TTL
327
        JSMessageTTLInvalidErr ErrorIdentifier = 10165
328

329
        // JSMirrorConsumerSetupFailedErrF generic mirror consumer setup failure string ({err})
330
        JSMirrorConsumerSetupFailedErrF ErrorIdentifier = 10029
331

332
        // JSMirrorInvalidStreamName mirrored stream name is invalid
333
        JSMirrorInvalidStreamName ErrorIdentifier = 10142
334

335
        // JSMirrorInvalidSubjectFilter mirror transform source: {err}
336
        JSMirrorInvalidSubjectFilter ErrorIdentifier = 10151
337

338
        // JSMirrorInvalidTransformDestination mirror transform: {err}
339
        JSMirrorInvalidTransformDestination ErrorIdentifier = 10154
340

341
        // JSMirrorMaxMessageSizeTooBigErr stream mirror must have max message size >= source
342
        JSMirrorMaxMessageSizeTooBigErr ErrorIdentifier = 10030
343

344
        // JSMirrorMultipleFiltersNotAllowed mirror with multiple subject transforms cannot also have a single subject filter
345
        JSMirrorMultipleFiltersNotAllowed ErrorIdentifier = 10150
346

347
        // JSMirrorOverlappingSubjectFilters mirror subject filters can not overlap
348
        JSMirrorOverlappingSubjectFilters ErrorIdentifier = 10152
349

350
        // JSMirrorWithAtomicPublishErr stream mirrors can not also use atomic publishing
351
        JSMirrorWithAtomicPublishErr ErrorIdentifier = 10198
352

353
        // JSMirrorWithCountersErr stream mirrors can not also calculate counters
354
        JSMirrorWithCountersErr ErrorIdentifier = 10173
355

356
        // JSMirrorWithFirstSeqErr stream mirrors can not have first sequence configured
357
        JSMirrorWithFirstSeqErr ErrorIdentifier = 10143
358

359
        // JSMirrorWithMsgSchedulesErr stream mirrors can not also schedule messages
360
        JSMirrorWithMsgSchedulesErr ErrorIdentifier = 10186
361

362
        // JSMirrorWithSourcesErr stream mirrors can not also contain other sources
363
        JSMirrorWithSourcesErr ErrorIdentifier = 10031
364

365
        // JSMirrorWithStartSeqAndTimeErr stream mirrors can not have both start seq and start time configured
366
        JSMirrorWithStartSeqAndTimeErr ErrorIdentifier = 10032
367

368
        // JSMirrorWithSubjectFiltersErr stream mirrors can not contain filtered subjects
369
        JSMirrorWithSubjectFiltersErr ErrorIdentifier = 10033
370

371
        // JSMirrorWithSubjectsErr stream mirrors can not contain subjects
372
        JSMirrorWithSubjectsErr ErrorIdentifier = 10034
373

374
        // JSNoAccountErr account not found
375
        JSNoAccountErr ErrorIdentifier = 10035
376

377
        // JSNoLimitsErr no JetStream default or applicable tiered limit present
378
        JSNoLimitsErr ErrorIdentifier = 10120
379

380
        // JSNoMessageFoundErr no message found
381
        JSNoMessageFoundErr ErrorIdentifier = 10037
382

383
        // JSNotEmptyRequestErr expected an empty request payload
384
        JSNotEmptyRequestErr ErrorIdentifier = 10038
385

386
        // JSNotEnabledErr JetStream not enabled
387
        JSNotEnabledErr ErrorIdentifier = 10076
388

389
        // JSNotEnabledForAccountErr JetStream not enabled for account
390
        JSNotEnabledForAccountErr ErrorIdentifier = 10039
391

392
        // JSPedanticErrF pedantic mode: {err}
393
        JSPedanticErrF ErrorIdentifier = 10157
394

395
        // JSPeerRemapErr peer remap failed
396
        JSPeerRemapErr ErrorIdentifier = 10075
397

398
        // JSRaftGeneralErrF General RAFT error string ({err})
399
        JSRaftGeneralErrF ErrorIdentifier = 10041
400

401
        // JSReplicasCountCannotBeNegative replicas count cannot be negative
402
        JSReplicasCountCannotBeNegative ErrorIdentifier = 10133
403

404
        // JSRequiredApiLevelErr JetStream minimum api level required
405
        JSRequiredApiLevelErr ErrorIdentifier = 10185
406

407
        // JSRestoreSubscribeFailedErrF JetStream unable to subscribe to restore snapshot {subject}: {err}
408
        JSRestoreSubscribeFailedErrF ErrorIdentifier = 10042
409

410
        // JSSequenceNotFoundErrF sequence {seq} not found
411
        JSSequenceNotFoundErrF ErrorIdentifier = 10043
412

413
        // JSSnapshotDeliverSubjectInvalidErr deliver subject not valid
414
        JSSnapshotDeliverSubjectInvalidErr ErrorIdentifier = 10015
415

416
        // JSSourceConsumerSetupFailedErrF General source consumer setup failure string ({err})
417
        JSSourceConsumerSetupFailedErrF ErrorIdentifier = 10045
418

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

422
        // JSSourceInvalidStreamName sourced stream name is invalid
423
        JSSourceInvalidStreamName ErrorIdentifier = 10141
424

425
        // JSSourceInvalidSubjectFilter source transform source: {err}
426
        JSSourceInvalidSubjectFilter ErrorIdentifier = 10145
427

428
        // JSSourceInvalidTransformDestination source transform: {err}
429
        JSSourceInvalidTransformDestination ErrorIdentifier = 10146
430

431
        // JSSourceMaxMessageSizeTooBigErr stream source must have max message size >= target
432
        JSSourceMaxMessageSizeTooBigErr ErrorIdentifier = 10046
433

434
        // JSSourceMultipleFiltersNotAllowed source with multiple subject transforms cannot also have a single subject filter
435
        JSSourceMultipleFiltersNotAllowed ErrorIdentifier = 10144
436

437
        // JSSourceOverlappingSubjectFilters source filters can not overlap
438
        JSSourceOverlappingSubjectFilters ErrorIdentifier = 10147
439

440
        // JSSourceWithMsgSchedulesErr stream source can not also schedule messages
441
        JSSourceWithMsgSchedulesErr ErrorIdentifier = 10187
442

443
        // JSStorageResourcesExceededErr insufficient storage resources available
444
        JSStorageResourcesExceededErr ErrorIdentifier = 10047
445

446
        // JSStreamAssignmentErrF Generic stream assignment error string ({err})
447
        JSStreamAssignmentErrF ErrorIdentifier = 10048
448

449
        // JSStreamCreateErrF Generic stream creation error string ({err})
450
        JSStreamCreateErrF ErrorIdentifier = 10049
451

452
        // JSStreamDeleteErrF General stream deletion error string ({err})
453
        JSStreamDeleteErrF ErrorIdentifier = 10050
454

455
        // JSStreamDuplicateMessageConflict duplicate message id is in process
456
        JSStreamDuplicateMessageConflict ErrorIdentifier = 10158
457

458
        // JSStreamExpectedLastSeqPerSubjectInvalid missing sequence for expected last sequence per subject
459
        JSStreamExpectedLastSeqPerSubjectInvalid ErrorIdentifier = 10193
460

461
        // JSStreamExpectedLastSeqPerSubjectNotReady expected last sequence per subject temporarily unavailable
462
        JSStreamExpectedLastSeqPerSubjectNotReady ErrorIdentifier = 10163
463

464
        // JSStreamExternalApiOverlapErrF stream external api prefix {prefix} must not overlap with {subject}
465
        JSStreamExternalApiOverlapErrF ErrorIdentifier = 10021
466

467
        // JSStreamExternalDelPrefixOverlapsErrF stream external delivery prefix {prefix} overlaps with stream subject {subject}
468
        JSStreamExternalDelPrefixOverlapsErrF ErrorIdentifier = 10022
469

470
        // JSStreamGeneralErrorF General stream failure string ({err})
471
        JSStreamGeneralErrorF ErrorIdentifier = 10051
472

473
        // JSStreamHeaderExceedsMaximumErr header size exceeds maximum allowed of 64k
474
        JSStreamHeaderExceedsMaximumErr ErrorIdentifier = 10097
475

476
        // JSStreamInfoMaxSubjectsErr subject details would exceed maximum allowed
477
        JSStreamInfoMaxSubjectsErr ErrorIdentifier = 10117
478

479
        // JSStreamInvalidConfigF Stream configuration validation error string ({err})
480
        JSStreamInvalidConfigF ErrorIdentifier = 10052
481

482
        // JSStreamInvalidErr stream not valid
483
        JSStreamInvalidErr ErrorIdentifier = 10096
484

485
        // JSStreamInvalidExternalDeliverySubjErrF stream external delivery prefix {prefix} must not contain wildcards
486
        JSStreamInvalidExternalDeliverySubjErrF ErrorIdentifier = 10024
487

488
        // JSStreamLimitsErrF General stream limits exceeded error string ({err})
489
        JSStreamLimitsErrF ErrorIdentifier = 10053
490

491
        // JSStreamMaxBytesRequired account requires a stream config to have max bytes set
492
        JSStreamMaxBytesRequired ErrorIdentifier = 10113
493

494
        // JSStreamMaxStreamBytesExceeded stream max bytes exceeds account limit max stream bytes
495
        JSStreamMaxStreamBytesExceeded ErrorIdentifier = 10122
496

497
        // JSStreamMessageExceedsMaximumErr message size exceeds maximum allowed
498
        JSStreamMessageExceedsMaximumErr ErrorIdentifier = 10054
499

500
        // JSStreamMinLastSeqErr min last sequence
501
        JSStreamMinLastSeqErr ErrorIdentifier = 10180
502

503
        // JSStreamMirrorNotUpdatableErr stream mirror configuration can not be updated
504
        JSStreamMirrorNotUpdatableErr ErrorIdentifier = 10055
505

506
        // JSStreamMismatchErr stream name in subject does not match request
507
        JSStreamMismatchErr ErrorIdentifier = 10056
508

509
        // JSStreamMoveAndScaleErr can not move and scale a stream in a single update
510
        JSStreamMoveAndScaleErr ErrorIdentifier = 10123
511

512
        // JSStreamMoveInProgressF stream move already in progress: {msg}
513
        JSStreamMoveInProgressF ErrorIdentifier = 10124
514

515
        // JSStreamMoveNotInProgress stream move not in progress
516
        JSStreamMoveNotInProgress ErrorIdentifier = 10129
517

518
        // JSStreamMsgDeleteFailedF Generic message deletion failure error string ({err})
519
        JSStreamMsgDeleteFailedF ErrorIdentifier = 10057
520

521
        // JSStreamNameContainsPathSeparatorsErr Stream name can not contain path separators
522
        JSStreamNameContainsPathSeparatorsErr ErrorIdentifier = 10128
523

524
        // JSStreamNameExistErr stream name already in use with a different configuration
525
        JSStreamNameExistErr ErrorIdentifier = 10058
526

527
        // JSStreamNameExistRestoreFailedErr stream name already in use, cannot restore
528
        JSStreamNameExistRestoreFailedErr ErrorIdentifier = 10130
529

530
        // JSStreamNotFoundErr stream not found
531
        JSStreamNotFoundErr ErrorIdentifier = 10059
532

533
        // JSStreamNotMatchErr expected stream does not match
534
        JSStreamNotMatchErr ErrorIdentifier = 10060
535

536
        // JSStreamOfflineErr stream is offline
537
        JSStreamOfflineErr ErrorIdentifier = 10118
538

539
        // JSStreamOfflineReasonErrF stream is offline: {err}
540
        JSStreamOfflineReasonErrF ErrorIdentifier = 10194
541

542
        // JSStreamPurgeFailedF Generic stream purge failure error string ({err})
543
        JSStreamPurgeFailedF ErrorIdentifier = 10110
544

545
        // JSStreamReplicasNotSupportedErr replicas > 1 not supported in non-clustered mode
546
        JSStreamReplicasNotSupportedErr ErrorIdentifier = 10074
547

548
        // JSStreamReplicasNotUpdatableErr Replicas configuration can not be updated
549
        JSStreamReplicasNotUpdatableErr ErrorIdentifier = 10061
550

551
        // JSStreamRestoreErrF restore failed: {err}
552
        JSStreamRestoreErrF ErrorIdentifier = 10062
553

554
        // JSStreamRollupFailedF Generic stream rollup failure error string ({err})
555
        JSStreamRollupFailedF ErrorIdentifier = 10111
556

557
        // JSStreamSealedErr invalid operation on sealed stream
558
        JSStreamSealedErr ErrorIdentifier = 10109
559

560
        // JSStreamSequenceNotMatchErr expected stream sequence does not match
561
        JSStreamSequenceNotMatchErr ErrorIdentifier = 10063
562

563
        // JSStreamSnapshotErrF snapshot failed: {err}
564
        JSStreamSnapshotErrF ErrorIdentifier = 10064
565

566
        // JSStreamStoreFailedF Generic error when storing a message failed ({err})
567
        JSStreamStoreFailedF ErrorIdentifier = 10077
568

569
        // JSStreamSubjectOverlapErr subjects overlap with an existing stream
570
        JSStreamSubjectOverlapErr ErrorIdentifier = 10065
571

572
        // JSStreamTemplateCreateErrF Generic template creation failed string ({err})
573
        JSStreamTemplateCreateErrF ErrorIdentifier = 10066
574

575
        // JSStreamTemplateDeleteErrF Generic stream template deletion failed error string ({err})
576
        JSStreamTemplateDeleteErrF ErrorIdentifier = 10067
577

578
        // JSStreamTemplateNotFoundErr template not found
579
        JSStreamTemplateNotFoundErr ErrorIdentifier = 10068
580

581
        // JSStreamTooManyRequests too many requests
582
        JSStreamTooManyRequests ErrorIdentifier = 10167
583

584
        // JSStreamTransformInvalidDestination stream transform: {err}
585
        JSStreamTransformInvalidDestination ErrorIdentifier = 10156
586

587
        // JSStreamTransformInvalidSource stream transform source: {err}
588
        JSStreamTransformInvalidSource ErrorIdentifier = 10155
589

590
        // JSStreamUpdateErrF Generic stream update error string ({err})
591
        JSStreamUpdateErrF ErrorIdentifier = 10069
592

593
        // JSStreamWrongLastMsgIDErrF wrong last msg ID: {id}
594
        JSStreamWrongLastMsgIDErrF ErrorIdentifier = 10070
595

596
        // JSStreamWrongLastSequenceConstantErr wrong last sequence
597
        JSStreamWrongLastSequenceConstantErr ErrorIdentifier = 10164
598

599
        // JSStreamWrongLastSequenceErrF wrong last sequence: {seq}
600
        JSStreamWrongLastSequenceErrF ErrorIdentifier = 10071
601

602
        // JSTempStorageFailedErr JetStream unable to open temp storage for restore
603
        JSTempStorageFailedErr ErrorIdentifier = 10072
604

605
        // JSTemplateNameNotMatchSubjectErr template name in subject does not match request
606
        JSTemplateNameNotMatchSubjectErr ErrorIdentifier = 10073
607
)
608

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

836
// NewJSAccountResourcesExceededError creates a new JSAccountResourcesExceededErr error: "resource limits exceeded for account"
837
func NewJSAccountResourcesExceededError(opts ...ErrorOption) *ApiError {
20,058✔
838
        eopts := parseOpts(opts)
20,058✔
839
        if ae, ok := eopts.err.(*ApiError); ok {
20,058✔
840
                return ae
×
841
        }
×
842

843
        return ApiErrors[JSAccountResourcesExceededErr]
20,058✔
844
}
845

846
// NewJSAtomicPublishContainsDuplicateMessageError creates a new JSAtomicPublishContainsDuplicateMessageErr error: "atomic publish batch contains duplicate message id"
847
func NewJSAtomicPublishContainsDuplicateMessageError(opts ...ErrorOption) *ApiError {
21,955✔
848
        eopts := parseOpts(opts)
21,955✔
849
        if ae, ok := eopts.err.(*ApiError); ok {
21,955✔
850
                return ae
×
851
        }
×
852

853
        return ApiErrors[JSAtomicPublishContainsDuplicateMessageErr]
21,955✔
854
}
855

856
// NewJSAtomicPublishDisabledError creates a new JSAtomicPublishDisabledErr error: "atomic publish is disabled"
857
func NewJSAtomicPublishDisabledError(opts ...ErrorOption) *ApiError {
24✔
858
        eopts := parseOpts(opts)
24✔
859
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
860
                return ae
×
861
        }
×
862

863
        return ApiErrors[JSAtomicPublishDisabledErr]
24✔
864
}
865

866
// NewJSAtomicPublishIncompleteBatchError creates a new JSAtomicPublishIncompleteBatchErr error: "atomic publish batch is incomplete"
867
func NewJSAtomicPublishIncompleteBatchError(opts ...ErrorOption) *ApiError {
62✔
868
        eopts := parseOpts(opts)
62✔
869
        if ae, ok := eopts.err.(*ApiError); ok {
62✔
870
                return ae
×
871
        }
×
872

873
        return ApiErrors[JSAtomicPublishIncompleteBatchErr]
62✔
874
}
875

876
// NewJSAtomicPublishInvalidBatchCommitError creates a new JSAtomicPublishInvalidBatchCommitErr error: "atomic publish batch commit is invalid"
877
func NewJSAtomicPublishInvalidBatchCommitError(opts ...ErrorOption) *ApiError {
6✔
878
        eopts := parseOpts(opts)
6✔
879
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
880
                return ae
×
881
        }
×
882

883
        return ApiErrors[JSAtomicPublishInvalidBatchCommitErr]
6✔
884
}
885

886
// NewJSAtomicPublishInvalidBatchIDError creates a new JSAtomicPublishInvalidBatchIDErr error: "atomic publish batch ID is invalid"
887
func NewJSAtomicPublishInvalidBatchIDError(opts ...ErrorOption) *ApiError {
4✔
888
        eopts := parseOpts(opts)
4✔
889
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
890
                return ae
×
891
        }
×
892

893
        return ApiErrors[JSAtomicPublishInvalidBatchIDErr]
4✔
894
}
895

896
// NewJSAtomicPublishMissingSeqError creates a new JSAtomicPublishMissingSeqErr error: "atomic publish sequence is missing"
897
func NewJSAtomicPublishMissingSeqError(opts ...ErrorOption) *ApiError {
24✔
898
        eopts := parseOpts(opts)
24✔
899
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
900
                return ae
×
901
        }
×
902

903
        return ApiErrors[JSAtomicPublishMissingSeqErr]
24✔
904
}
905

906
// NewJSAtomicPublishTooLargeBatchError creates a new JSAtomicPublishTooLargeBatchErrF error: "atomic publish batch is too large: {size}"
907
func NewJSAtomicPublishTooLargeBatchError(size interface{}, opts ...ErrorOption) *ApiError {
10✔
908
        eopts := parseOpts(opts)
10✔
909
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
910
                return ae
×
911
        }
×
912

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

922
// NewJSAtomicPublishUnsupportedHeaderBatchError creates a new JSAtomicPublishUnsupportedHeaderBatchErr error: "atomic publish unsupported header used: {header}"
923
func NewJSAtomicPublishUnsupportedHeaderBatchError(header interface{}, opts ...ErrorOption) *ApiError {
4✔
924
        eopts := parseOpts(opts)
4✔
925
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
926
                return ae
×
927
        }
×
928

929
        e := ApiErrors[JSAtomicPublishUnsupportedHeaderBatchErr]
4✔
930
        args := e.toReplacerArgs([]interface{}{"{header}", header})
4✔
931
        return &ApiError{
4✔
932
                Code:        e.Code,
4✔
933
                ErrCode:     e.ErrCode,
4✔
934
                Description: strings.NewReplacer(args...).Replace(e.Description),
4✔
935
        }
4✔
936
}
937

938
// NewJSBadRequestError creates a new JSBadRequestErr error: "bad request"
939
func NewJSBadRequestError(opts ...ErrorOption) *ApiError {
10✔
940
        eopts := parseOpts(opts)
10✔
941
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
942
                return ae
×
943
        }
×
944

945
        return ApiErrors[JSBadRequestErr]
10✔
946
}
947

948
// NewJSClusterIncompleteError creates a new JSClusterIncompleteErr error: "incomplete results"
949
func NewJSClusterIncompleteError(opts ...ErrorOption) *ApiError {
×
950
        eopts := parseOpts(opts)
×
951
        if ae, ok := eopts.err.(*ApiError); ok {
×
952
                return ae
×
953
        }
×
954

955
        return ApiErrors[JSClusterIncompleteErr]
×
956
}
957

958
// NewJSClusterNoPeersError creates a new JSClusterNoPeersErrF error: "{err}"
959
func NewJSClusterNoPeersError(err error, opts ...ErrorOption) *ApiError {
60✔
960
        eopts := parseOpts(opts)
60✔
961
        if ae, ok := eopts.err.(*ApiError); ok {
60✔
962
                return ae
×
963
        }
×
964

965
        e := ApiErrors[JSClusterNoPeersErrF]
60✔
966
        args := e.toReplacerArgs([]interface{}{"{err}", err})
60✔
967
        return &ApiError{
60✔
968
                Code:        e.Code,
60✔
969
                ErrCode:     e.ErrCode,
60✔
970
                Description: strings.NewReplacer(args...).Replace(e.Description),
60✔
971
        }
60✔
972
}
973

974
// NewJSClusterNotActiveError creates a new JSClusterNotActiveErr error: "JetStream not in clustered mode"
975
func NewJSClusterNotActiveError(opts ...ErrorOption) *ApiError {
1✔
976
        eopts := parseOpts(opts)
1✔
977
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
978
                return ae
×
979
        }
×
980

981
        return ApiErrors[JSClusterNotActiveErr]
1✔
982
}
983

984
// NewJSClusterNotAssignedError creates a new JSClusterNotAssignedErr error: "JetStream cluster not assigned to this server"
985
func NewJSClusterNotAssignedError(opts ...ErrorOption) *ApiError {
27✔
986
        eopts := parseOpts(opts)
27✔
987
        if ae, ok := eopts.err.(*ApiError); ok {
27✔
988
                return ae
×
989
        }
×
990

991
        return ApiErrors[JSClusterNotAssignedErr]
27✔
992
}
993

994
// NewJSClusterNotAvailError creates a new JSClusterNotAvailErr error: "JetStream system temporarily unavailable"
995
func NewJSClusterNotAvailError(opts ...ErrorOption) *ApiError {
13✔
996
        eopts := parseOpts(opts)
13✔
997
        if ae, ok := eopts.err.(*ApiError); ok {
13✔
998
                return ae
×
999
        }
×
1000

1001
        return ApiErrors[JSClusterNotAvailErr]
13✔
1002
}
1003

1004
// NewJSClusterNotLeaderError creates a new JSClusterNotLeaderErr error: "JetStream cluster can not handle request"
1005
func NewJSClusterNotLeaderError(opts ...ErrorOption) *ApiError {
11✔
1006
        eopts := parseOpts(opts)
11✔
1007
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
1008
                return ae
×
1009
        }
×
1010

1011
        return ApiErrors[JSClusterNotLeaderErr]
11✔
1012
}
1013

1014
// NewJSClusterPeerNotMemberError creates a new JSClusterPeerNotMemberErr error: "peer not a member"
1015
func NewJSClusterPeerNotMemberError(opts ...ErrorOption) *ApiError {
1✔
1016
        eopts := parseOpts(opts)
1✔
1017
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1018
                return ae
×
1019
        }
×
1020

1021
        return ApiErrors[JSClusterPeerNotMemberErr]
1✔
1022
}
1023

1024
// NewJSClusterRequiredError creates a new JSClusterRequiredErr error: "JetStream clustering support required"
1025
func NewJSClusterRequiredError(opts ...ErrorOption) *ApiError {
×
1026
        eopts := parseOpts(opts)
×
1027
        if ae, ok := eopts.err.(*ApiError); ok {
×
1028
                return ae
×
1029
        }
×
1030

1031
        return ApiErrors[JSClusterRequiredErr]
×
1032
}
1033

1034
// NewJSClusterServerNotMemberError creates a new JSClusterServerNotMemberErr error: "server is not a member of the cluster"
1035
func NewJSClusterServerNotMemberError(opts ...ErrorOption) *ApiError {
3✔
1036
        eopts := parseOpts(opts)
3✔
1037
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1038
                return ae
×
1039
        }
×
1040

1041
        return ApiErrors[JSClusterServerNotMemberErr]
3✔
1042
}
1043

1044
// NewJSClusterTagsError creates a new JSClusterTagsErr error: "tags placement not supported for operation"
1045
func NewJSClusterTagsError(opts ...ErrorOption) *ApiError {
×
1046
        eopts := parseOpts(opts)
×
1047
        if ae, ok := eopts.err.(*ApiError); ok {
×
1048
                return ae
×
1049
        }
×
1050

1051
        return ApiErrors[JSClusterTagsErr]
×
1052
}
1053

1054
// NewJSClusterUnSupportFeatureError creates a new JSClusterUnSupportFeatureErr error: "not currently supported in clustered mode"
1055
func NewJSClusterUnSupportFeatureError(opts ...ErrorOption) *ApiError {
6✔
1056
        eopts := parseOpts(opts)
6✔
1057
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1058
                return ae
×
1059
        }
×
1060

1061
        return ApiErrors[JSClusterUnSupportFeatureErr]
6✔
1062
}
1063

1064
// NewJSConsumerAckPolicyInvalidError creates a new JSConsumerAckPolicyInvalidErr error: "consumer ack policy invalid"
1065
func NewJSConsumerAckPolicyInvalidError(opts ...ErrorOption) *ApiError {
2✔
1066
        eopts := parseOpts(opts)
2✔
1067
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1068
                return ae
×
1069
        }
×
1070

1071
        return ApiErrors[JSConsumerAckPolicyInvalidErr]
2✔
1072
}
1073

1074
// NewJSConsumerAckWaitNegativeError creates a new JSConsumerAckWaitNegativeErr error: "consumer ack wait needs to be positive"
1075
func NewJSConsumerAckWaitNegativeError(opts ...ErrorOption) *ApiError {
2✔
1076
        eopts := parseOpts(opts)
2✔
1077
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1078
                return ae
×
1079
        }
×
1080

1081
        return ApiErrors[JSConsumerAckWaitNegativeErr]
2✔
1082
}
1083

1084
// NewJSConsumerAlreadyExistsError creates a new JSConsumerAlreadyExists error: "consumer already exists"
1085
func NewJSConsumerAlreadyExistsError(opts ...ErrorOption) *ApiError {
5✔
1086
        eopts := parseOpts(opts)
5✔
1087
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
1088
                return ae
×
1089
        }
×
1090

1091
        return ApiErrors[JSConsumerAlreadyExists]
5✔
1092
}
1093

1094
// NewJSConsumerBackOffNegativeError creates a new JSConsumerBackOffNegativeErr error: "consumer backoff needs to be positive"
1095
func NewJSConsumerBackOffNegativeError(opts ...ErrorOption) *ApiError {
2✔
1096
        eopts := parseOpts(opts)
2✔
1097
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1098
                return ae
×
1099
        }
×
1100

1101
        return ApiErrors[JSConsumerBackOffNegativeErr]
2✔
1102
}
1103

1104
// NewJSConsumerBadDurableNameError creates a new JSConsumerBadDurableNameErr error: "durable name can not contain '.', '*', '>'"
1105
func NewJSConsumerBadDurableNameError(opts ...ErrorOption) *ApiError {
×
1106
        eopts := parseOpts(opts)
×
1107
        if ae, ok := eopts.err.(*ApiError); ok {
×
1108
                return ae
×
1109
        }
×
1110

1111
        return ApiErrors[JSConsumerBadDurableNameErr]
×
1112
}
1113

1114
// NewJSConsumerConfigRequiredError creates a new JSConsumerConfigRequiredErr error: "consumer config required"
1115
func NewJSConsumerConfigRequiredError(opts ...ErrorOption) *ApiError {
2✔
1116
        eopts := parseOpts(opts)
2✔
1117
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1118
                return ae
×
1119
        }
×
1120

1121
        return ApiErrors[JSConsumerConfigRequiredErr]
2✔
1122
}
1123

1124
// NewJSConsumerCreateDurableAndNameMismatchError creates a new JSConsumerCreateDurableAndNameMismatch error: "Consumer Durable and Name have to be equal if both are provided"
1125
func NewJSConsumerCreateDurableAndNameMismatchError(opts ...ErrorOption) *ApiError {
1✔
1126
        eopts := parseOpts(opts)
1✔
1127
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1128
                return ae
×
1129
        }
×
1130

1131
        return ApiErrors[JSConsumerCreateDurableAndNameMismatch]
1✔
1132
}
1133

1134
// NewJSConsumerCreateError creates a new JSConsumerCreateErrF error: "{err}"
1135
func NewJSConsumerCreateError(err error, opts ...ErrorOption) *ApiError {
71✔
1136
        eopts := parseOpts(opts)
71✔
1137
        if ae, ok := eopts.err.(*ApiError); ok {
124✔
1138
                return ae
53✔
1139
        }
53✔
1140

1141
        e := ApiErrors[JSConsumerCreateErrF]
18✔
1142
        args := e.toReplacerArgs([]interface{}{"{err}", err})
18✔
1143
        return &ApiError{
18✔
1144
                Code:        e.Code,
18✔
1145
                ErrCode:     e.ErrCode,
18✔
1146
                Description: strings.NewReplacer(args...).Replace(e.Description),
18✔
1147
        }
18✔
1148
}
1149

1150
// NewJSConsumerCreateFilterSubjectMismatchError creates a new JSConsumerCreateFilterSubjectMismatchErr error: "Consumer create request did not match filtered subject from create subject"
1151
func NewJSConsumerCreateFilterSubjectMismatchError(opts ...ErrorOption) *ApiError {
2✔
1152
        eopts := parseOpts(opts)
2✔
1153
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1154
                return ae
×
1155
        }
×
1156

1157
        return ApiErrors[JSConsumerCreateFilterSubjectMismatchErr]
2✔
1158
}
1159

1160
// NewJSConsumerDeliverCycleError creates a new JSConsumerDeliverCycleErr error: "consumer deliver subject forms a cycle"
1161
func NewJSConsumerDeliverCycleError(opts ...ErrorOption) *ApiError {
4✔
1162
        eopts := parseOpts(opts)
4✔
1163
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1164
                return ae
×
1165
        }
×
1166

1167
        return ApiErrors[JSConsumerDeliverCycleErr]
4✔
1168
}
1169

1170
// NewJSConsumerDeliverToWildcardsError creates a new JSConsumerDeliverToWildcardsErr error: "consumer deliver subject has wildcards"
1171
func NewJSConsumerDeliverToWildcardsError(opts ...ErrorOption) *ApiError {
4✔
1172
        eopts := parseOpts(opts)
4✔
1173
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1174
                return ae
×
1175
        }
×
1176

1177
        return ApiErrors[JSConsumerDeliverToWildcardsErr]
4✔
1178
}
1179

1180
// NewJSConsumerDescriptionTooLongError creates a new JSConsumerDescriptionTooLongErrF error: "consumer description is too long, maximum allowed is {max}"
1181
func NewJSConsumerDescriptionTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
1✔
1182
        eopts := parseOpts(opts)
1✔
1183
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1184
                return ae
×
1185
        }
×
1186

1187
        e := ApiErrors[JSConsumerDescriptionTooLongErrF]
1✔
1188
        args := e.toReplacerArgs([]interface{}{"{max}", max})
1✔
1189
        return &ApiError{
1✔
1190
                Code:        e.Code,
1✔
1191
                ErrCode:     e.ErrCode,
1✔
1192
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1193
        }
1✔
1194
}
1195

1196
// NewJSConsumerDirectRequiresEphemeralError creates a new JSConsumerDirectRequiresEphemeralErr error: "consumer direct requires an ephemeral consumer"
1197
func NewJSConsumerDirectRequiresEphemeralError(opts ...ErrorOption) *ApiError {
×
1198
        eopts := parseOpts(opts)
×
1199
        if ae, ok := eopts.err.(*ApiError); ok {
×
1200
                return ae
×
1201
        }
×
1202

1203
        return ApiErrors[JSConsumerDirectRequiresEphemeralErr]
×
1204
}
1205

1206
// NewJSConsumerDirectRequiresPushError creates a new JSConsumerDirectRequiresPushErr error: "consumer direct requires a push based consumer"
1207
func NewJSConsumerDirectRequiresPushError(opts ...ErrorOption) *ApiError {
×
1208
        eopts := parseOpts(opts)
×
1209
        if ae, ok := eopts.err.(*ApiError); ok {
×
1210
                return ae
×
1211
        }
×
1212

1213
        return ApiErrors[JSConsumerDirectRequiresPushErr]
×
1214
}
1215

1216
// NewJSConsumerDoesNotExistError creates a new JSConsumerDoesNotExist error: "consumer does not exist"
1217
func NewJSConsumerDoesNotExistError(opts ...ErrorOption) *ApiError {
3✔
1218
        eopts := parseOpts(opts)
3✔
1219
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1220
                return ae
×
1221
        }
×
1222

1223
        return ApiErrors[JSConsumerDoesNotExist]
3✔
1224
}
1225

1226
// NewJSConsumerDuplicateFilterSubjectsError creates a new JSConsumerDuplicateFilterSubjects error: "consumer cannot have both FilterSubject and FilterSubjects specified"
1227
func NewJSConsumerDuplicateFilterSubjectsError(opts ...ErrorOption) *ApiError {
1✔
1228
        eopts := parseOpts(opts)
1✔
1229
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1230
                return ae
×
1231
        }
×
1232

1233
        return ApiErrors[JSConsumerDuplicateFilterSubjects]
1✔
1234
}
1235

1236
// NewJSConsumerDurableNameNotInSubjectError creates a new JSConsumerDurableNameNotInSubjectErr error: "consumer expected to be durable but no durable name set in subject"
1237
func NewJSConsumerDurableNameNotInSubjectError(opts ...ErrorOption) *ApiError {
×
1238
        eopts := parseOpts(opts)
×
1239
        if ae, ok := eopts.err.(*ApiError); ok {
×
1240
                return ae
×
1241
        }
×
1242

1243
        return ApiErrors[JSConsumerDurableNameNotInSubjectErr]
×
1244
}
1245

1246
// NewJSConsumerDurableNameNotMatchSubjectError creates a new JSConsumerDurableNameNotMatchSubjectErr error: "consumer name in subject does not match durable name in request"
1247
func NewJSConsumerDurableNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
×
1248
        eopts := parseOpts(opts)
×
1249
        if ae, ok := eopts.err.(*ApiError); ok {
×
1250
                return ae
×
1251
        }
×
1252

1253
        return ApiErrors[JSConsumerDurableNameNotMatchSubjectErr]
×
1254
}
1255

1256
// NewJSConsumerDurableNameNotSetError creates a new JSConsumerDurableNameNotSetErr error: "consumer expected to be durable but a durable name was not set"
1257
func NewJSConsumerDurableNameNotSetError(opts ...ErrorOption) *ApiError {
1✔
1258
        eopts := parseOpts(opts)
1✔
1259
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1260
                return ae
×
1261
        }
×
1262

1263
        return ApiErrors[JSConsumerDurableNameNotSetErr]
1✔
1264
}
1265

1266
// NewJSConsumerEmptyFilterError creates a new JSConsumerEmptyFilter error: "consumer filter in FilterSubjects cannot be empty"
1267
func NewJSConsumerEmptyFilterError(opts ...ErrorOption) *ApiError {
1✔
1268
        eopts := parseOpts(opts)
1✔
1269
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1270
                return ae
×
1271
        }
×
1272

1273
        return ApiErrors[JSConsumerEmptyFilter]
1✔
1274
}
1275

1276
// NewJSConsumerEmptyGroupNameError creates a new JSConsumerEmptyGroupName error: "Group name cannot be an empty string"
1277
func NewJSConsumerEmptyGroupNameError(opts ...ErrorOption) *ApiError {
4✔
1278
        eopts := parseOpts(opts)
4✔
1279
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1280
                return ae
×
1281
        }
×
1282

1283
        return ApiErrors[JSConsumerEmptyGroupName]
4✔
1284
}
1285

1286
// NewJSConsumerEphemeralWithDurableInSubjectError creates a new JSConsumerEphemeralWithDurableInSubjectErr error: "consumer expected to be ephemeral but detected a durable name set in subject"
1287
func NewJSConsumerEphemeralWithDurableInSubjectError(opts ...ErrorOption) *ApiError {
×
1288
        eopts := parseOpts(opts)
×
1289
        if ae, ok := eopts.err.(*ApiError); ok {
×
1290
                return ae
×
1291
        }
×
1292

1293
        return ApiErrors[JSConsumerEphemeralWithDurableInSubjectErr]
×
1294
}
1295

1296
// NewJSConsumerEphemeralWithDurableNameError creates a new JSConsumerEphemeralWithDurableNameErr error: "consumer expected to be ephemeral but a durable name was set in request"
1297
func NewJSConsumerEphemeralWithDurableNameError(opts ...ErrorOption) *ApiError {
3✔
1298
        eopts := parseOpts(opts)
3✔
1299
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1300
                return ae
×
1301
        }
×
1302

1303
        return ApiErrors[JSConsumerEphemeralWithDurableNameErr]
3✔
1304
}
1305

1306
// NewJSConsumerExistingActiveError creates a new JSConsumerExistingActiveErr error: "consumer already exists and is still active"
1307
func NewJSConsumerExistingActiveError(opts ...ErrorOption) *ApiError {
×
1308
        eopts := parseOpts(opts)
×
1309
        if ae, ok := eopts.err.(*ApiError); ok {
×
1310
                return ae
×
1311
        }
×
1312

1313
        return ApiErrors[JSConsumerExistingActiveErr]
×
1314
}
1315

1316
// NewJSConsumerFCRequiresPushError creates a new JSConsumerFCRequiresPushErr error: "consumer flow control requires a push based consumer"
1317
func NewJSConsumerFCRequiresPushError(opts ...ErrorOption) *ApiError {
×
1318
        eopts := parseOpts(opts)
×
1319
        if ae, ok := eopts.err.(*ApiError); ok {
×
1320
                return ae
×
1321
        }
×
1322

1323
        return ApiErrors[JSConsumerFCRequiresPushErr]
×
1324
}
1325

1326
// NewJSConsumerFilterNotSubsetError creates a new JSConsumerFilterNotSubsetErr error: "consumer filter subject is not a valid subset of the interest subjects"
1327
func NewJSConsumerFilterNotSubsetError(opts ...ErrorOption) *ApiError {
×
1328
        eopts := parseOpts(opts)
×
1329
        if ae, ok := eopts.err.(*ApiError); ok {
×
1330
                return ae
×
1331
        }
×
1332

1333
        return ApiErrors[JSConsumerFilterNotSubsetErr]
×
1334
}
1335

1336
// NewJSConsumerHBRequiresPushError creates a new JSConsumerHBRequiresPushErr error: "consumer idle heartbeat requires a push based consumer"
1337
func NewJSConsumerHBRequiresPushError(opts ...ErrorOption) *ApiError {
×
1338
        eopts := parseOpts(opts)
×
1339
        if ae, ok := eopts.err.(*ApiError); ok {
×
1340
                return ae
×
1341
        }
×
1342

1343
        return ApiErrors[JSConsumerHBRequiresPushErr]
×
1344
}
1345

1346
// NewJSConsumerInactiveThresholdExcessError creates a new JSConsumerInactiveThresholdExcess error: "consumer inactive threshold exceeds system limit of {limit}"
1347
func NewJSConsumerInactiveThresholdExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
2✔
1348
        eopts := parseOpts(opts)
2✔
1349
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1350
                return ae
×
1351
        }
×
1352

1353
        e := ApiErrors[JSConsumerInactiveThresholdExcess]
2✔
1354
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
2✔
1355
        return &ApiError{
2✔
1356
                Code:        e.Code,
2✔
1357
                ErrCode:     e.ErrCode,
2✔
1358
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1359
        }
2✔
1360
}
1361

1362
// NewJSConsumerInvalidDeliverSubjectError creates a new JSConsumerInvalidDeliverSubject error: "invalid push consumer deliver subject"
1363
func NewJSConsumerInvalidDeliverSubjectError(opts ...ErrorOption) *ApiError {
2✔
1364
        eopts := parseOpts(opts)
2✔
1365
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1366
                return ae
×
1367
        }
×
1368

1369
        return ApiErrors[JSConsumerInvalidDeliverSubject]
2✔
1370
}
1371

1372
// NewJSConsumerInvalidGroupNameError creates a new JSConsumerInvalidGroupNameErr error: "Valid priority group name must match A-Z, a-z, 0-9, -_/=)+ and may not exceed 16 characters"
1373
func NewJSConsumerInvalidGroupNameError(opts ...ErrorOption) *ApiError {
4✔
1374
        eopts := parseOpts(opts)
4✔
1375
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1376
                return ae
×
1377
        }
×
1378

1379
        return ApiErrors[JSConsumerInvalidGroupNameErr]
4✔
1380
}
1381

1382
// NewJSConsumerInvalidPolicyError creates a new JSConsumerInvalidPolicyErrF error: "{err}"
1383
func NewJSConsumerInvalidPolicyError(err error, opts ...ErrorOption) *ApiError {
10✔
1384
        eopts := parseOpts(opts)
10✔
1385
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1386
                return ae
×
1387
        }
×
1388

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

1398
// NewJSConsumerInvalidPriorityGroupError creates a new JSConsumerInvalidPriorityGroupErr error: "Provided priority group does not exist for this consumer"
1399
func NewJSConsumerInvalidPriorityGroupError(opts ...ErrorOption) *ApiError {
2✔
1400
        eopts := parseOpts(opts)
2✔
1401
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1402
                return ae
×
1403
        }
×
1404

1405
        return ApiErrors[JSConsumerInvalidPriorityGroupErr]
2✔
1406
}
1407

1408
// NewJSConsumerInvalidSamplingError creates a new JSConsumerInvalidSamplingErrF error: "failed to parse consumer sampling configuration: {err}"
1409
func NewJSConsumerInvalidSamplingError(err error, opts ...ErrorOption) *ApiError {
×
1410
        eopts := parseOpts(opts)
×
1411
        if ae, ok := eopts.err.(*ApiError); ok {
×
1412
                return ae
×
1413
        }
×
1414

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

1424
// NewJSConsumerMaxDeliverBackoffError creates a new JSConsumerMaxDeliverBackoffErr error: "max deliver is required to be > length of backoff values"
1425
func NewJSConsumerMaxDeliverBackoffError(opts ...ErrorOption) *ApiError {
3✔
1426
        eopts := parseOpts(opts)
3✔
1427
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1428
                return ae
×
1429
        }
×
1430

1431
        return ApiErrors[JSConsumerMaxDeliverBackoffErr]
3✔
1432
}
1433

1434
// NewJSConsumerMaxPendingAckExcessError creates a new JSConsumerMaxPendingAckExcessErrF error: "consumer max ack pending exceeds system limit of {limit}"
1435
func NewJSConsumerMaxPendingAckExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
12✔
1436
        eopts := parseOpts(opts)
12✔
1437
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
1438
                return ae
×
1439
        }
×
1440

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

1450
// NewJSConsumerMaxPendingAckPolicyRequiredError creates a new JSConsumerMaxPendingAckPolicyRequiredErr error: "consumer requires ack policy for max ack pending"
1451
func NewJSConsumerMaxPendingAckPolicyRequiredError(opts ...ErrorOption) *ApiError {
2✔
1452
        eopts := parseOpts(opts)
2✔
1453
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1454
                return ae
×
1455
        }
×
1456

1457
        return ApiErrors[JSConsumerMaxPendingAckPolicyRequiredErr]
2✔
1458
}
1459

1460
// NewJSConsumerMaxRequestBatchExceededError creates a new JSConsumerMaxRequestBatchExceededF error: "consumer max request batch exceeds server limit of {limit}"
1461
func NewJSConsumerMaxRequestBatchExceededError(limit interface{}, opts ...ErrorOption) *ApiError {
4✔
1462
        eopts := parseOpts(opts)
4✔
1463
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1464
                return ae
×
1465
        }
×
1466

1467
        e := ApiErrors[JSConsumerMaxRequestBatchExceededF]
4✔
1468
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
4✔
1469
        return &ApiError{
4✔
1470
                Code:        e.Code,
4✔
1471
                ErrCode:     e.ErrCode,
4✔
1472
                Description: strings.NewReplacer(args...).Replace(e.Description),
4✔
1473
        }
4✔
1474
}
1475

1476
// NewJSConsumerMaxRequestBatchNegativeError creates a new JSConsumerMaxRequestBatchNegativeErr error: "consumer max request batch needs to be > 0"
1477
func NewJSConsumerMaxRequestBatchNegativeError(opts ...ErrorOption) *ApiError {
×
1478
        eopts := parseOpts(opts)
×
1479
        if ae, ok := eopts.err.(*ApiError); ok {
×
1480
                return ae
×
1481
        }
×
1482

1483
        return ApiErrors[JSConsumerMaxRequestBatchNegativeErr]
×
1484
}
1485

1486
// NewJSConsumerMaxRequestExpiresTooSmallError creates a new JSConsumerMaxRequestExpiresTooSmall error: "consumer max request expires needs to be >= 1ms"
1487
func NewJSConsumerMaxRequestExpiresTooSmallError(opts ...ErrorOption) *ApiError {
×
1488
        eopts := parseOpts(opts)
×
1489
        if ae, ok := eopts.err.(*ApiError); ok {
×
1490
                return ae
×
1491
        }
×
1492

1493
        return ApiErrors[JSConsumerMaxRequestExpiresTooSmall]
×
1494
}
1495

1496
// NewJSConsumerMaxWaitingNegativeError creates a new JSConsumerMaxWaitingNegativeErr error: "consumer max waiting needs to be positive"
1497
func NewJSConsumerMaxWaitingNegativeError(opts ...ErrorOption) *ApiError {
×
1498
        eopts := parseOpts(opts)
×
1499
        if ae, ok := eopts.err.(*ApiError); ok {
×
1500
                return ae
×
1501
        }
×
1502

1503
        return ApiErrors[JSConsumerMaxWaitingNegativeErr]
×
1504
}
1505

1506
// NewJSConsumerMetadataLengthError creates a new JSConsumerMetadataLengthErrF error: "consumer metadata exceeds maximum size of {limit}"
1507
func NewJSConsumerMetadataLengthError(limit interface{}, opts ...ErrorOption) *ApiError {
1✔
1508
        eopts := parseOpts(opts)
1✔
1509
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1510
                return ae
×
1511
        }
×
1512

1513
        e := ApiErrors[JSConsumerMetadataLengthErrF]
1✔
1514
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
1✔
1515
        return &ApiError{
1✔
1516
                Code:        e.Code,
1✔
1517
                ErrCode:     e.ErrCode,
1✔
1518
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1519
        }
1✔
1520
}
1521

1522
// NewJSConsumerMultipleFiltersNotAllowedError creates a new JSConsumerMultipleFiltersNotAllowed error: "consumer with multiple subject filters cannot use subject based API"
1523
func NewJSConsumerMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
1524
        eopts := parseOpts(opts)
1✔
1525
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1526
                return ae
×
1527
        }
×
1528

1529
        return ApiErrors[JSConsumerMultipleFiltersNotAllowed]
1✔
1530
}
1531

1532
// NewJSConsumerNameContainsPathSeparatorsError creates a new JSConsumerNameContainsPathSeparatorsErr error: "Consumer name can not contain path separators"
1533
func NewJSConsumerNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
8✔
1534
        eopts := parseOpts(opts)
8✔
1535
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1536
                return ae
×
1537
        }
×
1538

1539
        return ApiErrors[JSConsumerNameContainsPathSeparatorsErr]
8✔
1540
}
1541

1542
// NewJSConsumerNameExistError creates a new JSConsumerNameExistErr error: "consumer name already in use"
1543
func NewJSConsumerNameExistError(opts ...ErrorOption) *ApiError {
2✔
1544
        eopts := parseOpts(opts)
2✔
1545
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1546
                return ae
×
1547
        }
×
1548

1549
        return ApiErrors[JSConsumerNameExistErr]
2✔
1550
}
1551

1552
// NewJSConsumerNameTooLongError creates a new JSConsumerNameTooLongErrF error: "consumer name is too long, maximum allowed is {max}"
1553
func NewJSConsumerNameTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
×
1554
        eopts := parseOpts(opts)
×
1555
        if ae, ok := eopts.err.(*ApiError); ok {
×
1556
                return ae
×
1557
        }
×
1558

1559
        e := ApiErrors[JSConsumerNameTooLongErrF]
×
1560
        args := e.toReplacerArgs([]interface{}{"{max}", max})
×
1561
        return &ApiError{
×
1562
                Code:        e.Code,
×
1563
                ErrCode:     e.ErrCode,
×
1564
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1565
        }
×
1566
}
1567

1568
// NewJSConsumerNotFoundError creates a new JSConsumerNotFoundErr error: "consumer not found"
1569
func NewJSConsumerNotFoundError(opts ...ErrorOption) *ApiError {
2,772✔
1570
        eopts := parseOpts(opts)
2,772✔
1571
        if ae, ok := eopts.err.(*ApiError); ok {
2,772✔
1572
                return ae
×
1573
        }
×
1574

1575
        return ApiErrors[JSConsumerNotFoundErr]
2,772✔
1576
}
1577

1578
// NewJSConsumerOfflineError creates a new JSConsumerOfflineErr error: "consumer is offline"
1579
func NewJSConsumerOfflineError(opts ...ErrorOption) *ApiError {
6✔
1580
        eopts := parseOpts(opts)
6✔
1581
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1582
                return ae
×
1583
        }
×
1584

1585
        return ApiErrors[JSConsumerOfflineErr]
6✔
1586
}
1587

1588
// NewJSConsumerOfflineReasonError creates a new JSConsumerOfflineReasonErrF error: "consumer is offline: {err}"
1589
func NewJSConsumerOfflineReasonError(err error, opts ...ErrorOption) *ApiError {
24✔
1590
        eopts := parseOpts(opts)
24✔
1591
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
1592
                return ae
×
1593
        }
×
1594

1595
        e := ApiErrors[JSConsumerOfflineReasonErrF]
24✔
1596
        args := e.toReplacerArgs([]interface{}{"{err}", err})
24✔
1597
        return &ApiError{
24✔
1598
                Code:        e.Code,
24✔
1599
                ErrCode:     e.ErrCode,
24✔
1600
                Description: strings.NewReplacer(args...).Replace(e.Description),
24✔
1601
        }
24✔
1602
}
1603

1604
// NewJSConsumerOnMappedError creates a new JSConsumerOnMappedErr error: "consumer direct on a mapped consumer"
1605
func NewJSConsumerOnMappedError(opts ...ErrorOption) *ApiError {
×
1606
        eopts := parseOpts(opts)
×
1607
        if ae, ok := eopts.err.(*ApiError); ok {
×
1608
                return ae
×
1609
        }
×
1610

1611
        return ApiErrors[JSConsumerOnMappedErr]
×
1612
}
1613

1614
// NewJSConsumerOverlappingSubjectFiltersError creates a new JSConsumerOverlappingSubjectFilters error: "consumer subject filters cannot overlap"
1615
func NewJSConsumerOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
1✔
1616
        eopts := parseOpts(opts)
1✔
1617
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1618
                return ae
×
1619
        }
×
1620

1621
        return ApiErrors[JSConsumerOverlappingSubjectFilters]
1✔
1622
}
1623

1624
// NewJSConsumerPinnedTTLWithoutPriorityPolicyNoneError creates a new JSConsumerPinnedTTLWithoutPriorityPolicyNone error: "PinnedTTL cannot be set when PriorityPolicy is none"
1625
func NewJSConsumerPinnedTTLWithoutPriorityPolicyNoneError(opts ...ErrorOption) *ApiError {
1✔
1626
        eopts := parseOpts(opts)
1✔
1627
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1628
                return ae
×
1629
        }
×
1630

1631
        return ApiErrors[JSConsumerPinnedTTLWithoutPriorityPolicyNone]
1✔
1632
}
1633

1634
// NewJSConsumerPriorityGroupWithPolicyNoneError creates a new JSConsumerPriorityGroupWithPolicyNone error: "consumer can not have priority groups when policy is none"
1635
func NewJSConsumerPriorityGroupWithPolicyNoneError(opts ...ErrorOption) *ApiError {
1✔
1636
        eopts := parseOpts(opts)
1✔
1637
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1638
                return ae
×
1639
        }
×
1640

1641
        return ApiErrors[JSConsumerPriorityGroupWithPolicyNone]
1✔
1642
}
1643

1644
// NewJSConsumerPriorityPolicyWithoutGroupError creates a new JSConsumerPriorityPolicyWithoutGroup error: "Setting PriorityPolicy requires at least one PriorityGroup to be set"
1645
func NewJSConsumerPriorityPolicyWithoutGroupError(opts ...ErrorOption) *ApiError {
4✔
1646
        eopts := parseOpts(opts)
4✔
1647
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1648
                return ae
×
1649
        }
×
1650

1651
        return ApiErrors[JSConsumerPriorityPolicyWithoutGroup]
4✔
1652
}
1653

1654
// NewJSConsumerPullNotDurableError creates a new JSConsumerPullNotDurableErr error: "consumer in pull mode requires a durable name"
1655
func NewJSConsumerPullNotDurableError(opts ...ErrorOption) *ApiError {
×
1656
        eopts := parseOpts(opts)
×
1657
        if ae, ok := eopts.err.(*ApiError); ok {
×
1658
                return ae
×
1659
        }
×
1660

1661
        return ApiErrors[JSConsumerPullNotDurableErr]
×
1662
}
1663

1664
// NewJSConsumerPullRequiresAckError creates a new JSConsumerPullRequiresAckErr error: "consumer in pull mode requires explicit ack policy on workqueue stream"
1665
func NewJSConsumerPullRequiresAckError(opts ...ErrorOption) *ApiError {
6✔
1666
        eopts := parseOpts(opts)
6✔
1667
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1668
                return ae
×
1669
        }
×
1670

1671
        return ApiErrors[JSConsumerPullRequiresAckErr]
6✔
1672
}
1673

1674
// NewJSConsumerPullWithRateLimitError creates a new JSConsumerPullWithRateLimitErr error: "consumer in pull mode can not have rate limit set"
1675
func NewJSConsumerPullWithRateLimitError(opts ...ErrorOption) *ApiError {
1✔
1676
        eopts := parseOpts(opts)
1✔
1677
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1678
                return ae
×
1679
        }
×
1680

1681
        return ApiErrors[JSConsumerPullWithRateLimitErr]
1✔
1682
}
1683

1684
// NewJSConsumerPushMaxWaitingError creates a new JSConsumerPushMaxWaitingErr error: "consumer in push mode can not set max waiting"
1685
func NewJSConsumerPushMaxWaitingError(opts ...ErrorOption) *ApiError {
3✔
1686
        eopts := parseOpts(opts)
3✔
1687
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1688
                return ae
×
1689
        }
×
1690

1691
        return ApiErrors[JSConsumerPushMaxWaitingErr]
3✔
1692
}
1693

1694
// NewJSConsumerPushWithPriorityGroupError creates a new JSConsumerPushWithPriorityGroupErr error: "priority groups can not be used with push consumers"
1695
func NewJSConsumerPushWithPriorityGroupError(opts ...ErrorOption) *ApiError {
1✔
1696
        eopts := parseOpts(opts)
1✔
1697
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1698
                return ae
×
1699
        }
×
1700

1701
        return ApiErrors[JSConsumerPushWithPriorityGroupErr]
1✔
1702
}
1703

1704
// NewJSConsumerReplacementWithDifferentNameError creates a new JSConsumerReplacementWithDifferentNameErr error: "consumer replacement durable config not the same"
1705
func NewJSConsumerReplacementWithDifferentNameError(opts ...ErrorOption) *ApiError {
×
1706
        eopts := parseOpts(opts)
×
1707
        if ae, ok := eopts.err.(*ApiError); ok {
×
1708
                return ae
×
1709
        }
×
1710

1711
        return ApiErrors[JSConsumerReplacementWithDifferentNameErr]
×
1712
}
1713

1714
// NewJSConsumerReplayPolicyInvalidError creates a new JSConsumerReplayPolicyInvalidErr error: "consumer replay policy invalid"
1715
func NewJSConsumerReplayPolicyInvalidError(opts ...ErrorOption) *ApiError {
2✔
1716
        eopts := parseOpts(opts)
2✔
1717
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1718
                return ae
×
1719
        }
×
1720

1721
        return ApiErrors[JSConsumerReplayPolicyInvalidErr]
2✔
1722
}
1723

1724
// NewJSConsumerReplicasExceedsStreamError creates a new JSConsumerReplicasExceedsStream error: "consumer config replica count exceeds parent stream"
1725
func NewJSConsumerReplicasExceedsStreamError(opts ...ErrorOption) *ApiError {
1✔
1726
        eopts := parseOpts(opts)
1✔
1727
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1728
                return ae
×
1729
        }
×
1730

1731
        return ApiErrors[JSConsumerReplicasExceedsStream]
1✔
1732
}
1733

1734
// NewJSConsumerReplicasShouldMatchStreamError creates a new JSConsumerReplicasShouldMatchStream error: "consumer config replicas must match interest retention stream's replicas"
1735
func NewJSConsumerReplicasShouldMatchStreamError(opts ...ErrorOption) *ApiError {
2✔
1736
        eopts := parseOpts(opts)
2✔
1737
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1738
                return ae
×
1739
        }
×
1740

1741
        return ApiErrors[JSConsumerReplicasShouldMatchStream]
2✔
1742
}
1743

1744
// NewJSConsumerSmallHeartbeatError creates a new JSConsumerSmallHeartbeatErr error: "consumer idle heartbeat needs to be >= 100ms"
1745
func NewJSConsumerSmallHeartbeatError(opts ...ErrorOption) *ApiError {
1✔
1746
        eopts := parseOpts(opts)
1✔
1747
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1748
                return ae
×
1749
        }
×
1750

1751
        return ApiErrors[JSConsumerSmallHeartbeatErr]
1✔
1752
}
1753

1754
// NewJSConsumerStoreFailedError creates a new JSConsumerStoreFailedErrF error: "error creating store for consumer: {err}"
1755
func NewJSConsumerStoreFailedError(err error, opts ...ErrorOption) *ApiError {
8✔
1756
        eopts := parseOpts(opts)
8✔
1757
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1758
                return ae
×
1759
        }
×
1760

1761
        e := ApiErrors[JSConsumerStoreFailedErrF]
8✔
1762
        args := e.toReplacerArgs([]interface{}{"{err}", err})
8✔
1763
        return &ApiError{
8✔
1764
                Code:        e.Code,
8✔
1765
                ErrCode:     e.ErrCode,
8✔
1766
                Description: strings.NewReplacer(args...).Replace(e.Description),
8✔
1767
        }
8✔
1768
}
1769

1770
// NewJSConsumerWQConsumerNotDeliverAllError creates a new JSConsumerWQConsumerNotDeliverAllErr error: "consumer must be deliver all on workqueue stream"
1771
func NewJSConsumerWQConsumerNotDeliverAllError(opts ...ErrorOption) *ApiError {
×
1772
        eopts := parseOpts(opts)
×
1773
        if ae, ok := eopts.err.(*ApiError); ok {
×
1774
                return ae
×
1775
        }
×
1776

1777
        return ApiErrors[JSConsumerWQConsumerNotDeliverAllErr]
×
1778
}
1779

1780
// NewJSConsumerWQConsumerNotUniqueError creates a new JSConsumerWQConsumerNotUniqueErr error: "filtered consumer not unique on workqueue stream"
1781
func NewJSConsumerWQConsumerNotUniqueError(opts ...ErrorOption) *ApiError {
11✔
1782
        eopts := parseOpts(opts)
11✔
1783
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
1784
                return ae
×
1785
        }
×
1786

1787
        return ApiErrors[JSConsumerWQConsumerNotUniqueErr]
11✔
1788
}
1789

1790
// NewJSConsumerWQMultipleUnfilteredError creates a new JSConsumerWQMultipleUnfilteredErr error: "multiple non-filtered consumers not allowed on workqueue stream"
1791
func NewJSConsumerWQMultipleUnfilteredError(opts ...ErrorOption) *ApiError {
2✔
1792
        eopts := parseOpts(opts)
2✔
1793
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1794
                return ae
×
1795
        }
×
1796

1797
        return ApiErrors[JSConsumerWQMultipleUnfilteredErr]
2✔
1798
}
1799

1800
// NewJSConsumerWQRequiresExplicitAckError creates a new JSConsumerWQRequiresExplicitAckErr error: "workqueue stream requires explicit ack"
1801
func NewJSConsumerWQRequiresExplicitAckError(opts ...ErrorOption) *ApiError {
×
1802
        eopts := parseOpts(opts)
×
1803
        if ae, ok := eopts.err.(*ApiError); ok {
×
1804
                return ae
×
1805
        }
×
1806

1807
        return ApiErrors[JSConsumerWQRequiresExplicitAckErr]
×
1808
}
1809

1810
// NewJSConsumerWithFlowControlNeedsHeartbeatsError creates a new JSConsumerWithFlowControlNeedsHeartbeats error: "consumer with flow control also needs heartbeats"
1811
func NewJSConsumerWithFlowControlNeedsHeartbeatsError(opts ...ErrorOption) *ApiError {
4✔
1812
        eopts := parseOpts(opts)
4✔
1813
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1814
                return ae
×
1815
        }
×
1816

1817
        return ApiErrors[JSConsumerWithFlowControlNeedsHeartbeats]
4✔
1818
}
1819

1820
// NewJSInsufficientResourcesError creates a new JSInsufficientResourcesErr error: "insufficient resources"
1821
func NewJSInsufficientResourcesError(opts ...ErrorOption) *ApiError {
13✔
1822
        eopts := parseOpts(opts)
13✔
1823
        if ae, ok := eopts.err.(*ApiError); ok {
13✔
1824
                return ae
×
1825
        }
×
1826

1827
        return ApiErrors[JSInsufficientResourcesErr]
13✔
1828
}
1829

1830
// NewJSInvalidJSONError creates a new JSInvalidJSONErr error: "invalid JSON: {err}"
1831
func NewJSInvalidJSONError(err error, opts ...ErrorOption) *ApiError {
10✔
1832
        eopts := parseOpts(opts)
10✔
1833
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1834
                return ae
×
1835
        }
×
1836

1837
        e := ApiErrors[JSInvalidJSONErr]
10✔
1838
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1839
        return &ApiError{
10✔
1840
                Code:        e.Code,
10✔
1841
                ErrCode:     e.ErrCode,
10✔
1842
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1843
        }
10✔
1844
}
1845

1846
// NewJSMaximumConsumersLimitError creates a new JSMaximumConsumersLimitErr error: "maximum consumers limit reached"
1847
func NewJSMaximumConsumersLimitError(opts ...ErrorOption) *ApiError {
29✔
1848
        eopts := parseOpts(opts)
29✔
1849
        if ae, ok := eopts.err.(*ApiError); ok {
29✔
1850
                return ae
×
1851
        }
×
1852

1853
        return ApiErrors[JSMaximumConsumersLimitErr]
29✔
1854
}
1855

1856
// NewJSMaximumStreamsLimitError creates a new JSMaximumStreamsLimitErr error: "maximum number of streams reached"
1857
func NewJSMaximumStreamsLimitError(opts ...ErrorOption) *ApiError {
16✔
1858
        eopts := parseOpts(opts)
16✔
1859
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
1860
                return ae
×
1861
        }
×
1862

1863
        return ApiErrors[JSMaximumStreamsLimitErr]
16✔
1864
}
1865

1866
// NewJSMemoryResourcesExceededError creates a new JSMemoryResourcesExceededErr error: "insufficient memory resources available"
1867
func NewJSMemoryResourcesExceededError(opts ...ErrorOption) *ApiError {
4✔
1868
        eopts := parseOpts(opts)
4✔
1869
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1870
                return ae
×
1871
        }
×
1872

1873
        return ApiErrors[JSMemoryResourcesExceededErr]
4✔
1874
}
1875

1876
// NewJSMessageCounterBrokenError creates a new JSMessageCounterBrokenErr error: "message counter is broken"
1877
func NewJSMessageCounterBrokenError(opts ...ErrorOption) *ApiError {
4✔
1878
        eopts := parseOpts(opts)
4✔
1879
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1880
                return ae
×
1881
        }
×
1882

1883
        return ApiErrors[JSMessageCounterBrokenErr]
4✔
1884
}
1885

1886
// NewJSMessageIncrDisabledError creates a new JSMessageIncrDisabledErr error: "message counters is disabled"
1887
func NewJSMessageIncrDisabledError(opts ...ErrorOption) *ApiError {
4✔
1888
        eopts := parseOpts(opts)
4✔
1889
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1890
                return ae
×
1891
        }
×
1892

1893
        return ApiErrors[JSMessageIncrDisabledErr]
4✔
1894
}
1895

1896
// NewJSMessageIncrInvalidError creates a new JSMessageIncrInvalidErr error: "message counter increment is invalid"
1897
func NewJSMessageIncrInvalidError(opts ...ErrorOption) *ApiError {
24✔
1898
        eopts := parseOpts(opts)
24✔
1899
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
1900
                return ae
×
1901
        }
×
1902

1903
        return ApiErrors[JSMessageIncrInvalidErr]
24✔
1904
}
1905

1906
// NewJSMessageIncrMissingError creates a new JSMessageIncrMissingErr error: "message counter increment is missing"
1907
func NewJSMessageIncrMissingError(opts ...ErrorOption) *ApiError {
8✔
1908
        eopts := parseOpts(opts)
8✔
1909
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1910
                return ae
×
1911
        }
×
1912

1913
        return ApiErrors[JSMessageIncrMissingErr]
8✔
1914
}
1915

1916
// NewJSMessageIncrPayloadError creates a new JSMessageIncrPayloadErr error: "message counter has payload"
1917
func NewJSMessageIncrPayloadError(opts ...ErrorOption) *ApiError {
4✔
1918
        eopts := parseOpts(opts)
4✔
1919
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1920
                return ae
×
1921
        }
×
1922

1923
        return ApiErrors[JSMessageIncrPayloadErr]
4✔
1924
}
1925

1926
// NewJSMessageSchedulesDisabledError creates a new JSMessageSchedulesDisabledErr error: "message schedules is disabled"
1927
func NewJSMessageSchedulesDisabledError(opts ...ErrorOption) *ApiError {
20✔
1928
        eopts := parseOpts(opts)
20✔
1929
        if ae, ok := eopts.err.(*ApiError); ok {
20✔
1930
                return ae
×
1931
        }
×
1932

1933
        return ApiErrors[JSMessageSchedulesDisabledErr]
20✔
1934
}
1935

1936
// NewJSMessageSchedulesPatternInvalidError creates a new JSMessageSchedulesPatternInvalidErr error: "message schedules pattern is invalid"
1937
func NewJSMessageSchedulesPatternInvalidError(opts ...ErrorOption) *ApiError {
15✔
1938
        eopts := parseOpts(opts)
15✔
1939
        if ae, ok := eopts.err.(*ApiError); ok {
15✔
1940
                return ae
×
1941
        }
×
1942

1943
        return ApiErrors[JSMessageSchedulesPatternInvalidErr]
15✔
1944
}
1945

1946
// NewJSMessageSchedulesRollupInvalidError creates a new JSMessageSchedulesRollupInvalidErr error: "message schedules invalid rollup"
1947
func NewJSMessageSchedulesRollupInvalidError(opts ...ErrorOption) *ApiError {
8✔
1948
        eopts := parseOpts(opts)
8✔
1949
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1950
                return ae
×
1951
        }
×
1952

1953
        return ApiErrors[JSMessageSchedulesRollupInvalidErr]
8✔
1954
}
1955

1956
// NewJSMessageSchedulesTTLInvalidError creates a new JSMessageSchedulesTTLInvalidErr error: "message schedules invalid per-message TTL"
1957
func NewJSMessageSchedulesTTLInvalidError(opts ...ErrorOption) *ApiError {
10✔
1958
        eopts := parseOpts(opts)
10✔
1959
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1960
                return ae
×
1961
        }
×
1962

1963
        return ApiErrors[JSMessageSchedulesTTLInvalidErr]
10✔
1964
}
1965

1966
// NewJSMessageSchedulesTargetInvalidError creates a new JSMessageSchedulesTargetInvalidErr error: "message schedules target is invalid"
1967
func NewJSMessageSchedulesTargetInvalidError(opts ...ErrorOption) *ApiError {
30✔
1968
        eopts := parseOpts(opts)
30✔
1969
        if ae, ok := eopts.err.(*ApiError); ok {
30✔
1970
                return ae
×
1971
        }
×
1972

1973
        return ApiErrors[JSMessageSchedulesTargetInvalidErr]
30✔
1974
}
1975

1976
// NewJSMessageTTLDisabledError creates a new JSMessageTTLDisabledErr error: "per-message TTL is disabled"
1977
func NewJSMessageTTLDisabledError(opts ...ErrorOption) *ApiError {
16✔
1978
        eopts := parseOpts(opts)
16✔
1979
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
1980
                return ae
×
1981
        }
×
1982

1983
        return ApiErrors[JSMessageTTLDisabledErr]
16✔
1984
}
1985

1986
// NewJSMessageTTLInvalidError creates a new JSMessageTTLInvalidErr error: "invalid per-message TTL"
1987
func NewJSMessageTTLInvalidError(opts ...ErrorOption) *ApiError {
23✔
1988
        eopts := parseOpts(opts)
23✔
1989
        if ae, ok := eopts.err.(*ApiError); ok {
23✔
1990
                return ae
×
1991
        }
×
1992

1993
        return ApiErrors[JSMessageTTLInvalidErr]
23✔
1994
}
1995

1996
// NewJSMirrorConsumerSetupFailedError creates a new JSMirrorConsumerSetupFailedErrF error: "{err}"
1997
func NewJSMirrorConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
1998
        eopts := parseOpts(opts)
×
1999
        if ae, ok := eopts.err.(*ApiError); ok {
×
2000
                return ae
×
2001
        }
×
2002

2003
        e := ApiErrors[JSMirrorConsumerSetupFailedErrF]
×
2004
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2005
        return &ApiError{
×
2006
                Code:        e.Code,
×
2007
                ErrCode:     e.ErrCode,
×
2008
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2009
        }
×
2010
}
2011

2012
// NewJSMirrorInvalidStreamNameError creates a new JSMirrorInvalidStreamName error: "mirrored stream name is invalid"
2013
func NewJSMirrorInvalidStreamNameError(opts ...ErrorOption) *ApiError {
×
2014
        eopts := parseOpts(opts)
×
2015
        if ae, ok := eopts.err.(*ApiError); ok {
×
2016
                return ae
×
2017
        }
×
2018

2019
        return ApiErrors[JSMirrorInvalidStreamName]
×
2020
}
2021

2022
// NewJSMirrorInvalidSubjectFilterError creates a new JSMirrorInvalidSubjectFilter error: "mirror transform source: {err}"
2023
func NewJSMirrorInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
2✔
2024
        eopts := parseOpts(opts)
2✔
2025
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2026
                return ae
×
2027
        }
×
2028

2029
        e := ApiErrors[JSMirrorInvalidSubjectFilter]
2✔
2030
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2✔
2031
        return &ApiError{
2✔
2032
                Code:        e.Code,
2✔
2033
                ErrCode:     e.ErrCode,
2✔
2034
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2035
        }
2✔
2036
}
2037

2038
// NewJSMirrorInvalidTransformDestinationError creates a new JSMirrorInvalidTransformDestination error: "mirror transform: {err}"
2039
func NewJSMirrorInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
2✔
2040
        eopts := parseOpts(opts)
2✔
2041
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2042
                return ae
×
2043
        }
×
2044

2045
        e := ApiErrors[JSMirrorInvalidTransformDestination]
2✔
2046
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2✔
2047
        return &ApiError{
2✔
2048
                Code:        e.Code,
2✔
2049
                ErrCode:     e.ErrCode,
2✔
2050
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2051
        }
2✔
2052
}
2053

2054
// NewJSMirrorMaxMessageSizeTooBigError creates a new JSMirrorMaxMessageSizeTooBigErr error: "stream mirror must have max message size >= source"
2055
func NewJSMirrorMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
2056
        eopts := parseOpts(opts)
×
2057
        if ae, ok := eopts.err.(*ApiError); ok {
×
2058
                return ae
×
2059
        }
×
2060

2061
        return ApiErrors[JSMirrorMaxMessageSizeTooBigErr]
×
2062
}
2063

2064
// NewJSMirrorMultipleFiltersNotAllowedError creates a new JSMirrorMultipleFiltersNotAllowed error: "mirror with multiple subject transforms cannot also have a single subject filter"
2065
func NewJSMirrorMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
2066
        eopts := parseOpts(opts)
1✔
2067
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2068
                return ae
×
2069
        }
×
2070

2071
        return ApiErrors[JSMirrorMultipleFiltersNotAllowed]
1✔
2072
}
2073

2074
// NewJSMirrorOverlappingSubjectFiltersError creates a new JSMirrorOverlappingSubjectFilters error: "mirror subject filters can not overlap"
2075
func NewJSMirrorOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
2✔
2076
        eopts := parseOpts(opts)
2✔
2077
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2078
                return ae
×
2079
        }
×
2080

2081
        return ApiErrors[JSMirrorOverlappingSubjectFilters]
2✔
2082
}
2083

2084
// NewJSMirrorWithAtomicPublishError creates a new JSMirrorWithAtomicPublishErr error: "stream mirrors can not also use atomic publishing"
2085
func NewJSMirrorWithAtomicPublishError(opts ...ErrorOption) *ApiError {
4✔
2086
        eopts := parseOpts(opts)
4✔
2087
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2088
                return ae
×
2089
        }
×
2090

2091
        return ApiErrors[JSMirrorWithAtomicPublishErr]
4✔
2092
}
2093

2094
// NewJSMirrorWithCountersError creates a new JSMirrorWithCountersErr error: "stream mirrors can not also calculate counters"
2095
func NewJSMirrorWithCountersError(opts ...ErrorOption) *ApiError {
4✔
2096
        eopts := parseOpts(opts)
4✔
2097
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2098
                return ae
×
2099
        }
×
2100

2101
        return ApiErrors[JSMirrorWithCountersErr]
4✔
2102
}
2103

2104
// NewJSMirrorWithFirstSeqError creates a new JSMirrorWithFirstSeqErr error: "stream mirrors can not have first sequence configured"
2105
func NewJSMirrorWithFirstSeqError(opts ...ErrorOption) *ApiError {
2✔
2106
        eopts := parseOpts(opts)
2✔
2107
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2108
                return ae
×
2109
        }
×
2110

2111
        return ApiErrors[JSMirrorWithFirstSeqErr]
2✔
2112
}
2113

2114
// NewJSMirrorWithMsgSchedulesError creates a new JSMirrorWithMsgSchedulesErr error: "stream mirrors can not also schedule messages"
2115
func NewJSMirrorWithMsgSchedulesError(opts ...ErrorOption) *ApiError {
2✔
2116
        eopts := parseOpts(opts)
2✔
2117
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2118
                return ae
×
2119
        }
×
2120

2121
        return ApiErrors[JSMirrorWithMsgSchedulesErr]
2✔
2122
}
2123

2124
// NewJSMirrorWithSourcesError creates a new JSMirrorWithSourcesErr error: "stream mirrors can not also contain other sources"
2125
func NewJSMirrorWithSourcesError(opts ...ErrorOption) *ApiError {
×
2126
        eopts := parseOpts(opts)
×
2127
        if ae, ok := eopts.err.(*ApiError); ok {
×
2128
                return ae
×
2129
        }
×
2130

2131
        return ApiErrors[JSMirrorWithSourcesErr]
×
2132
}
2133

2134
// NewJSMirrorWithStartSeqAndTimeError creates a new JSMirrorWithStartSeqAndTimeErr error: "stream mirrors can not have both start seq and start time configured"
2135
func NewJSMirrorWithStartSeqAndTimeError(opts ...ErrorOption) *ApiError {
×
2136
        eopts := parseOpts(opts)
×
2137
        if ae, ok := eopts.err.(*ApiError); ok {
×
2138
                return ae
×
2139
        }
×
2140

2141
        return ApiErrors[JSMirrorWithStartSeqAndTimeErr]
×
2142
}
2143

2144
// NewJSMirrorWithSubjectFiltersError creates a new JSMirrorWithSubjectFiltersErr error: "stream mirrors can not contain filtered subjects"
2145
func NewJSMirrorWithSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
2146
        eopts := parseOpts(opts)
×
2147
        if ae, ok := eopts.err.(*ApiError); ok {
×
2148
                return ae
×
2149
        }
×
2150

2151
        return ApiErrors[JSMirrorWithSubjectFiltersErr]
×
2152
}
2153

2154
// NewJSMirrorWithSubjectsError creates a new JSMirrorWithSubjectsErr error: "stream mirrors can not contain subjects"
2155
func NewJSMirrorWithSubjectsError(opts ...ErrorOption) *ApiError {
2✔
2156
        eopts := parseOpts(opts)
2✔
2157
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2158
                return ae
×
2159
        }
×
2160

2161
        return ApiErrors[JSMirrorWithSubjectsErr]
2✔
2162
}
2163

2164
// NewJSNoAccountError creates a new JSNoAccountErr error: "account not found"
2165
func NewJSNoAccountError(opts ...ErrorOption) *ApiError {
1✔
2166
        eopts := parseOpts(opts)
1✔
2167
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2168
                return ae
×
2169
        }
×
2170

2171
        return ApiErrors[JSNoAccountErr]
1✔
2172
}
2173

2174
// NewJSNoLimitsError creates a new JSNoLimitsErr error: "no JetStream default or applicable tiered limit present"
2175
func NewJSNoLimitsError(opts ...ErrorOption) *ApiError {
4✔
2176
        eopts := parseOpts(opts)
4✔
2177
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2178
                return ae
×
2179
        }
×
2180

2181
        return ApiErrors[JSNoLimitsErr]
4✔
2182
}
2183

2184
// NewJSNoMessageFoundError creates a new JSNoMessageFoundErr error: "no message found"
2185
func NewJSNoMessageFoundError(opts ...ErrorOption) *ApiError {
496✔
2186
        eopts := parseOpts(opts)
496✔
2187
        if ae, ok := eopts.err.(*ApiError); ok {
496✔
2188
                return ae
×
2189
        }
×
2190

2191
        return ApiErrors[JSNoMessageFoundErr]
496✔
2192
}
2193

2194
// NewJSNotEmptyRequestError creates a new JSNotEmptyRequestErr error: "expected an empty request payload"
2195
func NewJSNotEmptyRequestError(opts ...ErrorOption) *ApiError {
3✔
2196
        eopts := parseOpts(opts)
3✔
2197
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2198
                return ae
×
2199
        }
×
2200

2201
        return ApiErrors[JSNotEmptyRequestErr]
3✔
2202
}
2203

2204
// NewJSNotEnabledError creates a new JSNotEnabledErr error: "JetStream not enabled"
2205
func NewJSNotEnabledError(opts ...ErrorOption) *ApiError {
10✔
2206
        eopts := parseOpts(opts)
10✔
2207
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2208
                return ae
×
2209
        }
×
2210

2211
        return ApiErrors[JSNotEnabledErr]
10✔
2212
}
2213

2214
// NewJSNotEnabledForAccountError creates a new JSNotEnabledForAccountErr error: "JetStream not enabled for account"
2215
func NewJSNotEnabledForAccountError(opts ...ErrorOption) *ApiError {
318✔
2216
        eopts := parseOpts(opts)
318✔
2217
        if ae, ok := eopts.err.(*ApiError); ok {
318✔
2218
                return ae
×
2219
        }
×
2220

2221
        return ApiErrors[JSNotEnabledForAccountErr]
318✔
2222
}
2223

2224
// NewJSPedanticError creates a new JSPedanticErrF error: "pedantic mode: {err}"
2225
func NewJSPedanticError(err error, opts ...ErrorOption) *ApiError {
36✔
2226
        eopts := parseOpts(opts)
36✔
2227
        if ae, ok := eopts.err.(*ApiError); ok {
36✔
2228
                return ae
×
2229
        }
×
2230

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

2240
// NewJSPeerRemapError creates a new JSPeerRemapErr error: "peer remap failed"
2241
func NewJSPeerRemapError(opts ...ErrorOption) *ApiError {
5✔
2242
        eopts := parseOpts(opts)
5✔
2243
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2244
                return ae
1✔
2245
        }
1✔
2246

2247
        return ApiErrors[JSPeerRemapErr]
4✔
2248
}
2249

2250
// NewJSRaftGeneralError creates a new JSRaftGeneralErrF error: "{err}"
2251
func NewJSRaftGeneralError(err error, opts ...ErrorOption) *ApiError {
×
2252
        eopts := parseOpts(opts)
×
2253
        if ae, ok := eopts.err.(*ApiError); ok {
×
2254
                return ae
×
2255
        }
×
2256

2257
        e := ApiErrors[JSRaftGeneralErrF]
×
2258
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2259
        return &ApiError{
×
2260
                Code:        e.Code,
×
2261
                ErrCode:     e.ErrCode,
×
2262
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2263
        }
×
2264
}
2265

2266
// NewJSReplicasCountCannotBeNegativeError creates a new JSReplicasCountCannotBeNegative error: "replicas count cannot be negative"
2267
func NewJSReplicasCountCannotBeNegativeError(opts ...ErrorOption) *ApiError {
16✔
2268
        eopts := parseOpts(opts)
16✔
2269
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2270
                return ae
×
2271
        }
×
2272

2273
        return ApiErrors[JSReplicasCountCannotBeNegative]
16✔
2274
}
2275

2276
// NewJSRequiredApiLevelError creates a new JSRequiredApiLevelErr error: "JetStream minimum api level required"
2277
func NewJSRequiredApiLevelError(opts ...ErrorOption) *ApiError {
58✔
2278
        eopts := parseOpts(opts)
58✔
2279
        if ae, ok := eopts.err.(*ApiError); ok {
58✔
2280
                return ae
×
2281
        }
×
2282

2283
        return ApiErrors[JSRequiredApiLevelErr]
58✔
2284
}
2285

2286
// NewJSRestoreSubscribeFailedError creates a new JSRestoreSubscribeFailedErrF error: "JetStream unable to subscribe to restore snapshot {subject}: {err}"
2287
func NewJSRestoreSubscribeFailedError(err error, subject interface{}, opts ...ErrorOption) *ApiError {
1✔
2288
        eopts := parseOpts(opts)
1✔
2289
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2290
                return ae
×
2291
        }
×
2292

2293
        e := ApiErrors[JSRestoreSubscribeFailedErrF]
1✔
2294
        args := e.toReplacerArgs([]interface{}{"{err}", err, "{subject}", subject})
1✔
2295
        return &ApiError{
1✔
2296
                Code:        e.Code,
1✔
2297
                ErrCode:     e.ErrCode,
1✔
2298
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2299
        }
1✔
2300
}
2301

2302
// NewJSSequenceNotFoundError creates a new JSSequenceNotFoundErrF error: "sequence {seq} not found"
2303
func NewJSSequenceNotFoundError(seq uint64, opts ...ErrorOption) *ApiError {
971✔
2304
        eopts := parseOpts(opts)
971✔
2305
        if ae, ok := eopts.err.(*ApiError); ok {
971✔
2306
                return ae
×
2307
        }
×
2308

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

2318
// NewJSSnapshotDeliverSubjectInvalidError creates a new JSSnapshotDeliverSubjectInvalidErr error: "deliver subject not valid"
2319
func NewJSSnapshotDeliverSubjectInvalidError(opts ...ErrorOption) *ApiError {
1✔
2320
        eopts := parseOpts(opts)
1✔
2321
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2322
                return ae
×
2323
        }
×
2324

2325
        return ApiErrors[JSSnapshotDeliverSubjectInvalidErr]
1✔
2326
}
2327

2328
// NewJSSourceConsumerSetupFailedError creates a new JSSourceConsumerSetupFailedErrF error: "{err}"
2329
func NewJSSourceConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
2330
        eopts := parseOpts(opts)
×
2331
        if ae, ok := eopts.err.(*ApiError); ok {
×
2332
                return ae
×
2333
        }
×
2334

2335
        e := ApiErrors[JSSourceConsumerSetupFailedErrF]
×
2336
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2337
        return &ApiError{
×
2338
                Code:        e.Code,
×
2339
                ErrCode:     e.ErrCode,
×
2340
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2341
        }
×
2342
}
2343

2344
// NewJSSourceDuplicateDetectedError creates a new JSSourceDuplicateDetected error: "duplicate source configuration detected"
2345
func NewJSSourceDuplicateDetectedError(opts ...ErrorOption) *ApiError {
×
2346
        eopts := parseOpts(opts)
×
2347
        if ae, ok := eopts.err.(*ApiError); ok {
×
2348
                return ae
×
2349
        }
×
2350

2351
        return ApiErrors[JSSourceDuplicateDetected]
×
2352
}
2353

2354
// NewJSSourceInvalidStreamNameError creates a new JSSourceInvalidStreamName error: "sourced stream name is invalid"
2355
func NewJSSourceInvalidStreamNameError(opts ...ErrorOption) *ApiError {
1✔
2356
        eopts := parseOpts(opts)
1✔
2357
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2358
                return ae
×
2359
        }
×
2360

2361
        return ApiErrors[JSSourceInvalidStreamName]
1✔
2362
}
2363

2364
// NewJSSourceInvalidSubjectFilterError creates a new JSSourceInvalidSubjectFilter error: "source transform source: {err}"
2365
func NewJSSourceInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
1✔
2366
        eopts := parseOpts(opts)
1✔
2367
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2368
                return ae
×
2369
        }
×
2370

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

2380
// NewJSSourceInvalidTransformDestinationError creates a new JSSourceInvalidTransformDestination error: "source transform: {err}"
2381
func NewJSSourceInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
2382
        eopts := parseOpts(opts)
1✔
2383
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2384
                return ae
×
2385
        }
×
2386

2387
        e := ApiErrors[JSSourceInvalidTransformDestination]
1✔
2388
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2389
        return &ApiError{
1✔
2390
                Code:        e.Code,
1✔
2391
                ErrCode:     e.ErrCode,
1✔
2392
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2393
        }
1✔
2394
}
2395

2396
// NewJSSourceMaxMessageSizeTooBigError creates a new JSSourceMaxMessageSizeTooBigErr error: "stream source must have max message size >= target"
2397
func NewJSSourceMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
2398
        eopts := parseOpts(opts)
×
2399
        if ae, ok := eopts.err.(*ApiError); ok {
×
2400
                return ae
×
2401
        }
×
2402

2403
        return ApiErrors[JSSourceMaxMessageSizeTooBigErr]
×
2404
}
2405

2406
// NewJSSourceMultipleFiltersNotAllowedError creates a new JSSourceMultipleFiltersNotAllowed error: "source with multiple subject transforms cannot also have a single subject filter"
2407
func NewJSSourceMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
×
2408
        eopts := parseOpts(opts)
×
2409
        if ae, ok := eopts.err.(*ApiError); ok {
×
2410
                return ae
×
2411
        }
×
2412

2413
        return ApiErrors[JSSourceMultipleFiltersNotAllowed]
×
2414
}
2415

2416
// NewJSSourceOverlappingSubjectFiltersError creates a new JSSourceOverlappingSubjectFilters error: "source filters can not overlap"
2417
func NewJSSourceOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
2418
        eopts := parseOpts(opts)
×
2419
        if ae, ok := eopts.err.(*ApiError); ok {
×
2420
                return ae
×
2421
        }
×
2422

2423
        return ApiErrors[JSSourceOverlappingSubjectFilters]
×
2424
}
2425

2426
// NewJSSourceWithMsgSchedulesError creates a new JSSourceWithMsgSchedulesErr error: "stream source can not also schedule messages"
2427
func NewJSSourceWithMsgSchedulesError(opts ...ErrorOption) *ApiError {
2✔
2428
        eopts := parseOpts(opts)
2✔
2429
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2430
                return ae
×
2431
        }
×
2432

2433
        return ApiErrors[JSSourceWithMsgSchedulesErr]
2✔
2434
}
2435

2436
// NewJSStorageResourcesExceededError creates a new JSStorageResourcesExceededErr error: "insufficient storage resources available"
2437
func NewJSStorageResourcesExceededError(opts ...ErrorOption) *ApiError {
25✔
2438
        eopts := parseOpts(opts)
25✔
2439
        if ae, ok := eopts.err.(*ApiError); ok {
25✔
2440
                return ae
×
2441
        }
×
2442

2443
        return ApiErrors[JSStorageResourcesExceededErr]
25✔
2444
}
2445

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

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

2462
// NewJSStreamCreateError creates a new JSStreamCreateErrF error: "{err}"
2463
func NewJSStreamCreateError(err error, opts ...ErrorOption) *ApiError {
81✔
2464
        eopts := parseOpts(opts)
81✔
2465
        if ae, ok := eopts.err.(*ApiError); ok {
162✔
2466
                return ae
81✔
2467
        }
81✔
2468

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

2478
// NewJSStreamDeleteError creates a new JSStreamDeleteErrF error: "{err}"
2479
func NewJSStreamDeleteError(err error, opts ...ErrorOption) *ApiError {
×
2480
        eopts := parseOpts(opts)
×
2481
        if ae, ok := eopts.err.(*ApiError); ok {
×
2482
                return ae
×
2483
        }
×
2484

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

2494
// NewJSStreamDuplicateMessageConflictError creates a new JSStreamDuplicateMessageConflict error: "duplicate message id is in process"
2495
func NewJSStreamDuplicateMessageConflictError(opts ...ErrorOption) *ApiError {
128✔
2496
        eopts := parseOpts(opts)
128✔
2497
        if ae, ok := eopts.err.(*ApiError); ok {
128✔
2498
                return ae
×
2499
        }
×
2500

2501
        return ApiErrors[JSStreamDuplicateMessageConflict]
128✔
2502
}
2503

2504
// NewJSStreamExpectedLastSeqPerSubjectInvalidError creates a new JSStreamExpectedLastSeqPerSubjectInvalid error: "missing sequence for expected last sequence per subject"
2505
func NewJSStreamExpectedLastSeqPerSubjectInvalidError(opts ...ErrorOption) *ApiError {
8✔
2506
        eopts := parseOpts(opts)
8✔
2507
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
2508
                return ae
×
2509
        }
×
2510

2511
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectInvalid]
8✔
2512
}
2513

2514
// NewJSStreamExpectedLastSeqPerSubjectNotReadyError creates a new JSStreamExpectedLastSeqPerSubjectNotReady error: "expected last sequence per subject temporarily unavailable"
2515
func NewJSStreamExpectedLastSeqPerSubjectNotReadyError(opts ...ErrorOption) *ApiError {
×
2516
        eopts := parseOpts(opts)
×
2517
        if ae, ok := eopts.err.(*ApiError); ok {
×
2518
                return ae
×
2519
        }
×
2520

2521
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectNotReady]
×
2522
}
2523

2524
// NewJSStreamExternalApiOverlapError creates a new JSStreamExternalApiOverlapErrF error: "stream external api prefix {prefix} must not overlap with {subject}"
2525
func NewJSStreamExternalApiOverlapError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
2✔
2526
        eopts := parseOpts(opts)
2✔
2527
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2528
                return ae
×
2529
        }
×
2530

2531
        e := ApiErrors[JSStreamExternalApiOverlapErrF]
2✔
2532
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
2✔
2533
        return &ApiError{
2✔
2534
                Code:        e.Code,
2✔
2535
                ErrCode:     e.ErrCode,
2✔
2536
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2537
        }
2✔
2538
}
2539

2540
// NewJSStreamExternalDelPrefixOverlapsError creates a new JSStreamExternalDelPrefixOverlapsErrF error: "stream external delivery prefix {prefix} overlaps with stream subject {subject}"
2541
func NewJSStreamExternalDelPrefixOverlapsError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
×
2542
        eopts := parseOpts(opts)
×
2543
        if ae, ok := eopts.err.(*ApiError); ok {
×
2544
                return ae
×
2545
        }
×
2546

2547
        e := ApiErrors[JSStreamExternalDelPrefixOverlapsErrF]
×
2548
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
×
2549
        return &ApiError{
×
2550
                Code:        e.Code,
×
2551
                ErrCode:     e.ErrCode,
×
2552
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2553
        }
×
2554
}
2555

2556
// NewJSStreamGeneralError creates a new JSStreamGeneralErrorF error: "{err}"
2557
func NewJSStreamGeneralError(err error, opts ...ErrorOption) *ApiError {
3✔
2558
        eopts := parseOpts(opts)
3✔
2559
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2560
                return ae
×
2561
        }
×
2562

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

2572
// NewJSStreamHeaderExceedsMaximumError creates a new JSStreamHeaderExceedsMaximumErr error: "header size exceeds maximum allowed of 64k"
2573
func NewJSStreamHeaderExceedsMaximumError(opts ...ErrorOption) *ApiError {
1✔
2574
        eopts := parseOpts(opts)
1✔
2575
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2576
                return ae
×
2577
        }
×
2578

2579
        return ApiErrors[JSStreamHeaderExceedsMaximumErr]
1✔
2580
}
2581

2582
// NewJSStreamInfoMaxSubjectsError creates a new JSStreamInfoMaxSubjectsErr error: "subject details would exceed maximum allowed"
2583
func NewJSStreamInfoMaxSubjectsError(opts ...ErrorOption) *ApiError {
×
2584
        eopts := parseOpts(opts)
×
2585
        if ae, ok := eopts.err.(*ApiError); ok {
×
2586
                return ae
×
2587
        }
×
2588

2589
        return ApiErrors[JSStreamInfoMaxSubjectsErr]
×
2590
}
2591

2592
// NewJSStreamInvalidConfigError creates a new JSStreamInvalidConfigF error: "{err}"
2593
func NewJSStreamInvalidConfigError(err error, opts ...ErrorOption) *ApiError {
165✔
2594
        eopts := parseOpts(opts)
165✔
2595
        if ae, ok := eopts.err.(*ApiError); ok {
188✔
2596
                return ae
23✔
2597
        }
23✔
2598

2599
        e := ApiErrors[JSStreamInvalidConfigF]
142✔
2600
        args := e.toReplacerArgs([]interface{}{"{err}", err})
142✔
2601
        return &ApiError{
142✔
2602
                Code:        e.Code,
142✔
2603
                ErrCode:     e.ErrCode,
142✔
2604
                Description: strings.NewReplacer(args...).Replace(e.Description),
142✔
2605
        }
142✔
2606
}
2607

2608
// NewJSStreamInvalidError creates a new JSStreamInvalidErr error: "stream not valid"
2609
func NewJSStreamInvalidError(opts ...ErrorOption) *ApiError {
×
2610
        eopts := parseOpts(opts)
×
2611
        if ae, ok := eopts.err.(*ApiError); ok {
×
2612
                return ae
×
2613
        }
×
2614

2615
        return ApiErrors[JSStreamInvalidErr]
×
2616
}
2617

2618
// NewJSStreamInvalidExternalDeliverySubjError creates a new JSStreamInvalidExternalDeliverySubjErrF error: "stream external delivery prefix {prefix} must not contain wildcards"
2619
func NewJSStreamInvalidExternalDeliverySubjError(prefix interface{}, opts ...ErrorOption) *ApiError {
×
2620
        eopts := parseOpts(opts)
×
2621
        if ae, ok := eopts.err.(*ApiError); ok {
×
2622
                return ae
×
2623
        }
×
2624

2625
        e := ApiErrors[JSStreamInvalidExternalDeliverySubjErrF]
×
2626
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix})
×
2627
        return &ApiError{
×
2628
                Code:        e.Code,
×
2629
                ErrCode:     e.ErrCode,
×
2630
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2631
        }
×
2632
}
2633

2634
// NewJSStreamLimitsError creates a new JSStreamLimitsErrF error: "{err}"
2635
func NewJSStreamLimitsError(err error, opts ...ErrorOption) *ApiError {
8✔
2636
        eopts := parseOpts(opts)
8✔
2637
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2638
                return ae
8✔
2639
        }
8✔
2640

2641
        e := ApiErrors[JSStreamLimitsErrF]
×
2642
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2643
        return &ApiError{
×
2644
                Code:        e.Code,
×
2645
                ErrCode:     e.ErrCode,
×
2646
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2647
        }
×
2648
}
2649

2650
// NewJSStreamMaxBytesRequiredError creates a new JSStreamMaxBytesRequired error: "account requires a stream config to have max bytes set"
2651
func NewJSStreamMaxBytesRequiredError(opts ...ErrorOption) *ApiError {
3✔
2652
        eopts := parseOpts(opts)
3✔
2653
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2654
                return ae
×
2655
        }
×
2656

2657
        return ApiErrors[JSStreamMaxBytesRequired]
3✔
2658
}
2659

2660
// NewJSStreamMaxStreamBytesExceededError creates a new JSStreamMaxStreamBytesExceeded error: "stream max bytes exceeds account limit max stream bytes"
2661
func NewJSStreamMaxStreamBytesExceededError(opts ...ErrorOption) *ApiError {
2✔
2662
        eopts := parseOpts(opts)
2✔
2663
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2664
                return ae
×
2665
        }
×
2666

2667
        return ApiErrors[JSStreamMaxStreamBytesExceeded]
2✔
2668
}
2669

2670
// NewJSStreamMessageExceedsMaximumError creates a new JSStreamMessageExceedsMaximumErr error: "message size exceeds maximum allowed"
2671
func NewJSStreamMessageExceedsMaximumError(opts ...ErrorOption) *ApiError {
19✔
2672
        eopts := parseOpts(opts)
19✔
2673
        if ae, ok := eopts.err.(*ApiError); ok {
19✔
2674
                return ae
×
2675
        }
×
2676

2677
        return ApiErrors[JSStreamMessageExceedsMaximumErr]
19✔
2678
}
2679

2680
// NewJSStreamMinLastSeqError creates a new JSStreamMinLastSeqErr error: "min last sequence"
2681
func NewJSStreamMinLastSeqError(opts ...ErrorOption) *ApiError {
×
2682
        eopts := parseOpts(opts)
×
2683
        if ae, ok := eopts.err.(*ApiError); ok {
×
2684
                return ae
×
2685
        }
×
2686

2687
        return ApiErrors[JSStreamMinLastSeqErr]
×
2688
}
2689

2690
// NewJSStreamMirrorNotUpdatableError creates a new JSStreamMirrorNotUpdatableErr error: "stream mirror configuration can not be updated"
2691
func NewJSStreamMirrorNotUpdatableError(opts ...ErrorOption) *ApiError {
2✔
2692
        eopts := parseOpts(opts)
2✔
2693
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2694
                return ae
×
2695
        }
×
2696

2697
        return ApiErrors[JSStreamMirrorNotUpdatableErr]
2✔
2698
}
2699

2700
// NewJSStreamMismatchError creates a new JSStreamMismatchErr error: "stream name in subject does not match request"
2701
func NewJSStreamMismatchError(opts ...ErrorOption) *ApiError {
3✔
2702
        eopts := parseOpts(opts)
3✔
2703
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2704
                return ae
×
2705
        }
×
2706

2707
        return ApiErrors[JSStreamMismatchErr]
3✔
2708
}
2709

2710
// NewJSStreamMoveAndScaleError creates a new JSStreamMoveAndScaleErr error: "can not move and scale a stream in a single update"
2711
func NewJSStreamMoveAndScaleError(opts ...ErrorOption) *ApiError {
4✔
2712
        eopts := parseOpts(opts)
4✔
2713
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2714
                return ae
×
2715
        }
×
2716

2717
        return ApiErrors[JSStreamMoveAndScaleErr]
4✔
2718
}
2719

2720
// NewJSStreamMoveInProgressError creates a new JSStreamMoveInProgressF error: "stream move already in progress: {msg}"
2721
func NewJSStreamMoveInProgressError(msg interface{}, opts ...ErrorOption) *ApiError {
2✔
2722
        eopts := parseOpts(opts)
2✔
2723
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2724
                return ae
×
2725
        }
×
2726

2727
        e := ApiErrors[JSStreamMoveInProgressF]
2✔
2728
        args := e.toReplacerArgs([]interface{}{"{msg}", msg})
2✔
2729
        return &ApiError{
2✔
2730
                Code:        e.Code,
2✔
2731
                ErrCode:     e.ErrCode,
2✔
2732
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2733
        }
2✔
2734
}
2735

2736
// NewJSStreamMoveNotInProgressError creates a new JSStreamMoveNotInProgress error: "stream move not in progress"
2737
func NewJSStreamMoveNotInProgressError(opts ...ErrorOption) *ApiError {
×
2738
        eopts := parseOpts(opts)
×
2739
        if ae, ok := eopts.err.(*ApiError); ok {
×
2740
                return ae
×
2741
        }
×
2742

2743
        return ApiErrors[JSStreamMoveNotInProgress]
×
2744
}
2745

2746
// NewJSStreamMsgDeleteFailedError creates a new JSStreamMsgDeleteFailedF error: "{err}"
2747
func NewJSStreamMsgDeleteFailedError(err error, opts ...ErrorOption) *ApiError {
1,971✔
2748
        eopts := parseOpts(opts)
1,971✔
2749
        if ae, ok := eopts.err.(*ApiError); ok {
1,971✔
2750
                return ae
×
2751
        }
×
2752

2753
        e := ApiErrors[JSStreamMsgDeleteFailedF]
1,971✔
2754
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1,971✔
2755
        return &ApiError{
1,971✔
2756
                Code:        e.Code,
1,971✔
2757
                ErrCode:     e.ErrCode,
1,971✔
2758
                Description: strings.NewReplacer(args...).Replace(e.Description),
1,971✔
2759
        }
1,971✔
2760
}
2761

2762
// NewJSStreamNameContainsPathSeparatorsError creates a new JSStreamNameContainsPathSeparatorsErr error: "Stream name can not contain path separators"
2763
func NewJSStreamNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
6✔
2764
        eopts := parseOpts(opts)
6✔
2765
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2766
                return ae
×
2767
        }
×
2768

2769
        return ApiErrors[JSStreamNameContainsPathSeparatorsErr]
6✔
2770
}
2771

2772
// NewJSStreamNameExistError creates a new JSStreamNameExistErr error: "stream name already in use with a different configuration"
2773
func NewJSStreamNameExistError(opts ...ErrorOption) *ApiError {
10✔
2774
        eopts := parseOpts(opts)
10✔
2775
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2776
                return ae
×
2777
        }
×
2778

2779
        return ApiErrors[JSStreamNameExistErr]
10✔
2780
}
2781

2782
// NewJSStreamNameExistRestoreFailedError creates a new JSStreamNameExistRestoreFailedErr error: "stream name already in use, cannot restore"
2783
func NewJSStreamNameExistRestoreFailedError(opts ...ErrorOption) *ApiError {
3✔
2784
        eopts := parseOpts(opts)
3✔
2785
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2786
                return ae
×
2787
        }
×
2788

2789
        return ApiErrors[JSStreamNameExistRestoreFailedErr]
3✔
2790
}
2791

2792
// NewJSStreamNotFoundError creates a new JSStreamNotFoundErr error: "stream not found"
2793
func NewJSStreamNotFoundError(opts ...ErrorOption) *ApiError {
25,536✔
2794
        eopts := parseOpts(opts)
25,536✔
2795
        if ae, ok := eopts.err.(*ApiError); ok {
26,204✔
2796
                return ae
668✔
2797
        }
668✔
2798

2799
        return ApiErrors[JSStreamNotFoundErr]
24,868✔
2800
}
2801

2802
// NewJSStreamNotMatchError creates a new JSStreamNotMatchErr error: "expected stream does not match"
2803
func NewJSStreamNotMatchError(opts ...ErrorOption) *ApiError {
5✔
2804
        eopts := parseOpts(opts)
5✔
2805
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2806
                return ae
×
2807
        }
×
2808

2809
        return ApiErrors[JSStreamNotMatchErr]
5✔
2810
}
2811

2812
// NewJSStreamOfflineError creates a new JSStreamOfflineErr error: "stream is offline"
2813
func NewJSStreamOfflineError(opts ...ErrorOption) *ApiError {
6✔
2814
        eopts := parseOpts(opts)
6✔
2815
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2816
                return ae
×
2817
        }
×
2818

2819
        return ApiErrors[JSStreamOfflineErr]
6✔
2820
}
2821

2822
// NewJSStreamOfflineReasonError creates a new JSStreamOfflineReasonErrF error: "stream is offline: {err}"
2823
func NewJSStreamOfflineReasonError(err error, opts ...ErrorOption) *ApiError {
40✔
2824
        eopts := parseOpts(opts)
40✔
2825
        if ae, ok := eopts.err.(*ApiError); ok {
40✔
2826
                return ae
×
2827
        }
×
2828

2829
        e := ApiErrors[JSStreamOfflineReasonErrF]
40✔
2830
        args := e.toReplacerArgs([]interface{}{"{err}", err})
40✔
2831
        return &ApiError{
40✔
2832
                Code:        e.Code,
40✔
2833
                ErrCode:     e.ErrCode,
40✔
2834
                Description: strings.NewReplacer(args...).Replace(e.Description),
40✔
2835
        }
40✔
2836
}
2837

2838
// NewJSStreamPurgeFailedError creates a new JSStreamPurgeFailedF error: "{err}"
2839
func NewJSStreamPurgeFailedError(err error, opts ...ErrorOption) *ApiError {
1✔
2840
        eopts := parseOpts(opts)
1✔
2841
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2842
                return ae
×
2843
        }
×
2844

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

2854
// NewJSStreamReplicasNotSupportedError creates a new JSStreamReplicasNotSupportedErr error: "replicas > 1 not supported in non-clustered mode"
2855
func NewJSStreamReplicasNotSupportedError(opts ...ErrorOption) *ApiError {
1✔
2856
        eopts := parseOpts(opts)
1✔
2857
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2858
                return ae
×
2859
        }
×
2860

2861
        return ApiErrors[JSStreamReplicasNotSupportedErr]
1✔
2862
}
2863

2864
// NewJSStreamReplicasNotUpdatableError creates a new JSStreamReplicasNotUpdatableErr error: "Replicas configuration can not be updated"
2865
func NewJSStreamReplicasNotUpdatableError(opts ...ErrorOption) *ApiError {
×
2866
        eopts := parseOpts(opts)
×
2867
        if ae, ok := eopts.err.(*ApiError); ok {
×
2868
                return ae
×
2869
        }
×
2870

2871
        return ApiErrors[JSStreamReplicasNotUpdatableErr]
×
2872
}
2873

2874
// NewJSStreamRestoreError creates a new JSStreamRestoreErrF error: "restore failed: {err}"
2875
func NewJSStreamRestoreError(err error, opts ...ErrorOption) *ApiError {
7✔
2876
        eopts := parseOpts(opts)
7✔
2877
        if ae, ok := eopts.err.(*ApiError); ok {
9✔
2878
                return ae
2✔
2879
        }
2✔
2880

2881
        e := ApiErrors[JSStreamRestoreErrF]
5✔
2882
        args := e.toReplacerArgs([]interface{}{"{err}", err})
5✔
2883
        return &ApiError{
5✔
2884
                Code:        e.Code,
5✔
2885
                ErrCode:     e.ErrCode,
5✔
2886
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
2887
        }
5✔
2888
}
2889

2890
// NewJSStreamRollupFailedError creates a new JSStreamRollupFailedF error: "{err}"
2891
func NewJSStreamRollupFailedError(err error, opts ...ErrorOption) *ApiError {
13✔
2892
        eopts := parseOpts(opts)
13✔
2893
        if ae, ok := eopts.err.(*ApiError); ok {
13✔
2894
                return ae
×
2895
        }
×
2896

2897
        e := ApiErrors[JSStreamRollupFailedF]
13✔
2898
        args := e.toReplacerArgs([]interface{}{"{err}", err})
13✔
2899
        return &ApiError{
13✔
2900
                Code:        e.Code,
13✔
2901
                ErrCode:     e.ErrCode,
13✔
2902
                Description: strings.NewReplacer(args...).Replace(e.Description),
13✔
2903
        }
13✔
2904
}
2905

2906
// NewJSStreamSealedError creates a new JSStreamSealedErr error: "invalid operation on sealed stream"
2907
func NewJSStreamSealedError(opts ...ErrorOption) *ApiError {
10✔
2908
        eopts := parseOpts(opts)
10✔
2909
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2910
                return ae
×
2911
        }
×
2912

2913
        return ApiErrors[JSStreamSealedErr]
10✔
2914
}
2915

2916
// NewJSStreamSequenceNotMatchError creates a new JSStreamSequenceNotMatchErr error: "expected stream sequence does not match"
2917
func NewJSStreamSequenceNotMatchError(opts ...ErrorOption) *ApiError {
×
2918
        eopts := parseOpts(opts)
×
2919
        if ae, ok := eopts.err.(*ApiError); ok {
×
2920
                return ae
×
2921
        }
×
2922

2923
        return ApiErrors[JSStreamSequenceNotMatchErr]
×
2924
}
2925

2926
// NewJSStreamSnapshotError creates a new JSStreamSnapshotErrF error: "snapshot failed: {err}"
2927
func NewJSStreamSnapshotError(err error, opts ...ErrorOption) *ApiError {
×
2928
        eopts := parseOpts(opts)
×
2929
        if ae, ok := eopts.err.(*ApiError); ok {
×
2930
                return ae
×
2931
        }
×
2932

2933
        e := ApiErrors[JSStreamSnapshotErrF]
×
2934
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2935
        return &ApiError{
×
2936
                Code:        e.Code,
×
2937
                ErrCode:     e.ErrCode,
×
2938
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2939
        }
×
2940
}
2941

2942
// NewJSStreamStoreFailedError creates a new JSStreamStoreFailedF error: "{err}"
2943
func NewJSStreamStoreFailedError(err error, opts ...ErrorOption) *ApiError {
2,004✔
2944
        eopts := parseOpts(opts)
2,004✔
2945
        if ae, ok := eopts.err.(*ApiError); ok {
2,004✔
2946
                return ae
×
2947
        }
×
2948

2949
        e := ApiErrors[JSStreamStoreFailedF]
2,004✔
2950
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2,004✔
2951
        return &ApiError{
2,004✔
2952
                Code:        e.Code,
2,004✔
2953
                ErrCode:     e.ErrCode,
2,004✔
2954
                Description: strings.NewReplacer(args...).Replace(e.Description),
2,004✔
2955
        }
2,004✔
2956
}
2957

2958
// NewJSStreamSubjectOverlapError creates a new JSStreamSubjectOverlapErr error: "subjects overlap with an existing stream"
2959
func NewJSStreamSubjectOverlapError(opts ...ErrorOption) *ApiError {
43✔
2960
        eopts := parseOpts(opts)
43✔
2961
        if ae, ok := eopts.err.(*ApiError); ok {
43✔
2962
                return ae
×
2963
        }
×
2964

2965
        return ApiErrors[JSStreamSubjectOverlapErr]
43✔
2966
}
2967

2968
// NewJSStreamTemplateCreateError creates a new JSStreamTemplateCreateErrF error: "{err}"
2969
func NewJSStreamTemplateCreateError(err error, opts ...ErrorOption) *ApiError {
×
2970
        eopts := parseOpts(opts)
×
2971
        if ae, ok := eopts.err.(*ApiError); ok {
×
2972
                return ae
×
2973
        }
×
2974

2975
        e := ApiErrors[JSStreamTemplateCreateErrF]
×
2976
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2977
        return &ApiError{
×
2978
                Code:        e.Code,
×
2979
                ErrCode:     e.ErrCode,
×
2980
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2981
        }
×
2982
}
2983

2984
// NewJSStreamTemplateDeleteError creates a new JSStreamTemplateDeleteErrF error: "{err}"
2985
func NewJSStreamTemplateDeleteError(err error, opts ...ErrorOption) *ApiError {
1✔
2986
        eopts := parseOpts(opts)
1✔
2987
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2988
                return ae
1✔
2989
        }
1✔
2990

2991
        e := ApiErrors[JSStreamTemplateDeleteErrF]
×
2992
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2993
        return &ApiError{
×
2994
                Code:        e.Code,
×
2995
                ErrCode:     e.ErrCode,
×
2996
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2997
        }
×
2998
}
2999

3000
// NewJSStreamTemplateNotFoundError creates a new JSStreamTemplateNotFoundErr error: "template not found"
3001
func NewJSStreamTemplateNotFoundError(opts ...ErrorOption) *ApiError {
4✔
3002
        eopts := parseOpts(opts)
4✔
3003
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
3004
                return ae
×
3005
        }
×
3006

3007
        return ApiErrors[JSStreamTemplateNotFoundErr]
4✔
3008
}
3009

3010
// NewJSStreamTooManyRequestsError creates a new JSStreamTooManyRequests error: "too many requests"
3011
func NewJSStreamTooManyRequestsError(opts ...ErrorOption) *ApiError {
184✔
3012
        eopts := parseOpts(opts)
184✔
3013
        if ae, ok := eopts.err.(*ApiError); ok {
184✔
3014
                return ae
×
3015
        }
×
3016

3017
        return ApiErrors[JSStreamTooManyRequests]
184✔
3018
}
3019

3020
// NewJSStreamTransformInvalidDestinationError creates a new JSStreamTransformInvalidDestination error: "stream transform: {err}"
3021
func NewJSStreamTransformInvalidDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
3022
        eopts := parseOpts(opts)
1✔
3023
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3024
                return ae
×
3025
        }
×
3026

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

3036
// NewJSStreamTransformInvalidSourceError creates a new JSStreamTransformInvalidSource error: "stream transform source: {err}"
3037
func NewJSStreamTransformInvalidSourceError(err error, opts ...ErrorOption) *ApiError {
1✔
3038
        eopts := parseOpts(opts)
1✔
3039
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3040
                return ae
×
3041
        }
×
3042

3043
        e := ApiErrors[JSStreamTransformInvalidSource]
1✔
3044
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
3045
        return &ApiError{
1✔
3046
                Code:        e.Code,
1✔
3047
                ErrCode:     e.ErrCode,
1✔
3048
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
3049
        }
1✔
3050
}
3051

3052
// NewJSStreamUpdateError creates a new JSStreamUpdateErrF error: "{err}"
3053
func NewJSStreamUpdateError(err error, opts ...ErrorOption) *ApiError {
29✔
3054
        eopts := parseOpts(opts)
29✔
3055
        if ae, ok := eopts.err.(*ApiError); ok {
52✔
3056
                return ae
23✔
3057
        }
23✔
3058

3059
        e := ApiErrors[JSStreamUpdateErrF]
6✔
3060
        args := e.toReplacerArgs([]interface{}{"{err}", err})
6✔
3061
        return &ApiError{
6✔
3062
                Code:        e.Code,
6✔
3063
                ErrCode:     e.ErrCode,
6✔
3064
                Description: strings.NewReplacer(args...).Replace(e.Description),
6✔
3065
        }
6✔
3066
}
3067

3068
// NewJSStreamWrongLastMsgIDError creates a new JSStreamWrongLastMsgIDErrF error: "wrong last msg ID: {id}"
3069
func NewJSStreamWrongLastMsgIDError(id interface{}, opts ...ErrorOption) *ApiError {
5✔
3070
        eopts := parseOpts(opts)
5✔
3071
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
3072
                return ae
×
3073
        }
×
3074

3075
        e := ApiErrors[JSStreamWrongLastMsgIDErrF]
5✔
3076
        args := e.toReplacerArgs([]interface{}{"{id}", id})
5✔
3077
        return &ApiError{
5✔
3078
                Code:        e.Code,
5✔
3079
                ErrCode:     e.ErrCode,
5✔
3080
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
3081
        }
5✔
3082
}
3083

3084
// NewJSStreamWrongLastSequenceConstantError creates a new JSStreamWrongLastSequenceConstantErr error: "wrong last sequence"
3085
func NewJSStreamWrongLastSequenceConstantError(opts ...ErrorOption) *ApiError {
23✔
3086
        eopts := parseOpts(opts)
23✔
3087
        if ae, ok := eopts.err.(*ApiError); ok {
23✔
3088
                return ae
×
3089
        }
×
3090

3091
        return ApiErrors[JSStreamWrongLastSequenceConstantErr]
23✔
3092
}
3093

3094
// NewJSStreamWrongLastSequenceError creates a new JSStreamWrongLastSequenceErrF error: "wrong last sequence: {seq}"
3095
func NewJSStreamWrongLastSequenceError(seq uint64, opts ...ErrorOption) *ApiError {
96✔
3096
        eopts := parseOpts(opts)
96✔
3097
        if ae, ok := eopts.err.(*ApiError); ok {
96✔
3098
                return ae
×
3099
        }
×
3100

3101
        e := ApiErrors[JSStreamWrongLastSequenceErrF]
96✔
3102
        args := e.toReplacerArgs([]interface{}{"{seq}", seq})
96✔
3103
        return &ApiError{
96✔
3104
                Code:        e.Code,
96✔
3105
                ErrCode:     e.ErrCode,
96✔
3106
                Description: strings.NewReplacer(args...).Replace(e.Description),
96✔
3107
        }
96✔
3108
}
3109

3110
// NewJSTempStorageFailedError creates a new JSTempStorageFailedErr error: "JetStream unable to open temp storage for restore"
3111
func NewJSTempStorageFailedError(opts ...ErrorOption) *ApiError {
×
3112
        eopts := parseOpts(opts)
×
3113
        if ae, ok := eopts.err.(*ApiError); ok {
×
3114
                return ae
×
3115
        }
×
3116

3117
        return ApiErrors[JSTempStorageFailedErr]
×
3118
}
3119

3120
// NewJSTemplateNameNotMatchSubjectError creates a new JSTemplateNameNotMatchSubjectErr error: "template name in subject does not match request"
3121
func NewJSTemplateNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
1✔
3122
        eopts := parseOpts(opts)
1✔
3123
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
3124
                return ae
×
3125
        }
×
3126

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