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

nats-io / nats-server / 17171349668

22 Aug 2025 11:15AM UTC coverage: 86.022% (+0.09%) from 85.93%
17171349668

push

github

web-flow
Report cluster traffic account in `jsz` (#7193)

Similar to https://github.com/nats-io/nats-server/pull/7186, but
implementing it for `/jsz`. Due to it being added in `ClusterInfo`, this
means a `nats stream info` will also include these details.

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

73140 of 85025 relevant lines covered (86.02%)

359791.72 hits per line

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

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

3
package server
4

5
import "strings"
6

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

290
        // JSMessageSchedulesDisabledErr message schedules is disabled
291
        JSMessageSchedulesDisabledErr ErrorIdentifier = 10188
292

293
        // JSMessageSchedulesPatternInvalidErr message schedules pattern is invalid
294
        JSMessageSchedulesPatternInvalidErr ErrorIdentifier = 10189
295

296
        // JSMessageSchedulesRollupInvalidErr message schedules invalid rollup
297
        JSMessageSchedulesRollupInvalidErr ErrorIdentifier = 10192
298

299
        // JSMessageSchedulesTTLInvalidErr message schedules invalid per-message TTL
300
        JSMessageSchedulesTTLInvalidErr ErrorIdentifier = 10191
301

302
        // JSMessageSchedulesTargetInvalidErr message schedules target is invalid
303
        JSMessageSchedulesTargetInvalidErr ErrorIdentifier = 10190
304

305
        // JSMessageTTLDisabledErr per-message TTL is disabled
306
        JSMessageTTLDisabledErr ErrorIdentifier = 10166
307

308
        // JSMessageTTLInvalidErr invalid per-message TTL
309
        JSMessageTTLInvalidErr ErrorIdentifier = 10165
310

311
        // JSMirrorConsumerSetupFailedErrF generic mirror consumer setup failure string ({err})
312
        JSMirrorConsumerSetupFailedErrF ErrorIdentifier = 10029
313

314
        // JSMirrorInvalidStreamName mirrored stream name is invalid
315
        JSMirrorInvalidStreamName ErrorIdentifier = 10142
316

317
        // JSMirrorInvalidSubjectFilter mirror transform source: {err}
318
        JSMirrorInvalidSubjectFilter ErrorIdentifier = 10151
319

320
        // JSMirrorInvalidTransformDestination mirror transform: {err}
321
        JSMirrorInvalidTransformDestination ErrorIdentifier = 10154
322

323
        // JSMirrorMaxMessageSizeTooBigErr stream mirror must have max message size >= source
324
        JSMirrorMaxMessageSizeTooBigErr ErrorIdentifier = 10030
325

326
        // JSMirrorMultipleFiltersNotAllowed mirror with multiple subject transforms cannot also have a single subject filter
327
        JSMirrorMultipleFiltersNotAllowed ErrorIdentifier = 10150
328

329
        // JSMirrorOverlappingSubjectFilters mirror subject filters can not overlap
330
        JSMirrorOverlappingSubjectFilters ErrorIdentifier = 10152
331

332
        // JSMirrorWithCountersErr stream mirrors can not also calculate counters
333
        JSMirrorWithCountersErr ErrorIdentifier = 10173
334

335
        // JSMirrorWithFirstSeqErr stream mirrors can not have first sequence configured
336
        JSMirrorWithFirstSeqErr ErrorIdentifier = 10143
337

338
        // JSMirrorWithMsgSchedulesErr stream mirrors can not also schedule messages
339
        JSMirrorWithMsgSchedulesErr ErrorIdentifier = 10186
340

341
        // JSMirrorWithSourcesErr stream mirrors can not also contain other sources
342
        JSMirrorWithSourcesErr ErrorIdentifier = 10031
343

344
        // JSMirrorWithStartSeqAndTimeErr stream mirrors can not have both start seq and start time configured
345
        JSMirrorWithStartSeqAndTimeErr ErrorIdentifier = 10032
346

347
        // JSMirrorWithSubjectFiltersErr stream mirrors can not contain filtered subjects
348
        JSMirrorWithSubjectFiltersErr ErrorIdentifier = 10033
349

350
        // JSMirrorWithSubjectsErr stream mirrors can not contain subjects
351
        JSMirrorWithSubjectsErr ErrorIdentifier = 10034
352

353
        // JSNoAccountErr account not found
354
        JSNoAccountErr ErrorIdentifier = 10035
355

356
        // JSNoLimitsErr no JetStream default or applicable tiered limit present
357
        JSNoLimitsErr ErrorIdentifier = 10120
358

359
        // JSNoMessageFoundErr no message found
360
        JSNoMessageFoundErr ErrorIdentifier = 10037
361

362
        // JSNotEmptyRequestErr expected an empty request payload
363
        JSNotEmptyRequestErr ErrorIdentifier = 10038
364

365
        // JSNotEnabledErr JetStream not enabled
366
        JSNotEnabledErr ErrorIdentifier = 10076
367

368
        // JSNotEnabledForAccountErr JetStream not enabled for account
369
        JSNotEnabledForAccountErr ErrorIdentifier = 10039
370

371
        // JSPedanticErrF pedantic mode: {err}
372
        JSPedanticErrF ErrorIdentifier = 10157
373

374
        // JSPeerRemapErr peer remap failed
375
        JSPeerRemapErr ErrorIdentifier = 10075
376

377
        // JSRaftGeneralErrF General RAFT error string ({err})
378
        JSRaftGeneralErrF ErrorIdentifier = 10041
379

380
        // JSReplicasCountCannotBeNegative replicas count cannot be negative
381
        JSReplicasCountCannotBeNegative ErrorIdentifier = 10133
382

383
        // JSRequiredApiLevelErr JetStream minimum api level required
384
        JSRequiredApiLevelErr ErrorIdentifier = 10185
385

386
        // JSRestoreSubscribeFailedErrF JetStream unable to subscribe to restore snapshot {subject}: {err}
387
        JSRestoreSubscribeFailedErrF ErrorIdentifier = 10042
388

389
        // JSSequenceNotFoundErrF sequence {seq} not found
390
        JSSequenceNotFoundErrF ErrorIdentifier = 10043
391

392
        // JSSnapshotDeliverSubjectInvalidErr deliver subject not valid
393
        JSSnapshotDeliverSubjectInvalidErr ErrorIdentifier = 10015
394

395
        // JSSourceConsumerSetupFailedErrF General source consumer setup failure string ({err})
396
        JSSourceConsumerSetupFailedErrF ErrorIdentifier = 10045
397

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

401
        // JSSourceInvalidStreamName sourced stream name is invalid
402
        JSSourceInvalidStreamName ErrorIdentifier = 10141
403

404
        // JSSourceInvalidSubjectFilter source transform source: {err}
405
        JSSourceInvalidSubjectFilter ErrorIdentifier = 10145
406

407
        // JSSourceInvalidTransformDestination source transform: {err}
408
        JSSourceInvalidTransformDestination ErrorIdentifier = 10146
409

410
        // JSSourceMaxMessageSizeTooBigErr stream source must have max message size >= target
411
        JSSourceMaxMessageSizeTooBigErr ErrorIdentifier = 10046
412

413
        // JSSourceMultipleFiltersNotAllowed source with multiple subject transforms cannot also have a single subject filter
414
        JSSourceMultipleFiltersNotAllowed ErrorIdentifier = 10144
415

416
        // JSSourceOverlappingSubjectFilters source filters can not overlap
417
        JSSourceOverlappingSubjectFilters ErrorIdentifier = 10147
418

419
        // JSSourceWithMsgSchedulesErr stream source can not also schedule messages
420
        JSSourceWithMsgSchedulesErr ErrorIdentifier = 10187
421

422
        // JSStorageResourcesExceededErr insufficient storage resources available
423
        JSStorageResourcesExceededErr ErrorIdentifier = 10047
424

425
        // JSStreamAssignmentErrF Generic stream assignment error string ({err})
426
        JSStreamAssignmentErrF ErrorIdentifier = 10048
427

428
        // JSStreamCreateErrF Generic stream creation error string ({err})
429
        JSStreamCreateErrF ErrorIdentifier = 10049
430

431
        // JSStreamDeleteErrF General stream deletion error string ({err})
432
        JSStreamDeleteErrF ErrorIdentifier = 10050
433

434
        // JSStreamDuplicateMessageConflict duplicate message id is in process
435
        JSStreamDuplicateMessageConflict ErrorIdentifier = 10158
436

437
        // JSStreamExpectedLastSeqPerSubjectNotReady expected last sequence per subject temporarily unavailable
438
        JSStreamExpectedLastSeqPerSubjectNotReady ErrorIdentifier = 10163
439

440
        // JSStreamExternalApiOverlapErrF stream external api prefix {prefix} must not overlap with {subject}
441
        JSStreamExternalApiOverlapErrF ErrorIdentifier = 10021
442

443
        // JSStreamExternalDelPrefixOverlapsErrF stream external delivery prefix {prefix} overlaps with stream subject {subject}
444
        JSStreamExternalDelPrefixOverlapsErrF ErrorIdentifier = 10022
445

446
        // JSStreamGeneralErrorF General stream failure string ({err})
447
        JSStreamGeneralErrorF ErrorIdentifier = 10051
448

449
        // JSStreamHeaderExceedsMaximumErr header size exceeds maximum allowed of 64k
450
        JSStreamHeaderExceedsMaximumErr ErrorIdentifier = 10097
451

452
        // JSStreamInfoMaxSubjectsErr subject details would exceed maximum allowed
453
        JSStreamInfoMaxSubjectsErr ErrorIdentifier = 10117
454

455
        // JSStreamInvalidConfigF Stream configuration validation error string ({err})
456
        JSStreamInvalidConfigF ErrorIdentifier = 10052
457

458
        // JSStreamInvalidErr stream not valid
459
        JSStreamInvalidErr ErrorIdentifier = 10096
460

461
        // JSStreamInvalidExternalDeliverySubjErrF stream external delivery prefix {prefix} must not contain wildcards
462
        JSStreamInvalidExternalDeliverySubjErrF ErrorIdentifier = 10024
463

464
        // JSStreamLimitsErrF General stream limits exceeded error string ({err})
465
        JSStreamLimitsErrF ErrorIdentifier = 10053
466

467
        // JSStreamMaxBytesRequired account requires a stream config to have max bytes set
468
        JSStreamMaxBytesRequired ErrorIdentifier = 10113
469

470
        // JSStreamMaxStreamBytesExceeded stream max bytes exceeds account limit max stream bytes
471
        JSStreamMaxStreamBytesExceeded ErrorIdentifier = 10122
472

473
        // JSStreamMessageExceedsMaximumErr message size exceeds maximum allowed
474
        JSStreamMessageExceedsMaximumErr ErrorIdentifier = 10054
475

476
        // JSStreamMinLastSeqErr min last sequence
477
        JSStreamMinLastSeqErr ErrorIdentifier = 10180
478

479
        // JSStreamMirrorNotUpdatableErr stream mirror configuration can not be updated
480
        JSStreamMirrorNotUpdatableErr ErrorIdentifier = 10055
481

482
        // JSStreamMismatchErr stream name in subject does not match request
483
        JSStreamMismatchErr ErrorIdentifier = 10056
484

485
        // JSStreamMoveAndScaleErr can not move and scale a stream in a single update
486
        JSStreamMoveAndScaleErr ErrorIdentifier = 10123
487

488
        // JSStreamMoveInProgressF stream move already in progress: {msg}
489
        JSStreamMoveInProgressF ErrorIdentifier = 10124
490

491
        // JSStreamMoveNotInProgress stream move not in progress
492
        JSStreamMoveNotInProgress ErrorIdentifier = 10129
493

494
        // JSStreamMsgDeleteFailedF Generic message deletion failure error string ({err})
495
        JSStreamMsgDeleteFailedF ErrorIdentifier = 10057
496

497
        // JSStreamNameContainsPathSeparatorsErr Stream name can not contain path separators
498
        JSStreamNameContainsPathSeparatorsErr ErrorIdentifier = 10128
499

500
        // JSStreamNameExistErr stream name already in use with a different configuration
501
        JSStreamNameExistErr ErrorIdentifier = 10058
502

503
        // JSStreamNameExistRestoreFailedErr stream name already in use, cannot restore
504
        JSStreamNameExistRestoreFailedErr ErrorIdentifier = 10130
505

506
        // JSStreamNotFoundErr stream not found
507
        JSStreamNotFoundErr ErrorIdentifier = 10059
508

509
        // JSStreamNotMatchErr expected stream does not match
510
        JSStreamNotMatchErr ErrorIdentifier = 10060
511

512
        // JSStreamOfflineErr stream is offline
513
        JSStreamOfflineErr ErrorIdentifier = 10118
514

515
        // JSStreamPurgeFailedF Generic stream purge failure error string ({err})
516
        JSStreamPurgeFailedF ErrorIdentifier = 10110
517

518
        // JSStreamReplicasNotSupportedErr replicas > 1 not supported in non-clustered mode
519
        JSStreamReplicasNotSupportedErr ErrorIdentifier = 10074
520

521
        // JSStreamReplicasNotUpdatableErr Replicas configuration can not be updated
522
        JSStreamReplicasNotUpdatableErr ErrorIdentifier = 10061
523

524
        // JSStreamRestoreErrF restore failed: {err}
525
        JSStreamRestoreErrF ErrorIdentifier = 10062
526

527
        // JSStreamRollupFailedF Generic stream rollup failure error string ({err})
528
        JSStreamRollupFailedF ErrorIdentifier = 10111
529

530
        // JSStreamSealedErr invalid operation on sealed stream
531
        JSStreamSealedErr ErrorIdentifier = 10109
532

533
        // JSStreamSequenceNotMatchErr expected stream sequence does not match
534
        JSStreamSequenceNotMatchErr ErrorIdentifier = 10063
535

536
        // JSStreamSnapshotErrF snapshot failed: {err}
537
        JSStreamSnapshotErrF ErrorIdentifier = 10064
538

539
        // JSStreamStoreFailedF Generic error when storing a message failed ({err})
540
        JSStreamStoreFailedF ErrorIdentifier = 10077
541

542
        // JSStreamSubjectOverlapErr subjects overlap with an existing stream
543
        JSStreamSubjectOverlapErr ErrorIdentifier = 10065
544

545
        // JSStreamTemplateCreateErrF Generic template creation failed string ({err})
546
        JSStreamTemplateCreateErrF ErrorIdentifier = 10066
547

548
        // JSStreamTemplateDeleteErrF Generic stream template deletion failed error string ({err})
549
        JSStreamTemplateDeleteErrF ErrorIdentifier = 10067
550

551
        // JSStreamTemplateNotFoundErr template not found
552
        JSStreamTemplateNotFoundErr ErrorIdentifier = 10068
553

554
        // JSStreamTooManyRequests too many requests
555
        JSStreamTooManyRequests ErrorIdentifier = 10167
556

557
        // JSStreamTransformInvalidDestination stream transform: {err}
558
        JSStreamTransformInvalidDestination ErrorIdentifier = 10156
559

560
        // JSStreamTransformInvalidSource stream transform source: {err}
561
        JSStreamTransformInvalidSource ErrorIdentifier = 10155
562

563
        // JSStreamUpdateErrF Generic stream update error string ({err})
564
        JSStreamUpdateErrF ErrorIdentifier = 10069
565

566
        // JSStreamWrongLastMsgIDErrF wrong last msg ID: {id}
567
        JSStreamWrongLastMsgIDErrF ErrorIdentifier = 10070
568

569
        // JSStreamWrongLastSequenceConstantErr wrong last sequence
570
        JSStreamWrongLastSequenceConstantErr ErrorIdentifier = 10164
571

572
        // JSStreamWrongLastSequenceErrF wrong last sequence: {seq}
573
        JSStreamWrongLastSequenceErrF ErrorIdentifier = 10071
574

575
        // JSTempStorageFailedErr JetStream unable to open temp storage for restore
576
        JSTempStorageFailedErr ErrorIdentifier = 10072
577

578
        // JSTemplateNameNotMatchSubjectErr template name in subject does not match request
579
        JSTemplateNameNotMatchSubjectErr ErrorIdentifier = 10073
580
)
581

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

800
// NewJSAccountResourcesExceededError creates a new JSAccountResourcesExceededErr error: "resource limits exceeded for account"
801
func NewJSAccountResourcesExceededError(opts ...ErrorOption) *ApiError {
20,059✔
802
        eopts := parseOpts(opts)
20,059✔
803
        if ae, ok := eopts.err.(*ApiError); ok {
20,059✔
804
                return ae
×
805
        }
×
806

807
        return ApiErrors[JSAccountResourcesExceededErr]
20,059✔
808
}
809

810
// NewJSAtomicPublishDisabledError creates a new JSAtomicPublishDisabledErr error: "atomic publish is disabled"
811
func NewJSAtomicPublishDisabledError(opts ...ErrorOption) *ApiError {
24✔
812
        eopts := parseOpts(opts)
24✔
813
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
814
                return ae
×
815
        }
×
816

817
        return ApiErrors[JSAtomicPublishDisabledErr]
24✔
818
}
819

820
// NewJSAtomicPublishIncompleteBatchError creates a new JSAtomicPublishIncompleteBatchErr error: "atomic publish batch is incomplete"
821
func NewJSAtomicPublishIncompleteBatchError(opts ...ErrorOption) *ApiError {
64✔
822
        eopts := parseOpts(opts)
64✔
823
        if ae, ok := eopts.err.(*ApiError); ok {
64✔
824
                return ae
×
825
        }
×
826

827
        return ApiErrors[JSAtomicPublishIncompleteBatchErr]
64✔
828
}
829

830
// NewJSAtomicPublishInvalidBatchIDError creates a new JSAtomicPublishInvalidBatchIDErr error: "atomic publish batch ID is invalid"
831
func NewJSAtomicPublishInvalidBatchIDError(opts ...ErrorOption) *ApiError {
4✔
832
        eopts := parseOpts(opts)
4✔
833
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
834
                return ae
×
835
        }
×
836

837
        return ApiErrors[JSAtomicPublishInvalidBatchIDErr]
4✔
838
}
839

840
// NewJSAtomicPublishMissingSeqError creates a new JSAtomicPublishMissingSeqErr error: "atomic publish sequence is missing"
841
func NewJSAtomicPublishMissingSeqError(opts ...ErrorOption) *ApiError {
24✔
842
        eopts := parseOpts(opts)
24✔
843
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
844
                return ae
×
845
        }
×
846

847
        return ApiErrors[JSAtomicPublishMissingSeqErr]
24✔
848
}
849

850
// NewJSAtomicPublishUnsupportedHeaderBatchError creates a new JSAtomicPublishUnsupportedHeaderBatchErr error: "atomic publish unsupported header used: {header}"
851
func NewJSAtomicPublishUnsupportedHeaderBatchError(header interface{}, opts ...ErrorOption) *ApiError {
32✔
852
        eopts := parseOpts(opts)
32✔
853
        if ae, ok := eopts.err.(*ApiError); ok {
32✔
854
                return ae
×
855
        }
×
856

857
        e := ApiErrors[JSAtomicPublishUnsupportedHeaderBatchErr]
32✔
858
        args := e.toReplacerArgs([]interface{}{"{header}", header})
32✔
859
        return &ApiError{
32✔
860
                Code:        e.Code,
32✔
861
                ErrCode:     e.ErrCode,
32✔
862
                Description: strings.NewReplacer(args...).Replace(e.Description),
32✔
863
        }
32✔
864
}
865

866
// NewJSBadRequestError creates a new JSBadRequestErr error: "bad request"
867
func NewJSBadRequestError(opts ...ErrorOption) *ApiError {
10✔
868
        eopts := parseOpts(opts)
10✔
869
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
870
                return ae
×
871
        }
×
872

873
        return ApiErrors[JSBadRequestErr]
10✔
874
}
875

876
// NewJSClusterIncompleteError creates a new JSClusterIncompleteErr error: "incomplete results"
877
func NewJSClusterIncompleteError(opts ...ErrorOption) *ApiError {
×
878
        eopts := parseOpts(opts)
×
879
        if ae, ok := eopts.err.(*ApiError); ok {
×
880
                return ae
×
881
        }
×
882

883
        return ApiErrors[JSClusterIncompleteErr]
×
884
}
885

886
// NewJSClusterNoPeersError creates a new JSClusterNoPeersErrF error: "{err}"
887
func NewJSClusterNoPeersError(err error, opts ...ErrorOption) *ApiError {
60✔
888
        eopts := parseOpts(opts)
60✔
889
        if ae, ok := eopts.err.(*ApiError); ok {
60✔
890
                return ae
×
891
        }
×
892

893
        e := ApiErrors[JSClusterNoPeersErrF]
60✔
894
        args := e.toReplacerArgs([]interface{}{"{err}", err})
60✔
895
        return &ApiError{
60✔
896
                Code:        e.Code,
60✔
897
                ErrCode:     e.ErrCode,
60✔
898
                Description: strings.NewReplacer(args...).Replace(e.Description),
60✔
899
        }
60✔
900
}
901

902
// NewJSClusterNotActiveError creates a new JSClusterNotActiveErr error: "JetStream not in clustered mode"
903
func NewJSClusterNotActiveError(opts ...ErrorOption) *ApiError {
1✔
904
        eopts := parseOpts(opts)
1✔
905
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
906
                return ae
×
907
        }
×
908

909
        return ApiErrors[JSClusterNotActiveErr]
1✔
910
}
911

912
// NewJSClusterNotAssignedError creates a new JSClusterNotAssignedErr error: "JetStream cluster not assigned to this server"
913
func NewJSClusterNotAssignedError(opts ...ErrorOption) *ApiError {
24✔
914
        eopts := parseOpts(opts)
24✔
915
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
916
                return ae
×
917
        }
×
918

919
        return ApiErrors[JSClusterNotAssignedErr]
24✔
920
}
921

922
// NewJSClusterNotAvailError creates a new JSClusterNotAvailErr error: "JetStream system temporarily unavailable"
923
func NewJSClusterNotAvailError(opts ...ErrorOption) *ApiError {
13✔
924
        eopts := parseOpts(opts)
13✔
925
        if ae, ok := eopts.err.(*ApiError); ok {
13✔
926
                return ae
×
927
        }
×
928

929
        return ApiErrors[JSClusterNotAvailErr]
13✔
930
}
931

932
// NewJSClusterNotLeaderError creates a new JSClusterNotLeaderErr error: "JetStream cluster can not handle request"
933
func NewJSClusterNotLeaderError(opts ...ErrorOption) *ApiError {
20✔
934
        eopts := parseOpts(opts)
20✔
935
        if ae, ok := eopts.err.(*ApiError); ok {
20✔
936
                return ae
×
937
        }
×
938

939
        return ApiErrors[JSClusterNotLeaderErr]
20✔
940
}
941

942
// NewJSClusterPeerNotMemberError creates a new JSClusterPeerNotMemberErr error: "peer not a member"
943
func NewJSClusterPeerNotMemberError(opts ...ErrorOption) *ApiError {
1✔
944
        eopts := parseOpts(opts)
1✔
945
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
946
                return ae
×
947
        }
×
948

949
        return ApiErrors[JSClusterPeerNotMemberErr]
1✔
950
}
951

952
// NewJSClusterRequiredError creates a new JSClusterRequiredErr error: "JetStream clustering support required"
953
func NewJSClusterRequiredError(opts ...ErrorOption) *ApiError {
×
954
        eopts := parseOpts(opts)
×
955
        if ae, ok := eopts.err.(*ApiError); ok {
×
956
                return ae
×
957
        }
×
958

959
        return ApiErrors[JSClusterRequiredErr]
×
960
}
961

962
// NewJSClusterServerNotMemberError creates a new JSClusterServerNotMemberErr error: "server is not a member of the cluster"
963
func NewJSClusterServerNotMemberError(opts ...ErrorOption) *ApiError {
3✔
964
        eopts := parseOpts(opts)
3✔
965
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
966
                return ae
×
967
        }
×
968

969
        return ApiErrors[JSClusterServerNotMemberErr]
3✔
970
}
971

972
// NewJSClusterTagsError creates a new JSClusterTagsErr error: "tags placement not supported for operation"
973
func NewJSClusterTagsError(opts ...ErrorOption) *ApiError {
×
974
        eopts := parseOpts(opts)
×
975
        if ae, ok := eopts.err.(*ApiError); ok {
×
976
                return ae
×
977
        }
×
978

979
        return ApiErrors[JSClusterTagsErr]
×
980
}
981

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

989
        return ApiErrors[JSClusterUnSupportFeatureErr]
6✔
990
}
991

992
// NewJSConsumerAckPolicyInvalidError creates a new JSConsumerAckPolicyInvalidErr error: "consumer ack policy invalid"
993
func NewJSConsumerAckPolicyInvalidError(opts ...ErrorOption) *ApiError {
2✔
994
        eopts := parseOpts(opts)
2✔
995
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
996
                return ae
×
997
        }
×
998

999
        return ApiErrors[JSConsumerAckPolicyInvalidErr]
2✔
1000
}
1001

1002
// NewJSConsumerAckWaitNegativeError creates a new JSConsumerAckWaitNegativeErr error: "consumer ack wait needs to be positive"
1003
func NewJSConsumerAckWaitNegativeError(opts ...ErrorOption) *ApiError {
2✔
1004
        eopts := parseOpts(opts)
2✔
1005
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1006
                return ae
×
1007
        }
×
1008

1009
        return ApiErrors[JSConsumerAckWaitNegativeErr]
2✔
1010
}
1011

1012
// NewJSConsumerAlreadyExistsError creates a new JSConsumerAlreadyExists error: "consumer already exists"
1013
func NewJSConsumerAlreadyExistsError(opts ...ErrorOption) *ApiError {
5✔
1014
        eopts := parseOpts(opts)
5✔
1015
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
1016
                return ae
×
1017
        }
×
1018

1019
        return ApiErrors[JSConsumerAlreadyExists]
5✔
1020
}
1021

1022
// NewJSConsumerBackOffNegativeError creates a new JSConsumerBackOffNegativeErr error: "consumer backoff needs to be positive"
1023
func NewJSConsumerBackOffNegativeError(opts ...ErrorOption) *ApiError {
2✔
1024
        eopts := parseOpts(opts)
2✔
1025
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1026
                return ae
×
1027
        }
×
1028

1029
        return ApiErrors[JSConsumerBackOffNegativeErr]
2✔
1030
}
1031

1032
// NewJSConsumerBadDurableNameError creates a new JSConsumerBadDurableNameErr error: "durable name can not contain '.', '*', '>'"
1033
func NewJSConsumerBadDurableNameError(opts ...ErrorOption) *ApiError {
×
1034
        eopts := parseOpts(opts)
×
1035
        if ae, ok := eopts.err.(*ApiError); ok {
×
1036
                return ae
×
1037
        }
×
1038

1039
        return ApiErrors[JSConsumerBadDurableNameErr]
×
1040
}
1041

1042
// NewJSConsumerConfigRequiredError creates a new JSConsumerConfigRequiredErr error: "consumer config required"
1043
func NewJSConsumerConfigRequiredError(opts ...ErrorOption) *ApiError {
2✔
1044
        eopts := parseOpts(opts)
2✔
1045
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1046
                return ae
×
1047
        }
×
1048

1049
        return ApiErrors[JSConsumerConfigRequiredErr]
2✔
1050
}
1051

1052
// NewJSConsumerCreateDurableAndNameMismatchError creates a new JSConsumerCreateDurableAndNameMismatch error: "Consumer Durable and Name have to be equal if both are provided"
1053
func NewJSConsumerCreateDurableAndNameMismatchError(opts ...ErrorOption) *ApiError {
1✔
1054
        eopts := parseOpts(opts)
1✔
1055
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1056
                return ae
×
1057
        }
×
1058

1059
        return ApiErrors[JSConsumerCreateDurableAndNameMismatch]
1✔
1060
}
1061

1062
// NewJSConsumerCreateError creates a new JSConsumerCreateErrF error: "{err}"
1063
func NewJSConsumerCreateError(err error, opts ...ErrorOption) *ApiError {
69✔
1064
        eopts := parseOpts(opts)
69✔
1065
        if ae, ok := eopts.err.(*ApiError); ok {
120✔
1066
                return ae
51✔
1067
        }
51✔
1068

1069
        e := ApiErrors[JSConsumerCreateErrF]
18✔
1070
        args := e.toReplacerArgs([]interface{}{"{err}", err})
18✔
1071
        return &ApiError{
18✔
1072
                Code:        e.Code,
18✔
1073
                ErrCode:     e.ErrCode,
18✔
1074
                Description: strings.NewReplacer(args...).Replace(e.Description),
18✔
1075
        }
18✔
1076
}
1077

1078
// NewJSConsumerCreateFilterSubjectMismatchError creates a new JSConsumerCreateFilterSubjectMismatchErr error: "Consumer create request did not match filtered subject from create subject"
1079
func NewJSConsumerCreateFilterSubjectMismatchError(opts ...ErrorOption) *ApiError {
2✔
1080
        eopts := parseOpts(opts)
2✔
1081
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1082
                return ae
×
1083
        }
×
1084

1085
        return ApiErrors[JSConsumerCreateFilterSubjectMismatchErr]
2✔
1086
}
1087

1088
// NewJSConsumerDeliverCycleError creates a new JSConsumerDeliverCycleErr error: "consumer deliver subject forms a cycle"
1089
func NewJSConsumerDeliverCycleError(opts ...ErrorOption) *ApiError {
4✔
1090
        eopts := parseOpts(opts)
4✔
1091
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1092
                return ae
×
1093
        }
×
1094

1095
        return ApiErrors[JSConsumerDeliverCycleErr]
4✔
1096
}
1097

1098
// NewJSConsumerDeliverToWildcardsError creates a new JSConsumerDeliverToWildcardsErr error: "consumer deliver subject has wildcards"
1099
func NewJSConsumerDeliverToWildcardsError(opts ...ErrorOption) *ApiError {
4✔
1100
        eopts := parseOpts(opts)
4✔
1101
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1102
                return ae
×
1103
        }
×
1104

1105
        return ApiErrors[JSConsumerDeliverToWildcardsErr]
4✔
1106
}
1107

1108
// NewJSConsumerDescriptionTooLongError creates a new JSConsumerDescriptionTooLongErrF error: "consumer description is too long, maximum allowed is {max}"
1109
func NewJSConsumerDescriptionTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
1✔
1110
        eopts := parseOpts(opts)
1✔
1111
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1112
                return ae
×
1113
        }
×
1114

1115
        e := ApiErrors[JSConsumerDescriptionTooLongErrF]
1✔
1116
        args := e.toReplacerArgs([]interface{}{"{max}", max})
1✔
1117
        return &ApiError{
1✔
1118
                Code:        e.Code,
1✔
1119
                ErrCode:     e.ErrCode,
1✔
1120
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1121
        }
1✔
1122
}
1123

1124
// NewJSConsumerDirectRequiresEphemeralError creates a new JSConsumerDirectRequiresEphemeralErr error: "consumer direct requires an ephemeral consumer"
1125
func NewJSConsumerDirectRequiresEphemeralError(opts ...ErrorOption) *ApiError {
×
1126
        eopts := parseOpts(opts)
×
1127
        if ae, ok := eopts.err.(*ApiError); ok {
×
1128
                return ae
×
1129
        }
×
1130

1131
        return ApiErrors[JSConsumerDirectRequiresEphemeralErr]
×
1132
}
1133

1134
// NewJSConsumerDirectRequiresPushError creates a new JSConsumerDirectRequiresPushErr error: "consumer direct requires a push based consumer"
1135
func NewJSConsumerDirectRequiresPushError(opts ...ErrorOption) *ApiError {
×
1136
        eopts := parseOpts(opts)
×
1137
        if ae, ok := eopts.err.(*ApiError); ok {
×
1138
                return ae
×
1139
        }
×
1140

1141
        return ApiErrors[JSConsumerDirectRequiresPushErr]
×
1142
}
1143

1144
// NewJSConsumerDoesNotExistError creates a new JSConsumerDoesNotExist error: "consumer does not exist"
1145
func NewJSConsumerDoesNotExistError(opts ...ErrorOption) *ApiError {
3✔
1146
        eopts := parseOpts(opts)
3✔
1147
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1148
                return ae
×
1149
        }
×
1150

1151
        return ApiErrors[JSConsumerDoesNotExist]
3✔
1152
}
1153

1154
// NewJSConsumerDuplicateFilterSubjectsError creates a new JSConsumerDuplicateFilterSubjects error: "consumer cannot have both FilterSubject and FilterSubjects specified"
1155
func NewJSConsumerDuplicateFilterSubjectsError(opts ...ErrorOption) *ApiError {
1✔
1156
        eopts := parseOpts(opts)
1✔
1157
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1158
                return ae
×
1159
        }
×
1160

1161
        return ApiErrors[JSConsumerDuplicateFilterSubjects]
1✔
1162
}
1163

1164
// NewJSConsumerDurableNameNotInSubjectError creates a new JSConsumerDurableNameNotInSubjectErr error: "consumer expected to be durable but no durable name set in subject"
1165
func NewJSConsumerDurableNameNotInSubjectError(opts ...ErrorOption) *ApiError {
×
1166
        eopts := parseOpts(opts)
×
1167
        if ae, ok := eopts.err.(*ApiError); ok {
×
1168
                return ae
×
1169
        }
×
1170

1171
        return ApiErrors[JSConsumerDurableNameNotInSubjectErr]
×
1172
}
1173

1174
// NewJSConsumerDurableNameNotMatchSubjectError creates a new JSConsumerDurableNameNotMatchSubjectErr error: "consumer name in subject does not match durable name in request"
1175
func NewJSConsumerDurableNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
×
1176
        eopts := parseOpts(opts)
×
1177
        if ae, ok := eopts.err.(*ApiError); ok {
×
1178
                return ae
×
1179
        }
×
1180

1181
        return ApiErrors[JSConsumerDurableNameNotMatchSubjectErr]
×
1182
}
1183

1184
// NewJSConsumerDurableNameNotSetError creates a new JSConsumerDurableNameNotSetErr error: "consumer expected to be durable but a durable name was not set"
1185
func NewJSConsumerDurableNameNotSetError(opts ...ErrorOption) *ApiError {
1✔
1186
        eopts := parseOpts(opts)
1✔
1187
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1188
                return ae
×
1189
        }
×
1190

1191
        return ApiErrors[JSConsumerDurableNameNotSetErr]
1✔
1192
}
1193

1194
// NewJSConsumerEmptyFilterError creates a new JSConsumerEmptyFilter error: "consumer filter in FilterSubjects cannot be empty"
1195
func NewJSConsumerEmptyFilterError(opts ...ErrorOption) *ApiError {
1✔
1196
        eopts := parseOpts(opts)
1✔
1197
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1198
                return ae
×
1199
        }
×
1200

1201
        return ApiErrors[JSConsumerEmptyFilter]
1✔
1202
}
1203

1204
// NewJSConsumerEmptyGroupNameError creates a new JSConsumerEmptyGroupName error: "Group name cannot be an empty string"
1205
func NewJSConsumerEmptyGroupNameError(opts ...ErrorOption) *ApiError {
4✔
1206
        eopts := parseOpts(opts)
4✔
1207
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1208
                return ae
×
1209
        }
×
1210

1211
        return ApiErrors[JSConsumerEmptyGroupName]
4✔
1212
}
1213

1214
// NewJSConsumerEphemeralWithDurableInSubjectError creates a new JSConsumerEphemeralWithDurableInSubjectErr error: "consumer expected to be ephemeral but detected a durable name set in subject"
1215
func NewJSConsumerEphemeralWithDurableInSubjectError(opts ...ErrorOption) *ApiError {
×
1216
        eopts := parseOpts(opts)
×
1217
        if ae, ok := eopts.err.(*ApiError); ok {
×
1218
                return ae
×
1219
        }
×
1220

1221
        return ApiErrors[JSConsumerEphemeralWithDurableInSubjectErr]
×
1222
}
1223

1224
// NewJSConsumerEphemeralWithDurableNameError creates a new JSConsumerEphemeralWithDurableNameErr error: "consumer expected to be ephemeral but a durable name was set in request"
1225
func NewJSConsumerEphemeralWithDurableNameError(opts ...ErrorOption) *ApiError {
3✔
1226
        eopts := parseOpts(opts)
3✔
1227
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1228
                return ae
×
1229
        }
×
1230

1231
        return ApiErrors[JSConsumerEphemeralWithDurableNameErr]
3✔
1232
}
1233

1234
// NewJSConsumerExistingActiveError creates a new JSConsumerExistingActiveErr error: "consumer already exists and is still active"
1235
func NewJSConsumerExistingActiveError(opts ...ErrorOption) *ApiError {
×
1236
        eopts := parseOpts(opts)
×
1237
        if ae, ok := eopts.err.(*ApiError); ok {
×
1238
                return ae
×
1239
        }
×
1240

1241
        return ApiErrors[JSConsumerExistingActiveErr]
×
1242
}
1243

1244
// NewJSConsumerFCRequiresPushError creates a new JSConsumerFCRequiresPushErr error: "consumer flow control requires a push based consumer"
1245
func NewJSConsumerFCRequiresPushError(opts ...ErrorOption) *ApiError {
×
1246
        eopts := parseOpts(opts)
×
1247
        if ae, ok := eopts.err.(*ApiError); ok {
×
1248
                return ae
×
1249
        }
×
1250

1251
        return ApiErrors[JSConsumerFCRequiresPushErr]
×
1252
}
1253

1254
// NewJSConsumerFilterNotSubsetError creates a new JSConsumerFilterNotSubsetErr error: "consumer filter subject is not a valid subset of the interest subjects"
1255
func NewJSConsumerFilterNotSubsetError(opts ...ErrorOption) *ApiError {
×
1256
        eopts := parseOpts(opts)
×
1257
        if ae, ok := eopts.err.(*ApiError); ok {
×
1258
                return ae
×
1259
        }
×
1260

1261
        return ApiErrors[JSConsumerFilterNotSubsetErr]
×
1262
}
1263

1264
// NewJSConsumerHBRequiresPushError creates a new JSConsumerHBRequiresPushErr error: "consumer idle heartbeat requires a push based consumer"
1265
func NewJSConsumerHBRequiresPushError(opts ...ErrorOption) *ApiError {
×
1266
        eopts := parseOpts(opts)
×
1267
        if ae, ok := eopts.err.(*ApiError); ok {
×
1268
                return ae
×
1269
        }
×
1270

1271
        return ApiErrors[JSConsumerHBRequiresPushErr]
×
1272
}
1273

1274
// NewJSConsumerInactiveThresholdExcessError creates a new JSConsumerInactiveThresholdExcess error: "consumer inactive threshold exceeds system limit of {limit}"
1275
func NewJSConsumerInactiveThresholdExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
2✔
1276
        eopts := parseOpts(opts)
2✔
1277
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1278
                return ae
×
1279
        }
×
1280

1281
        e := ApiErrors[JSConsumerInactiveThresholdExcess]
2✔
1282
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
2✔
1283
        return &ApiError{
2✔
1284
                Code:        e.Code,
2✔
1285
                ErrCode:     e.ErrCode,
2✔
1286
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1287
        }
2✔
1288
}
1289

1290
// NewJSConsumerInvalidDeliverSubjectError creates a new JSConsumerInvalidDeliverSubject error: "invalid push consumer deliver subject"
1291
func NewJSConsumerInvalidDeliverSubjectError(opts ...ErrorOption) *ApiError {
2✔
1292
        eopts := parseOpts(opts)
2✔
1293
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1294
                return ae
×
1295
        }
×
1296

1297
        return ApiErrors[JSConsumerInvalidDeliverSubject]
2✔
1298
}
1299

1300
// NewJSConsumerInvalidGroupNameError creates a new JSConsumerInvalidGroupNameErr error: "Valid priority group name must match A-Z, a-z, 0-9, -_/=)+ and may not exceed 16 characters"
1301
func NewJSConsumerInvalidGroupNameError(opts ...ErrorOption) *ApiError {
4✔
1302
        eopts := parseOpts(opts)
4✔
1303
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1304
                return ae
×
1305
        }
×
1306

1307
        return ApiErrors[JSConsumerInvalidGroupNameErr]
4✔
1308
}
1309

1310
// NewJSConsumerInvalidPolicyError creates a new JSConsumerInvalidPolicyErrF error: "{err}"
1311
func NewJSConsumerInvalidPolicyError(err error, opts ...ErrorOption) *ApiError {
10✔
1312
        eopts := parseOpts(opts)
10✔
1313
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1314
                return ae
×
1315
        }
×
1316

1317
        e := ApiErrors[JSConsumerInvalidPolicyErrF]
10✔
1318
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1319
        return &ApiError{
10✔
1320
                Code:        e.Code,
10✔
1321
                ErrCode:     e.ErrCode,
10✔
1322
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1323
        }
10✔
1324
}
1325

1326
// NewJSConsumerInvalidPriorityGroupError creates a new JSConsumerInvalidPriorityGroupErr error: "Provided priority group does not exist for this consumer"
1327
func NewJSConsumerInvalidPriorityGroupError(opts ...ErrorOption) *ApiError {
2✔
1328
        eopts := parseOpts(opts)
2✔
1329
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1330
                return ae
×
1331
        }
×
1332

1333
        return ApiErrors[JSConsumerInvalidPriorityGroupErr]
2✔
1334
}
1335

1336
// NewJSConsumerInvalidSamplingError creates a new JSConsumerInvalidSamplingErrF error: "failed to parse consumer sampling configuration: {err}"
1337
func NewJSConsumerInvalidSamplingError(err error, opts ...ErrorOption) *ApiError {
×
1338
        eopts := parseOpts(opts)
×
1339
        if ae, ok := eopts.err.(*ApiError); ok {
×
1340
                return ae
×
1341
        }
×
1342

1343
        e := ApiErrors[JSConsumerInvalidSamplingErrF]
×
1344
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1345
        return &ApiError{
×
1346
                Code:        e.Code,
×
1347
                ErrCode:     e.ErrCode,
×
1348
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1349
        }
×
1350
}
1351

1352
// NewJSConsumerMaxDeliverBackoffError creates a new JSConsumerMaxDeliverBackoffErr error: "max deliver is required to be > length of backoff values"
1353
func NewJSConsumerMaxDeliverBackoffError(opts ...ErrorOption) *ApiError {
3✔
1354
        eopts := parseOpts(opts)
3✔
1355
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1356
                return ae
×
1357
        }
×
1358

1359
        return ApiErrors[JSConsumerMaxDeliverBackoffErr]
3✔
1360
}
1361

1362
// NewJSConsumerMaxPendingAckExcessError creates a new JSConsumerMaxPendingAckExcessErrF error: "consumer max ack pending exceeds system limit of {limit}"
1363
func NewJSConsumerMaxPendingAckExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
12✔
1364
        eopts := parseOpts(opts)
12✔
1365
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
1366
                return ae
×
1367
        }
×
1368

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

1378
// NewJSConsumerMaxPendingAckPolicyRequiredError creates a new JSConsumerMaxPendingAckPolicyRequiredErr error: "consumer requires ack policy for max ack pending"
1379
func NewJSConsumerMaxPendingAckPolicyRequiredError(opts ...ErrorOption) *ApiError {
2✔
1380
        eopts := parseOpts(opts)
2✔
1381
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1382
                return ae
×
1383
        }
×
1384

1385
        return ApiErrors[JSConsumerMaxPendingAckPolicyRequiredErr]
2✔
1386
}
1387

1388
// NewJSConsumerMaxRequestBatchExceededError creates a new JSConsumerMaxRequestBatchExceededF error: "consumer max request batch exceeds server limit of {limit}"
1389
func NewJSConsumerMaxRequestBatchExceededError(limit interface{}, opts ...ErrorOption) *ApiError {
4✔
1390
        eopts := parseOpts(opts)
4✔
1391
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1392
                return ae
×
1393
        }
×
1394

1395
        e := ApiErrors[JSConsumerMaxRequestBatchExceededF]
4✔
1396
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
4✔
1397
        return &ApiError{
4✔
1398
                Code:        e.Code,
4✔
1399
                ErrCode:     e.ErrCode,
4✔
1400
                Description: strings.NewReplacer(args...).Replace(e.Description),
4✔
1401
        }
4✔
1402
}
1403

1404
// NewJSConsumerMaxRequestBatchNegativeError creates a new JSConsumerMaxRequestBatchNegativeErr error: "consumer max request batch needs to be > 0"
1405
func NewJSConsumerMaxRequestBatchNegativeError(opts ...ErrorOption) *ApiError {
×
1406
        eopts := parseOpts(opts)
×
1407
        if ae, ok := eopts.err.(*ApiError); ok {
×
1408
                return ae
×
1409
        }
×
1410

1411
        return ApiErrors[JSConsumerMaxRequestBatchNegativeErr]
×
1412
}
1413

1414
// NewJSConsumerMaxRequestExpiresTooSmallError creates a new JSConsumerMaxRequestExpiresTooSmall error: "consumer max request expires needs to be >= 1ms"
1415
func NewJSConsumerMaxRequestExpiresTooSmallError(opts ...ErrorOption) *ApiError {
×
1416
        eopts := parseOpts(opts)
×
1417
        if ae, ok := eopts.err.(*ApiError); ok {
×
1418
                return ae
×
1419
        }
×
1420

1421
        return ApiErrors[JSConsumerMaxRequestExpiresTooSmall]
×
1422
}
1423

1424
// NewJSConsumerMaxWaitingNegativeError creates a new JSConsumerMaxWaitingNegativeErr error: "consumer max waiting needs to be positive"
1425
func NewJSConsumerMaxWaitingNegativeError(opts ...ErrorOption) *ApiError {
×
1426
        eopts := parseOpts(opts)
×
1427
        if ae, ok := eopts.err.(*ApiError); ok {
×
1428
                return ae
×
1429
        }
×
1430

1431
        return ApiErrors[JSConsumerMaxWaitingNegativeErr]
×
1432
}
1433

1434
// NewJSConsumerMetadataLengthError creates a new JSConsumerMetadataLengthErrF error: "consumer metadata exceeds maximum size of {limit}"
1435
func NewJSConsumerMetadataLengthError(limit interface{}, opts ...ErrorOption) *ApiError {
1✔
1436
        eopts := parseOpts(opts)
1✔
1437
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1438
                return ae
×
1439
        }
×
1440

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

1450
// NewJSConsumerMultipleFiltersNotAllowedError creates a new JSConsumerMultipleFiltersNotAllowed error: "consumer with multiple subject filters cannot use subject based API"
1451
func NewJSConsumerMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
1452
        eopts := parseOpts(opts)
1✔
1453
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1454
                return ae
×
1455
        }
×
1456

1457
        return ApiErrors[JSConsumerMultipleFiltersNotAllowed]
1✔
1458
}
1459

1460
// NewJSConsumerNameContainsPathSeparatorsError creates a new JSConsumerNameContainsPathSeparatorsErr error: "Consumer name can not contain path separators"
1461
func NewJSConsumerNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
8✔
1462
        eopts := parseOpts(opts)
8✔
1463
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1464
                return ae
×
1465
        }
×
1466

1467
        return ApiErrors[JSConsumerNameContainsPathSeparatorsErr]
8✔
1468
}
1469

1470
// NewJSConsumerNameExistError creates a new JSConsumerNameExistErr error: "consumer name already in use"
1471
func NewJSConsumerNameExistError(opts ...ErrorOption) *ApiError {
3✔
1472
        eopts := parseOpts(opts)
3✔
1473
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1474
                return ae
×
1475
        }
×
1476

1477
        return ApiErrors[JSConsumerNameExistErr]
3✔
1478
}
1479

1480
// NewJSConsumerNameTooLongError creates a new JSConsumerNameTooLongErrF error: "consumer name is too long, maximum allowed is {max}"
1481
func NewJSConsumerNameTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
×
1482
        eopts := parseOpts(opts)
×
1483
        if ae, ok := eopts.err.(*ApiError); ok {
×
1484
                return ae
×
1485
        }
×
1486

1487
        e := ApiErrors[JSConsumerNameTooLongErrF]
×
1488
        args := e.toReplacerArgs([]interface{}{"{max}", max})
×
1489
        return &ApiError{
×
1490
                Code:        e.Code,
×
1491
                ErrCode:     e.ErrCode,
×
1492
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1493
        }
×
1494
}
1495

1496
// NewJSConsumerNotFoundError creates a new JSConsumerNotFoundErr error: "consumer not found"
1497
func NewJSConsumerNotFoundError(opts ...ErrorOption) *ApiError {
2,752✔
1498
        eopts := parseOpts(opts)
2,752✔
1499
        if ae, ok := eopts.err.(*ApiError); ok {
2,752✔
1500
                return ae
×
1501
        }
×
1502

1503
        return ApiErrors[JSConsumerNotFoundErr]
2,752✔
1504
}
1505

1506
// NewJSConsumerOfflineError creates a new JSConsumerOfflineErr error: "consumer is offline"
1507
func NewJSConsumerOfflineError(opts ...ErrorOption) *ApiError {
6✔
1508
        eopts := parseOpts(opts)
6✔
1509
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1510
                return ae
×
1511
        }
×
1512

1513
        return ApiErrors[JSConsumerOfflineErr]
6✔
1514
}
1515

1516
// NewJSConsumerOnMappedError creates a new JSConsumerOnMappedErr error: "consumer direct on a mapped consumer"
1517
func NewJSConsumerOnMappedError(opts ...ErrorOption) *ApiError {
×
1518
        eopts := parseOpts(opts)
×
1519
        if ae, ok := eopts.err.(*ApiError); ok {
×
1520
                return ae
×
1521
        }
×
1522

1523
        return ApiErrors[JSConsumerOnMappedErr]
×
1524
}
1525

1526
// NewJSConsumerOverlappingSubjectFiltersError creates a new JSConsumerOverlappingSubjectFilters error: "consumer subject filters cannot overlap"
1527
func NewJSConsumerOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
1✔
1528
        eopts := parseOpts(opts)
1✔
1529
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1530
                return ae
×
1531
        }
×
1532

1533
        return ApiErrors[JSConsumerOverlappingSubjectFilters]
1✔
1534
}
1535

1536
// NewJSConsumerPriorityPolicyWithoutGroupError creates a new JSConsumerPriorityPolicyWithoutGroup error: "Setting PriorityPolicy requires at least one PriorityGroup to be set"
1537
func NewJSConsumerPriorityPolicyWithoutGroupError(opts ...ErrorOption) *ApiError {
4✔
1538
        eopts := parseOpts(opts)
4✔
1539
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1540
                return ae
×
1541
        }
×
1542

1543
        return ApiErrors[JSConsumerPriorityPolicyWithoutGroup]
4✔
1544
}
1545

1546
// NewJSConsumerPullNotDurableError creates a new JSConsumerPullNotDurableErr error: "consumer in pull mode requires a durable name"
1547
func NewJSConsumerPullNotDurableError(opts ...ErrorOption) *ApiError {
×
1548
        eopts := parseOpts(opts)
×
1549
        if ae, ok := eopts.err.(*ApiError); ok {
×
1550
                return ae
×
1551
        }
×
1552

1553
        return ApiErrors[JSConsumerPullNotDurableErr]
×
1554
}
1555

1556
// NewJSConsumerPullRequiresAckError creates a new JSConsumerPullRequiresAckErr error: "consumer in pull mode requires explicit ack policy on workqueue stream"
1557
func NewJSConsumerPullRequiresAckError(opts ...ErrorOption) *ApiError {
6✔
1558
        eopts := parseOpts(opts)
6✔
1559
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1560
                return ae
×
1561
        }
×
1562

1563
        return ApiErrors[JSConsumerPullRequiresAckErr]
6✔
1564
}
1565

1566
// NewJSConsumerPullWithRateLimitError creates a new JSConsumerPullWithRateLimitErr error: "consumer in pull mode can not have rate limit set"
1567
func NewJSConsumerPullWithRateLimitError(opts ...ErrorOption) *ApiError {
1✔
1568
        eopts := parseOpts(opts)
1✔
1569
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1570
                return ae
×
1571
        }
×
1572

1573
        return ApiErrors[JSConsumerPullWithRateLimitErr]
1✔
1574
}
1575

1576
// NewJSConsumerPushMaxWaitingError creates a new JSConsumerPushMaxWaitingErr error: "consumer in push mode can not set max waiting"
1577
func NewJSConsumerPushMaxWaitingError(opts ...ErrorOption) *ApiError {
3✔
1578
        eopts := parseOpts(opts)
3✔
1579
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1580
                return ae
×
1581
        }
×
1582

1583
        return ApiErrors[JSConsumerPushMaxWaitingErr]
3✔
1584
}
1585

1586
// NewJSConsumerPushWithPriorityGroupError creates a new JSConsumerPushWithPriorityGroupErr error: "priority groups can not be used with push consumers"
1587
func NewJSConsumerPushWithPriorityGroupError(opts ...ErrorOption) *ApiError {
1✔
1588
        eopts := parseOpts(opts)
1✔
1589
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1590
                return ae
×
1591
        }
×
1592

1593
        return ApiErrors[JSConsumerPushWithPriorityGroupErr]
1✔
1594
}
1595

1596
// NewJSConsumerReplacementWithDifferentNameError creates a new JSConsumerReplacementWithDifferentNameErr error: "consumer replacement durable config not the same"
1597
func NewJSConsumerReplacementWithDifferentNameError(opts ...ErrorOption) *ApiError {
×
1598
        eopts := parseOpts(opts)
×
1599
        if ae, ok := eopts.err.(*ApiError); ok {
×
1600
                return ae
×
1601
        }
×
1602

1603
        return ApiErrors[JSConsumerReplacementWithDifferentNameErr]
×
1604
}
1605

1606
// NewJSConsumerReplayPolicyInvalidError creates a new JSConsumerReplayPolicyInvalidErr error: "consumer replay policy invalid"
1607
func NewJSConsumerReplayPolicyInvalidError(opts ...ErrorOption) *ApiError {
2✔
1608
        eopts := parseOpts(opts)
2✔
1609
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1610
                return ae
×
1611
        }
×
1612

1613
        return ApiErrors[JSConsumerReplayPolicyInvalidErr]
2✔
1614
}
1615

1616
// NewJSConsumerReplicasExceedsStreamError creates a new JSConsumerReplicasExceedsStream error: "consumer config replica count exceeds parent stream"
1617
func NewJSConsumerReplicasExceedsStreamError(opts ...ErrorOption) *ApiError {
1✔
1618
        eopts := parseOpts(opts)
1✔
1619
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1620
                return ae
×
1621
        }
×
1622

1623
        return ApiErrors[JSConsumerReplicasExceedsStream]
1✔
1624
}
1625

1626
// NewJSConsumerReplicasShouldMatchStreamError creates a new JSConsumerReplicasShouldMatchStream error: "consumer config replicas must match interest retention stream's replicas"
1627
func NewJSConsumerReplicasShouldMatchStreamError(opts ...ErrorOption) *ApiError {
2✔
1628
        eopts := parseOpts(opts)
2✔
1629
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1630
                return ae
×
1631
        }
×
1632

1633
        return ApiErrors[JSConsumerReplicasShouldMatchStream]
2✔
1634
}
1635

1636
// NewJSConsumerSmallHeartbeatError creates a new JSConsumerSmallHeartbeatErr error: "consumer idle heartbeat needs to be >= 100ms"
1637
func NewJSConsumerSmallHeartbeatError(opts ...ErrorOption) *ApiError {
1✔
1638
        eopts := parseOpts(opts)
1✔
1639
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1640
                return ae
×
1641
        }
×
1642

1643
        return ApiErrors[JSConsumerSmallHeartbeatErr]
1✔
1644
}
1645

1646
// NewJSConsumerStoreFailedError creates a new JSConsumerStoreFailedErrF error: "error creating store for consumer: {err}"
1647
func NewJSConsumerStoreFailedError(err error, opts ...ErrorOption) *ApiError {
36✔
1648
        eopts := parseOpts(opts)
36✔
1649
        if ae, ok := eopts.err.(*ApiError); ok {
36✔
1650
                return ae
×
1651
        }
×
1652

1653
        e := ApiErrors[JSConsumerStoreFailedErrF]
36✔
1654
        args := e.toReplacerArgs([]interface{}{"{err}", err})
36✔
1655
        return &ApiError{
36✔
1656
                Code:        e.Code,
36✔
1657
                ErrCode:     e.ErrCode,
36✔
1658
                Description: strings.NewReplacer(args...).Replace(e.Description),
36✔
1659
        }
36✔
1660
}
1661

1662
// NewJSConsumerWQConsumerNotDeliverAllError creates a new JSConsumerWQConsumerNotDeliverAllErr error: "consumer must be deliver all on workqueue stream"
1663
func NewJSConsumerWQConsumerNotDeliverAllError(opts ...ErrorOption) *ApiError {
×
1664
        eopts := parseOpts(opts)
×
1665
        if ae, ok := eopts.err.(*ApiError); ok {
×
1666
                return ae
×
1667
        }
×
1668

1669
        return ApiErrors[JSConsumerWQConsumerNotDeliverAllErr]
×
1670
}
1671

1672
// NewJSConsumerWQConsumerNotUniqueError creates a new JSConsumerWQConsumerNotUniqueErr error: "filtered consumer not unique on workqueue stream"
1673
func NewJSConsumerWQConsumerNotUniqueError(opts ...ErrorOption) *ApiError {
11✔
1674
        eopts := parseOpts(opts)
11✔
1675
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
1676
                return ae
×
1677
        }
×
1678

1679
        return ApiErrors[JSConsumerWQConsumerNotUniqueErr]
11✔
1680
}
1681

1682
// NewJSConsumerWQMultipleUnfilteredError creates a new JSConsumerWQMultipleUnfilteredErr error: "multiple non-filtered consumers not allowed on workqueue stream"
1683
func NewJSConsumerWQMultipleUnfilteredError(opts ...ErrorOption) *ApiError {
2✔
1684
        eopts := parseOpts(opts)
2✔
1685
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1686
                return ae
×
1687
        }
×
1688

1689
        return ApiErrors[JSConsumerWQMultipleUnfilteredErr]
2✔
1690
}
1691

1692
// NewJSConsumerWQRequiresExplicitAckError creates a new JSConsumerWQRequiresExplicitAckErr error: "workqueue stream requires explicit ack"
1693
func NewJSConsumerWQRequiresExplicitAckError(opts ...ErrorOption) *ApiError {
×
1694
        eopts := parseOpts(opts)
×
1695
        if ae, ok := eopts.err.(*ApiError); ok {
×
1696
                return ae
×
1697
        }
×
1698

1699
        return ApiErrors[JSConsumerWQRequiresExplicitAckErr]
×
1700
}
1701

1702
// NewJSConsumerWithFlowControlNeedsHeartbeatsError creates a new JSConsumerWithFlowControlNeedsHeartbeats error: "consumer with flow control also needs heartbeats"
1703
func NewJSConsumerWithFlowControlNeedsHeartbeatsError(opts ...ErrorOption) *ApiError {
4✔
1704
        eopts := parseOpts(opts)
4✔
1705
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1706
                return ae
×
1707
        }
×
1708

1709
        return ApiErrors[JSConsumerWithFlowControlNeedsHeartbeats]
4✔
1710
}
1711

1712
// NewJSInsufficientResourcesError creates a new JSInsufficientResourcesErr error: "insufficient resources"
1713
func NewJSInsufficientResourcesError(opts ...ErrorOption) *ApiError {
10✔
1714
        eopts := parseOpts(opts)
10✔
1715
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1716
                return ae
×
1717
        }
×
1718

1719
        return ApiErrors[JSInsufficientResourcesErr]
10✔
1720
}
1721

1722
// NewJSInvalidJSONError creates a new JSInvalidJSONErr error: "invalid JSON: {err}"
1723
func NewJSInvalidJSONError(err error, opts ...ErrorOption) *ApiError {
10✔
1724
        eopts := parseOpts(opts)
10✔
1725
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1726
                return ae
×
1727
        }
×
1728

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

1738
// NewJSMaximumConsumersLimitError creates a new JSMaximumConsumersLimitErr error: "maximum consumers limit reached"
1739
func NewJSMaximumConsumersLimitError(opts ...ErrorOption) *ApiError {
29✔
1740
        eopts := parseOpts(opts)
29✔
1741
        if ae, ok := eopts.err.(*ApiError); ok {
29✔
1742
                return ae
×
1743
        }
×
1744

1745
        return ApiErrors[JSMaximumConsumersLimitErr]
29✔
1746
}
1747

1748
// NewJSMaximumStreamsLimitError creates a new JSMaximumStreamsLimitErr error: "maximum number of streams reached"
1749
func NewJSMaximumStreamsLimitError(opts ...ErrorOption) *ApiError {
16✔
1750
        eopts := parseOpts(opts)
16✔
1751
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
1752
                return ae
×
1753
        }
×
1754

1755
        return ApiErrors[JSMaximumStreamsLimitErr]
16✔
1756
}
1757

1758
// NewJSMemoryResourcesExceededError creates a new JSMemoryResourcesExceededErr error: "insufficient memory resources available"
1759
func NewJSMemoryResourcesExceededError(opts ...ErrorOption) *ApiError {
4✔
1760
        eopts := parseOpts(opts)
4✔
1761
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1762
                return ae
×
1763
        }
×
1764

1765
        return ApiErrors[JSMemoryResourcesExceededErr]
4✔
1766
}
1767

1768
// NewJSMessageCounterBrokenError creates a new JSMessageCounterBrokenErr error: "message counter is broken"
1769
func NewJSMessageCounterBrokenError(opts ...ErrorOption) *ApiError {
4✔
1770
        eopts := parseOpts(opts)
4✔
1771
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1772
                return ae
×
1773
        }
×
1774

1775
        return ApiErrors[JSMessageCounterBrokenErr]
4✔
1776
}
1777

1778
// NewJSMessageIncrDisabledError creates a new JSMessageIncrDisabledErr error: "message counters is disabled"
1779
func NewJSMessageIncrDisabledError(opts ...ErrorOption) *ApiError {
4✔
1780
        eopts := parseOpts(opts)
4✔
1781
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1782
                return ae
×
1783
        }
×
1784

1785
        return ApiErrors[JSMessageIncrDisabledErr]
4✔
1786
}
1787

1788
// NewJSMessageIncrInvalidError creates a new JSMessageIncrInvalidErr error: "message counter increment is invalid"
1789
func NewJSMessageIncrInvalidError(opts ...ErrorOption) *ApiError {
24✔
1790
        eopts := parseOpts(opts)
24✔
1791
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
1792
                return ae
×
1793
        }
×
1794

1795
        return ApiErrors[JSMessageIncrInvalidErr]
24✔
1796
}
1797

1798
// NewJSMessageIncrMissingError creates a new JSMessageIncrMissingErr error: "message counter increment is missing"
1799
func NewJSMessageIncrMissingError(opts ...ErrorOption) *ApiError {
8✔
1800
        eopts := parseOpts(opts)
8✔
1801
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1802
                return ae
×
1803
        }
×
1804

1805
        return ApiErrors[JSMessageIncrMissingErr]
8✔
1806
}
1807

1808
// NewJSMessageIncrPayloadError creates a new JSMessageIncrPayloadErr error: "message counter has payload"
1809
func NewJSMessageIncrPayloadError(opts ...ErrorOption) *ApiError {
4✔
1810
        eopts := parseOpts(opts)
4✔
1811
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1812
                return ae
×
1813
        }
×
1814

1815
        return ApiErrors[JSMessageIncrPayloadErr]
4✔
1816
}
1817

1818
// NewJSMessageSchedulesDisabledError creates a new JSMessageSchedulesDisabledErr error: "message schedules is disabled"
1819
func NewJSMessageSchedulesDisabledError(opts ...ErrorOption) *ApiError {
20✔
1820
        eopts := parseOpts(opts)
20✔
1821
        if ae, ok := eopts.err.(*ApiError); ok {
20✔
1822
                return ae
×
1823
        }
×
1824

1825
        return ApiErrors[JSMessageSchedulesDisabledErr]
20✔
1826
}
1827

1828
// NewJSMessageSchedulesPatternInvalidError creates a new JSMessageSchedulesPatternInvalidErr error: "message schedules pattern is invalid"
1829
func NewJSMessageSchedulesPatternInvalidError(opts ...ErrorOption) *ApiError {
15✔
1830
        eopts := parseOpts(opts)
15✔
1831
        if ae, ok := eopts.err.(*ApiError); ok {
15✔
1832
                return ae
×
1833
        }
×
1834

1835
        return ApiErrors[JSMessageSchedulesPatternInvalidErr]
15✔
1836
}
1837

1838
// NewJSMessageSchedulesRollupInvalidError creates a new JSMessageSchedulesRollupInvalidErr error: "message schedules invalid rollup"
1839
func NewJSMessageSchedulesRollupInvalidError(opts ...ErrorOption) *ApiError {
8✔
1840
        eopts := parseOpts(opts)
8✔
1841
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1842
                return ae
×
1843
        }
×
1844

1845
        return ApiErrors[JSMessageSchedulesRollupInvalidErr]
8✔
1846
}
1847

1848
// NewJSMessageSchedulesTTLInvalidError creates a new JSMessageSchedulesTTLInvalidErr error: "message schedules invalid per-message TTL"
1849
func NewJSMessageSchedulesTTLInvalidError(opts ...ErrorOption) *ApiError {
10✔
1850
        eopts := parseOpts(opts)
10✔
1851
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1852
                return ae
×
1853
        }
×
1854

1855
        return ApiErrors[JSMessageSchedulesTTLInvalidErr]
10✔
1856
}
1857

1858
// NewJSMessageSchedulesTargetInvalidError creates a new JSMessageSchedulesTargetInvalidErr error: "message schedules target is invalid"
1859
func NewJSMessageSchedulesTargetInvalidError(opts ...ErrorOption) *ApiError {
30✔
1860
        eopts := parseOpts(opts)
30✔
1861
        if ae, ok := eopts.err.(*ApiError); ok {
30✔
1862
                return ae
×
1863
        }
×
1864

1865
        return ApiErrors[JSMessageSchedulesTargetInvalidErr]
30✔
1866
}
1867

1868
// NewJSMessageTTLDisabledError creates a new JSMessageTTLDisabledErr error: "per-message TTL is disabled"
1869
func NewJSMessageTTLDisabledError(opts ...ErrorOption) *ApiError {
16✔
1870
        eopts := parseOpts(opts)
16✔
1871
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
1872
                return ae
×
1873
        }
×
1874

1875
        return ApiErrors[JSMessageTTLDisabledErr]
16✔
1876
}
1877

1878
// NewJSMessageTTLInvalidError creates a new JSMessageTTLInvalidErr error: "invalid per-message TTL"
1879
func NewJSMessageTTLInvalidError(opts ...ErrorOption) *ApiError {
23✔
1880
        eopts := parseOpts(opts)
23✔
1881
        if ae, ok := eopts.err.(*ApiError); ok {
23✔
1882
                return ae
×
1883
        }
×
1884

1885
        return ApiErrors[JSMessageTTLInvalidErr]
23✔
1886
}
1887

1888
// NewJSMirrorConsumerSetupFailedError creates a new JSMirrorConsumerSetupFailedErrF error: "{err}"
1889
func NewJSMirrorConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
1890
        eopts := parseOpts(opts)
×
1891
        if ae, ok := eopts.err.(*ApiError); ok {
×
1892
                return ae
×
1893
        }
×
1894

1895
        e := ApiErrors[JSMirrorConsumerSetupFailedErrF]
×
1896
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1897
        return &ApiError{
×
1898
                Code:        e.Code,
×
1899
                ErrCode:     e.ErrCode,
×
1900
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1901
        }
×
1902
}
1903

1904
// NewJSMirrorInvalidStreamNameError creates a new JSMirrorInvalidStreamName error: "mirrored stream name is invalid"
1905
func NewJSMirrorInvalidStreamNameError(opts ...ErrorOption) *ApiError {
×
1906
        eopts := parseOpts(opts)
×
1907
        if ae, ok := eopts.err.(*ApiError); ok {
×
1908
                return ae
×
1909
        }
×
1910

1911
        return ApiErrors[JSMirrorInvalidStreamName]
×
1912
}
1913

1914
// NewJSMirrorInvalidSubjectFilterError creates a new JSMirrorInvalidSubjectFilter error: "mirror transform source: {err}"
1915
func NewJSMirrorInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
2✔
1916
        eopts := parseOpts(opts)
2✔
1917
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1918
                return ae
×
1919
        }
×
1920

1921
        e := ApiErrors[JSMirrorInvalidSubjectFilter]
2✔
1922
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2✔
1923
        return &ApiError{
2✔
1924
                Code:        e.Code,
2✔
1925
                ErrCode:     e.ErrCode,
2✔
1926
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1927
        }
2✔
1928
}
1929

1930
// NewJSMirrorInvalidTransformDestinationError creates a new JSMirrorInvalidTransformDestination error: "mirror transform: {err}"
1931
func NewJSMirrorInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
2✔
1932
        eopts := parseOpts(opts)
2✔
1933
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1934
                return ae
×
1935
        }
×
1936

1937
        e := ApiErrors[JSMirrorInvalidTransformDestination]
2✔
1938
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2✔
1939
        return &ApiError{
2✔
1940
                Code:        e.Code,
2✔
1941
                ErrCode:     e.ErrCode,
2✔
1942
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1943
        }
2✔
1944
}
1945

1946
// NewJSMirrorMaxMessageSizeTooBigError creates a new JSMirrorMaxMessageSizeTooBigErr error: "stream mirror must have max message size >= source"
1947
func NewJSMirrorMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
1948
        eopts := parseOpts(opts)
×
1949
        if ae, ok := eopts.err.(*ApiError); ok {
×
1950
                return ae
×
1951
        }
×
1952

1953
        return ApiErrors[JSMirrorMaxMessageSizeTooBigErr]
×
1954
}
1955

1956
// NewJSMirrorMultipleFiltersNotAllowedError creates a new JSMirrorMultipleFiltersNotAllowed error: "mirror with multiple subject transforms cannot also have a single subject filter"
1957
func NewJSMirrorMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
1958
        eopts := parseOpts(opts)
1✔
1959
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1960
                return ae
×
1961
        }
×
1962

1963
        return ApiErrors[JSMirrorMultipleFiltersNotAllowed]
1✔
1964
}
1965

1966
// NewJSMirrorOverlappingSubjectFiltersError creates a new JSMirrorOverlappingSubjectFilters error: "mirror subject filters can not overlap"
1967
func NewJSMirrorOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
2✔
1968
        eopts := parseOpts(opts)
2✔
1969
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1970
                return ae
×
1971
        }
×
1972

1973
        return ApiErrors[JSMirrorOverlappingSubjectFilters]
2✔
1974
}
1975

1976
// NewJSMirrorWithCountersError creates a new JSMirrorWithCountersErr error: "stream mirrors can not also calculate counters"
1977
func NewJSMirrorWithCountersError(opts ...ErrorOption) *ApiError {
4✔
1978
        eopts := parseOpts(opts)
4✔
1979
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1980
                return ae
×
1981
        }
×
1982

1983
        return ApiErrors[JSMirrorWithCountersErr]
4✔
1984
}
1985

1986
// NewJSMirrorWithFirstSeqError creates a new JSMirrorWithFirstSeqErr error: "stream mirrors can not have first sequence configured"
1987
func NewJSMirrorWithFirstSeqError(opts ...ErrorOption) *ApiError {
2✔
1988
        eopts := parseOpts(opts)
2✔
1989
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1990
                return ae
×
1991
        }
×
1992

1993
        return ApiErrors[JSMirrorWithFirstSeqErr]
2✔
1994
}
1995

1996
// NewJSMirrorWithMsgSchedulesError creates a new JSMirrorWithMsgSchedulesErr error: "stream mirrors can not also schedule messages"
1997
func NewJSMirrorWithMsgSchedulesError(opts ...ErrorOption) *ApiError {
2✔
1998
        eopts := parseOpts(opts)
2✔
1999
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2000
                return ae
×
2001
        }
×
2002

2003
        return ApiErrors[JSMirrorWithMsgSchedulesErr]
2✔
2004
}
2005

2006
// NewJSMirrorWithSourcesError creates a new JSMirrorWithSourcesErr error: "stream mirrors can not also contain other sources"
2007
func NewJSMirrorWithSourcesError(opts ...ErrorOption) *ApiError {
×
2008
        eopts := parseOpts(opts)
×
2009
        if ae, ok := eopts.err.(*ApiError); ok {
×
2010
                return ae
×
2011
        }
×
2012

2013
        return ApiErrors[JSMirrorWithSourcesErr]
×
2014
}
2015

2016
// NewJSMirrorWithStartSeqAndTimeError creates a new JSMirrorWithStartSeqAndTimeErr error: "stream mirrors can not have both start seq and start time configured"
2017
func NewJSMirrorWithStartSeqAndTimeError(opts ...ErrorOption) *ApiError {
×
2018
        eopts := parseOpts(opts)
×
2019
        if ae, ok := eopts.err.(*ApiError); ok {
×
2020
                return ae
×
2021
        }
×
2022

2023
        return ApiErrors[JSMirrorWithStartSeqAndTimeErr]
×
2024
}
2025

2026
// NewJSMirrorWithSubjectFiltersError creates a new JSMirrorWithSubjectFiltersErr error: "stream mirrors can not contain filtered subjects"
2027
func NewJSMirrorWithSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
2028
        eopts := parseOpts(opts)
×
2029
        if ae, ok := eopts.err.(*ApiError); ok {
×
2030
                return ae
×
2031
        }
×
2032

2033
        return ApiErrors[JSMirrorWithSubjectFiltersErr]
×
2034
}
2035

2036
// NewJSMirrorWithSubjectsError creates a new JSMirrorWithSubjectsErr error: "stream mirrors can not contain subjects"
2037
func NewJSMirrorWithSubjectsError(opts ...ErrorOption) *ApiError {
2✔
2038
        eopts := parseOpts(opts)
2✔
2039
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2040
                return ae
×
2041
        }
×
2042

2043
        return ApiErrors[JSMirrorWithSubjectsErr]
2✔
2044
}
2045

2046
// NewJSNoAccountError creates a new JSNoAccountErr error: "account not found"
2047
func NewJSNoAccountError(opts ...ErrorOption) *ApiError {
1✔
2048
        eopts := parseOpts(opts)
1✔
2049
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2050
                return ae
×
2051
        }
×
2052

2053
        return ApiErrors[JSNoAccountErr]
1✔
2054
}
2055

2056
// NewJSNoLimitsError creates a new JSNoLimitsErr error: "no JetStream default or applicable tiered limit present"
2057
func NewJSNoLimitsError(opts ...ErrorOption) *ApiError {
4✔
2058
        eopts := parseOpts(opts)
4✔
2059
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2060
                return ae
×
2061
        }
×
2062

2063
        return ApiErrors[JSNoLimitsErr]
4✔
2064
}
2065

2066
// NewJSNoMessageFoundError creates a new JSNoMessageFoundErr error: "no message found"
2067
func NewJSNoMessageFoundError(opts ...ErrorOption) *ApiError {
465✔
2068
        eopts := parseOpts(opts)
465✔
2069
        if ae, ok := eopts.err.(*ApiError); ok {
465✔
2070
                return ae
×
2071
        }
×
2072

2073
        return ApiErrors[JSNoMessageFoundErr]
465✔
2074
}
2075

2076
// NewJSNotEmptyRequestError creates a new JSNotEmptyRequestErr error: "expected an empty request payload"
2077
func NewJSNotEmptyRequestError(opts ...ErrorOption) *ApiError {
3✔
2078
        eopts := parseOpts(opts)
3✔
2079
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2080
                return ae
×
2081
        }
×
2082

2083
        return ApiErrors[JSNotEmptyRequestErr]
3✔
2084
}
2085

2086
// NewJSNotEnabledError creates a new JSNotEnabledErr error: "JetStream not enabled"
2087
func NewJSNotEnabledError(opts ...ErrorOption) *ApiError {
10✔
2088
        eopts := parseOpts(opts)
10✔
2089
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2090
                return ae
×
2091
        }
×
2092

2093
        return ApiErrors[JSNotEnabledErr]
10✔
2094
}
2095

2096
// NewJSNotEnabledForAccountError creates a new JSNotEnabledForAccountErr error: "JetStream not enabled for account"
2097
func NewJSNotEnabledForAccountError(opts ...ErrorOption) *ApiError {
321✔
2098
        eopts := parseOpts(opts)
321✔
2099
        if ae, ok := eopts.err.(*ApiError); ok {
321✔
2100
                return ae
×
2101
        }
×
2102

2103
        return ApiErrors[JSNotEnabledForAccountErr]
321✔
2104
}
2105

2106
// NewJSPedanticError creates a new JSPedanticErrF error: "pedantic mode: {err}"
2107
func NewJSPedanticError(err error, opts ...ErrorOption) *ApiError {
36✔
2108
        eopts := parseOpts(opts)
36✔
2109
        if ae, ok := eopts.err.(*ApiError); ok {
36✔
2110
                return ae
×
2111
        }
×
2112

2113
        e := ApiErrors[JSPedanticErrF]
36✔
2114
        args := e.toReplacerArgs([]interface{}{"{err}", err})
36✔
2115
        return &ApiError{
36✔
2116
                Code:        e.Code,
36✔
2117
                ErrCode:     e.ErrCode,
36✔
2118
                Description: strings.NewReplacer(args...).Replace(e.Description),
36✔
2119
        }
36✔
2120
}
2121

2122
// NewJSPeerRemapError creates a new JSPeerRemapErr error: "peer remap failed"
2123
func NewJSPeerRemapError(opts ...ErrorOption) *ApiError {
5✔
2124
        eopts := parseOpts(opts)
5✔
2125
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2126
                return ae
1✔
2127
        }
1✔
2128

2129
        return ApiErrors[JSPeerRemapErr]
4✔
2130
}
2131

2132
// NewJSRaftGeneralError creates a new JSRaftGeneralErrF error: "{err}"
2133
func NewJSRaftGeneralError(err error, opts ...ErrorOption) *ApiError {
×
2134
        eopts := parseOpts(opts)
×
2135
        if ae, ok := eopts.err.(*ApiError); ok {
×
2136
                return ae
×
2137
        }
×
2138

2139
        e := ApiErrors[JSRaftGeneralErrF]
×
2140
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2141
        return &ApiError{
×
2142
                Code:        e.Code,
×
2143
                ErrCode:     e.ErrCode,
×
2144
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2145
        }
×
2146
}
2147

2148
// NewJSReplicasCountCannotBeNegativeError creates a new JSReplicasCountCannotBeNegative error: "replicas count cannot be negative"
2149
func NewJSReplicasCountCannotBeNegativeError(opts ...ErrorOption) *ApiError {
16✔
2150
        eopts := parseOpts(opts)
16✔
2151
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2152
                return ae
×
2153
        }
×
2154

2155
        return ApiErrors[JSReplicasCountCannotBeNegative]
16✔
2156
}
2157

2158
// NewJSRequiredApiLevelError creates a new JSRequiredApiLevelErr error: "JetStream minimum api level required"
2159
func NewJSRequiredApiLevelError(opts ...ErrorOption) *ApiError {
56✔
2160
        eopts := parseOpts(opts)
56✔
2161
        if ae, ok := eopts.err.(*ApiError); ok {
56✔
2162
                return ae
×
2163
        }
×
2164

2165
        return ApiErrors[JSRequiredApiLevelErr]
56✔
2166
}
2167

2168
// NewJSRestoreSubscribeFailedError creates a new JSRestoreSubscribeFailedErrF error: "JetStream unable to subscribe to restore snapshot {subject}: {err}"
2169
func NewJSRestoreSubscribeFailedError(err error, subject interface{}, opts ...ErrorOption) *ApiError {
1✔
2170
        eopts := parseOpts(opts)
1✔
2171
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2172
                return ae
×
2173
        }
×
2174

2175
        e := ApiErrors[JSRestoreSubscribeFailedErrF]
1✔
2176
        args := e.toReplacerArgs([]interface{}{"{err}", err, "{subject}", subject})
1✔
2177
        return &ApiError{
1✔
2178
                Code:        e.Code,
1✔
2179
                ErrCode:     e.ErrCode,
1✔
2180
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2181
        }
1✔
2182
}
2183

2184
// NewJSSequenceNotFoundError creates a new JSSequenceNotFoundErrF error: "sequence {seq} not found"
2185
func NewJSSequenceNotFoundError(seq uint64, opts ...ErrorOption) *ApiError {
×
2186
        eopts := parseOpts(opts)
×
2187
        if ae, ok := eopts.err.(*ApiError); ok {
×
2188
                return ae
×
2189
        }
×
2190

2191
        e := ApiErrors[JSSequenceNotFoundErrF]
×
2192
        args := e.toReplacerArgs([]interface{}{"{seq}", seq})
×
2193
        return &ApiError{
×
2194
                Code:        e.Code,
×
2195
                ErrCode:     e.ErrCode,
×
2196
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2197
        }
×
2198
}
2199

2200
// NewJSSnapshotDeliverSubjectInvalidError creates a new JSSnapshotDeliverSubjectInvalidErr error: "deliver subject not valid"
2201
func NewJSSnapshotDeliverSubjectInvalidError(opts ...ErrorOption) *ApiError {
1✔
2202
        eopts := parseOpts(opts)
1✔
2203
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2204
                return ae
×
2205
        }
×
2206

2207
        return ApiErrors[JSSnapshotDeliverSubjectInvalidErr]
1✔
2208
}
2209

2210
// NewJSSourceConsumerSetupFailedError creates a new JSSourceConsumerSetupFailedErrF error: "{err}"
2211
func NewJSSourceConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
2212
        eopts := parseOpts(opts)
×
2213
        if ae, ok := eopts.err.(*ApiError); ok {
×
2214
                return ae
×
2215
        }
×
2216

2217
        e := ApiErrors[JSSourceConsumerSetupFailedErrF]
×
2218
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2219
        return &ApiError{
×
2220
                Code:        e.Code,
×
2221
                ErrCode:     e.ErrCode,
×
2222
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2223
        }
×
2224
}
2225

2226
// NewJSSourceDuplicateDetectedError creates a new JSSourceDuplicateDetected error: "duplicate source configuration detected"
2227
func NewJSSourceDuplicateDetectedError(opts ...ErrorOption) *ApiError {
×
2228
        eopts := parseOpts(opts)
×
2229
        if ae, ok := eopts.err.(*ApiError); ok {
×
2230
                return ae
×
2231
        }
×
2232

2233
        return ApiErrors[JSSourceDuplicateDetected]
×
2234
}
2235

2236
// NewJSSourceInvalidStreamNameError creates a new JSSourceInvalidStreamName error: "sourced stream name is invalid"
2237
func NewJSSourceInvalidStreamNameError(opts ...ErrorOption) *ApiError {
1✔
2238
        eopts := parseOpts(opts)
1✔
2239
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2240
                return ae
×
2241
        }
×
2242

2243
        return ApiErrors[JSSourceInvalidStreamName]
1✔
2244
}
2245

2246
// NewJSSourceInvalidSubjectFilterError creates a new JSSourceInvalidSubjectFilter error: "source transform source: {err}"
2247
func NewJSSourceInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
1✔
2248
        eopts := parseOpts(opts)
1✔
2249
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2250
                return ae
×
2251
        }
×
2252

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

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

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

2278
// NewJSSourceMaxMessageSizeTooBigError creates a new JSSourceMaxMessageSizeTooBigErr error: "stream source must have max message size >= target"
2279
func NewJSSourceMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
2280
        eopts := parseOpts(opts)
×
2281
        if ae, ok := eopts.err.(*ApiError); ok {
×
2282
                return ae
×
2283
        }
×
2284

2285
        return ApiErrors[JSSourceMaxMessageSizeTooBigErr]
×
2286
}
2287

2288
// NewJSSourceMultipleFiltersNotAllowedError creates a new JSSourceMultipleFiltersNotAllowed error: "source with multiple subject transforms cannot also have a single subject filter"
2289
func NewJSSourceMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
×
2290
        eopts := parseOpts(opts)
×
2291
        if ae, ok := eopts.err.(*ApiError); ok {
×
2292
                return ae
×
2293
        }
×
2294

2295
        return ApiErrors[JSSourceMultipleFiltersNotAllowed]
×
2296
}
2297

2298
// NewJSSourceOverlappingSubjectFiltersError creates a new JSSourceOverlappingSubjectFilters error: "source filters can not overlap"
2299
func NewJSSourceOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
2300
        eopts := parseOpts(opts)
×
2301
        if ae, ok := eopts.err.(*ApiError); ok {
×
2302
                return ae
×
2303
        }
×
2304

2305
        return ApiErrors[JSSourceOverlappingSubjectFilters]
×
2306
}
2307

2308
// NewJSSourceWithMsgSchedulesError creates a new JSSourceWithMsgSchedulesErr error: "stream source can not also schedule messages"
2309
func NewJSSourceWithMsgSchedulesError(opts ...ErrorOption) *ApiError {
2✔
2310
        eopts := parseOpts(opts)
2✔
2311
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2312
                return ae
×
2313
        }
×
2314

2315
        return ApiErrors[JSSourceWithMsgSchedulesErr]
2✔
2316
}
2317

2318
// NewJSStorageResourcesExceededError creates a new JSStorageResourcesExceededErr error: "insufficient storage resources available"
2319
func NewJSStorageResourcesExceededError(opts ...ErrorOption) *ApiError {
25✔
2320
        eopts := parseOpts(opts)
25✔
2321
        if ae, ok := eopts.err.(*ApiError); ok {
25✔
2322
                return ae
×
2323
        }
×
2324

2325
        return ApiErrors[JSStorageResourcesExceededErr]
25✔
2326
}
2327

2328
// NewJSStreamAssignmentError creates a new JSStreamAssignmentErrF error: "{err}"
2329
func NewJSStreamAssignmentError(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[JSStreamAssignmentErrF]
×
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
// NewJSStreamCreateError creates a new JSStreamCreateErrF error: "{err}"
2345
func NewJSStreamCreateError(err error, opts ...ErrorOption) *ApiError {
80✔
2346
        eopts := parseOpts(opts)
80✔
2347
        if ae, ok := eopts.err.(*ApiError); ok {
160✔
2348
                return ae
80✔
2349
        }
80✔
2350

2351
        e := ApiErrors[JSStreamCreateErrF]
×
2352
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2353
        return &ApiError{
×
2354
                Code:        e.Code,
×
2355
                ErrCode:     e.ErrCode,
×
2356
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2357
        }
×
2358
}
2359

2360
// NewJSStreamDeleteError creates a new JSStreamDeleteErrF error: "{err}"
2361
func NewJSStreamDeleteError(err error, opts ...ErrorOption) *ApiError {
×
2362
        eopts := parseOpts(opts)
×
2363
        if ae, ok := eopts.err.(*ApiError); ok {
×
2364
                return ae
×
2365
        }
×
2366

2367
        e := ApiErrors[JSStreamDeleteErrF]
×
2368
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2369
        return &ApiError{
×
2370
                Code:        e.Code,
×
2371
                ErrCode:     e.ErrCode,
×
2372
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2373
        }
×
2374
}
2375

2376
// NewJSStreamDuplicateMessageConflictError creates a new JSStreamDuplicateMessageConflict error: "duplicate message id is in process"
2377
func NewJSStreamDuplicateMessageConflictError(opts ...ErrorOption) *ApiError {
12✔
2378
        eopts := parseOpts(opts)
12✔
2379
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
2380
                return ae
×
2381
        }
×
2382

2383
        return ApiErrors[JSStreamDuplicateMessageConflict]
12✔
2384
}
2385

2386
// NewJSStreamExpectedLastSeqPerSubjectNotReadyError creates a new JSStreamExpectedLastSeqPerSubjectNotReady error: "expected last sequence per subject temporarily unavailable"
2387
func NewJSStreamExpectedLastSeqPerSubjectNotReadyError(opts ...ErrorOption) *ApiError {
×
2388
        eopts := parseOpts(opts)
×
2389
        if ae, ok := eopts.err.(*ApiError); ok {
×
2390
                return ae
×
2391
        }
×
2392

2393
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectNotReady]
×
2394
}
2395

2396
// NewJSStreamExternalApiOverlapError creates a new JSStreamExternalApiOverlapErrF error: "stream external api prefix {prefix} must not overlap with {subject}"
2397
func NewJSStreamExternalApiOverlapError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
2✔
2398
        eopts := parseOpts(opts)
2✔
2399
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2400
                return ae
×
2401
        }
×
2402

2403
        e := ApiErrors[JSStreamExternalApiOverlapErrF]
2✔
2404
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
2✔
2405
        return &ApiError{
2✔
2406
                Code:        e.Code,
2✔
2407
                ErrCode:     e.ErrCode,
2✔
2408
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2409
        }
2✔
2410
}
2411

2412
// NewJSStreamExternalDelPrefixOverlapsError creates a new JSStreamExternalDelPrefixOverlapsErrF error: "stream external delivery prefix {prefix} overlaps with stream subject {subject}"
2413
func NewJSStreamExternalDelPrefixOverlapsError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
×
2414
        eopts := parseOpts(opts)
×
2415
        if ae, ok := eopts.err.(*ApiError); ok {
×
2416
                return ae
×
2417
        }
×
2418

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

2428
// NewJSStreamGeneralError creates a new JSStreamGeneralErrorF error: "{err}"
2429
func NewJSStreamGeneralError(err error, opts ...ErrorOption) *ApiError {
3✔
2430
        eopts := parseOpts(opts)
3✔
2431
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2432
                return ae
×
2433
        }
×
2434

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

2444
// NewJSStreamHeaderExceedsMaximumError creates a new JSStreamHeaderExceedsMaximumErr error: "header size exceeds maximum allowed of 64k"
2445
func NewJSStreamHeaderExceedsMaximumError(opts ...ErrorOption) *ApiError {
1✔
2446
        eopts := parseOpts(opts)
1✔
2447
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2448
                return ae
×
2449
        }
×
2450

2451
        return ApiErrors[JSStreamHeaderExceedsMaximumErr]
1✔
2452
}
2453

2454
// NewJSStreamInfoMaxSubjectsError creates a new JSStreamInfoMaxSubjectsErr error: "subject details would exceed maximum allowed"
2455
func NewJSStreamInfoMaxSubjectsError(opts ...ErrorOption) *ApiError {
×
2456
        eopts := parseOpts(opts)
×
2457
        if ae, ok := eopts.err.(*ApiError); ok {
×
2458
                return ae
×
2459
        }
×
2460

2461
        return ApiErrors[JSStreamInfoMaxSubjectsErr]
×
2462
}
2463

2464
// NewJSStreamInvalidConfigError creates a new JSStreamInvalidConfigF error: "{err}"
2465
func NewJSStreamInvalidConfigError(err error, opts ...ErrorOption) *ApiError {
148✔
2466
        eopts := parseOpts(opts)
148✔
2467
        if ae, ok := eopts.err.(*ApiError); ok {
170✔
2468
                return ae
22✔
2469
        }
22✔
2470

2471
        e := ApiErrors[JSStreamInvalidConfigF]
126✔
2472
        args := e.toReplacerArgs([]interface{}{"{err}", err})
126✔
2473
        return &ApiError{
126✔
2474
                Code:        e.Code,
126✔
2475
                ErrCode:     e.ErrCode,
126✔
2476
                Description: strings.NewReplacer(args...).Replace(e.Description),
126✔
2477
        }
126✔
2478
}
2479

2480
// NewJSStreamInvalidError creates a new JSStreamInvalidErr error: "stream not valid"
2481
func NewJSStreamInvalidError(opts ...ErrorOption) *ApiError {
×
2482
        eopts := parseOpts(opts)
×
2483
        if ae, ok := eopts.err.(*ApiError); ok {
×
2484
                return ae
×
2485
        }
×
2486

2487
        return ApiErrors[JSStreamInvalidErr]
×
2488
}
2489

2490
// NewJSStreamInvalidExternalDeliverySubjError creates a new JSStreamInvalidExternalDeliverySubjErrF error: "stream external delivery prefix {prefix} must not contain wildcards"
2491
func NewJSStreamInvalidExternalDeliverySubjError(prefix interface{}, opts ...ErrorOption) *ApiError {
×
2492
        eopts := parseOpts(opts)
×
2493
        if ae, ok := eopts.err.(*ApiError); ok {
×
2494
                return ae
×
2495
        }
×
2496

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

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

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

2522
// NewJSStreamMaxBytesRequiredError creates a new JSStreamMaxBytesRequired error: "account requires a stream config to have max bytes set"
2523
func NewJSStreamMaxBytesRequiredError(opts ...ErrorOption) *ApiError {
3✔
2524
        eopts := parseOpts(opts)
3✔
2525
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2526
                return ae
×
2527
        }
×
2528

2529
        return ApiErrors[JSStreamMaxBytesRequired]
3✔
2530
}
2531

2532
// NewJSStreamMaxStreamBytesExceededError creates a new JSStreamMaxStreamBytesExceeded error: "stream max bytes exceeds account limit max stream bytes"
2533
func NewJSStreamMaxStreamBytesExceededError(opts ...ErrorOption) *ApiError {
2✔
2534
        eopts := parseOpts(opts)
2✔
2535
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2536
                return ae
×
2537
        }
×
2538

2539
        return ApiErrors[JSStreamMaxStreamBytesExceeded]
2✔
2540
}
2541

2542
// NewJSStreamMessageExceedsMaximumError creates a new JSStreamMessageExceedsMaximumErr error: "message size exceeds maximum allowed"
2543
func NewJSStreamMessageExceedsMaximumError(opts ...ErrorOption) *ApiError {
19✔
2544
        eopts := parseOpts(opts)
19✔
2545
        if ae, ok := eopts.err.(*ApiError); ok {
19✔
2546
                return ae
×
2547
        }
×
2548

2549
        return ApiErrors[JSStreamMessageExceedsMaximumErr]
19✔
2550
}
2551

2552
// NewJSStreamMinLastSeqError creates a new JSStreamMinLastSeqErr error: "min last sequence"
2553
func NewJSStreamMinLastSeqError(opts ...ErrorOption) *ApiError {
×
2554
        eopts := parseOpts(opts)
×
2555
        if ae, ok := eopts.err.(*ApiError); ok {
×
2556
                return ae
×
2557
        }
×
2558

2559
        return ApiErrors[JSStreamMinLastSeqErr]
×
2560
}
2561

2562
// NewJSStreamMirrorNotUpdatableError creates a new JSStreamMirrorNotUpdatableErr error: "stream mirror configuration can not be updated"
2563
func NewJSStreamMirrorNotUpdatableError(opts ...ErrorOption) *ApiError {
2✔
2564
        eopts := parseOpts(opts)
2✔
2565
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2566
                return ae
×
2567
        }
×
2568

2569
        return ApiErrors[JSStreamMirrorNotUpdatableErr]
2✔
2570
}
2571

2572
// NewJSStreamMismatchError creates a new JSStreamMismatchErr error: "stream name in subject does not match request"
2573
func NewJSStreamMismatchError(opts ...ErrorOption) *ApiError {
3✔
2574
        eopts := parseOpts(opts)
3✔
2575
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2576
                return ae
×
2577
        }
×
2578

2579
        return ApiErrors[JSStreamMismatchErr]
3✔
2580
}
2581

2582
// NewJSStreamMoveAndScaleError creates a new JSStreamMoveAndScaleErr error: "can not move and scale a stream in a single update"
2583
func NewJSStreamMoveAndScaleError(opts ...ErrorOption) *ApiError {
4✔
2584
        eopts := parseOpts(opts)
4✔
2585
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2586
                return ae
×
2587
        }
×
2588

2589
        return ApiErrors[JSStreamMoveAndScaleErr]
4✔
2590
}
2591

2592
// NewJSStreamMoveInProgressError creates a new JSStreamMoveInProgressF error: "stream move already in progress: {msg}"
2593
func NewJSStreamMoveInProgressError(msg interface{}, opts ...ErrorOption) *ApiError {
2✔
2594
        eopts := parseOpts(opts)
2✔
2595
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2596
                return ae
×
2597
        }
×
2598

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

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

2615
        return ApiErrors[JSStreamMoveNotInProgress]
×
2616
}
2617

2618
// NewJSStreamMsgDeleteFailedError creates a new JSStreamMsgDeleteFailedF error: "{err}"
2619
func NewJSStreamMsgDeleteFailedError(err error, opts ...ErrorOption) *ApiError {
1✔
2620
        eopts := parseOpts(opts)
1✔
2621
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2622
                return ae
×
2623
        }
×
2624

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

2634
// NewJSStreamNameContainsPathSeparatorsError creates a new JSStreamNameContainsPathSeparatorsErr error: "Stream name can not contain path separators"
2635
func NewJSStreamNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
6✔
2636
        eopts := parseOpts(opts)
6✔
2637
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2638
                return ae
×
2639
        }
×
2640

2641
        return ApiErrors[JSStreamNameContainsPathSeparatorsErr]
6✔
2642
}
2643

2644
// NewJSStreamNameExistError creates a new JSStreamNameExistErr error: "stream name already in use with a different configuration"
2645
func NewJSStreamNameExistError(opts ...ErrorOption) *ApiError {
×
2646
        eopts := parseOpts(opts)
×
2647
        if ae, ok := eopts.err.(*ApiError); ok {
×
2648
                return ae
×
2649
        }
×
2650

2651
        return ApiErrors[JSStreamNameExistErr]
×
2652
}
2653

2654
// NewJSStreamNameExistRestoreFailedError creates a new JSStreamNameExistRestoreFailedErr error: "stream name already in use, cannot restore"
2655
func NewJSStreamNameExistRestoreFailedError(opts ...ErrorOption) *ApiError {
3✔
2656
        eopts := parseOpts(opts)
3✔
2657
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2658
                return ae
×
2659
        }
×
2660

2661
        return ApiErrors[JSStreamNameExistRestoreFailedErr]
3✔
2662
}
2663

2664
// NewJSStreamNotFoundError creates a new JSStreamNotFoundErr error: "stream not found"
2665
func NewJSStreamNotFoundError(opts ...ErrorOption) *ApiError {
25,272✔
2666
        eopts := parseOpts(opts)
25,272✔
2667
        if ae, ok := eopts.err.(*ApiError); ok {
25,938✔
2668
                return ae
666✔
2669
        }
666✔
2670

2671
        return ApiErrors[JSStreamNotFoundErr]
24,606✔
2672
}
2673

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

2681
        return ApiErrors[JSStreamNotMatchErr]
5✔
2682
}
2683

2684
// NewJSStreamOfflineError creates a new JSStreamOfflineErr error: "stream is offline"
2685
func NewJSStreamOfflineError(opts ...ErrorOption) *ApiError {
6✔
2686
        eopts := parseOpts(opts)
6✔
2687
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2688
                return ae
×
2689
        }
×
2690

2691
        return ApiErrors[JSStreamOfflineErr]
6✔
2692
}
2693

2694
// NewJSStreamPurgeFailedError creates a new JSStreamPurgeFailedF error: "{err}"
2695
func NewJSStreamPurgeFailedError(err error, opts ...ErrorOption) *ApiError {
1✔
2696
        eopts := parseOpts(opts)
1✔
2697
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2698
                return ae
×
2699
        }
×
2700

2701
        e := ApiErrors[JSStreamPurgeFailedF]
1✔
2702
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2703
        return &ApiError{
1✔
2704
                Code:        e.Code,
1✔
2705
                ErrCode:     e.ErrCode,
1✔
2706
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2707
        }
1✔
2708
}
2709

2710
// NewJSStreamReplicasNotSupportedError creates a new JSStreamReplicasNotSupportedErr error: "replicas > 1 not supported in non-clustered mode"
2711
func NewJSStreamReplicasNotSupportedError(opts ...ErrorOption) *ApiError {
1✔
2712
        eopts := parseOpts(opts)
1✔
2713
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2714
                return ae
×
2715
        }
×
2716

2717
        return ApiErrors[JSStreamReplicasNotSupportedErr]
1✔
2718
}
2719

2720
// NewJSStreamReplicasNotUpdatableError creates a new JSStreamReplicasNotUpdatableErr error: "Replicas configuration can not be updated"
2721
func NewJSStreamReplicasNotUpdatableError(opts ...ErrorOption) *ApiError {
×
2722
        eopts := parseOpts(opts)
×
2723
        if ae, ok := eopts.err.(*ApiError); ok {
×
2724
                return ae
×
2725
        }
×
2726

2727
        return ApiErrors[JSStreamReplicasNotUpdatableErr]
×
2728
}
2729

2730
// NewJSStreamRestoreError creates a new JSStreamRestoreErrF error: "restore failed: {err}"
2731
func NewJSStreamRestoreError(err error, opts ...ErrorOption) *ApiError {
7✔
2732
        eopts := parseOpts(opts)
7✔
2733
        if ae, ok := eopts.err.(*ApiError); ok {
9✔
2734
                return ae
2✔
2735
        }
2✔
2736

2737
        e := ApiErrors[JSStreamRestoreErrF]
5✔
2738
        args := e.toReplacerArgs([]interface{}{"{err}", err})
5✔
2739
        return &ApiError{
5✔
2740
                Code:        e.Code,
5✔
2741
                ErrCode:     e.ErrCode,
5✔
2742
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
2743
        }
5✔
2744
}
2745

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

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

2762
// NewJSStreamSealedError creates a new JSStreamSealedErr error: "invalid operation on sealed stream"
2763
func NewJSStreamSealedError(opts ...ErrorOption) *ApiError {
10✔
2764
        eopts := parseOpts(opts)
10✔
2765
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2766
                return ae
×
2767
        }
×
2768

2769
        return ApiErrors[JSStreamSealedErr]
10✔
2770
}
2771

2772
// NewJSStreamSequenceNotMatchError creates a new JSStreamSequenceNotMatchErr error: "expected stream sequence does not match"
2773
func NewJSStreamSequenceNotMatchError(opts ...ErrorOption) *ApiError {
×
2774
        eopts := parseOpts(opts)
×
2775
        if ae, ok := eopts.err.(*ApiError); ok {
×
2776
                return ae
×
2777
        }
×
2778

2779
        return ApiErrors[JSStreamSequenceNotMatchErr]
×
2780
}
2781

2782
// NewJSStreamSnapshotError creates a new JSStreamSnapshotErrF error: "snapshot failed: {err}"
2783
func NewJSStreamSnapshotError(err error, opts ...ErrorOption) *ApiError {
×
2784
        eopts := parseOpts(opts)
×
2785
        if ae, ok := eopts.err.(*ApiError); ok {
×
2786
                return ae
×
2787
        }
×
2788

2789
        e := ApiErrors[JSStreamSnapshotErrF]
×
2790
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2791
        return &ApiError{
×
2792
                Code:        e.Code,
×
2793
                ErrCode:     e.ErrCode,
×
2794
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2795
        }
×
2796
}
2797

2798
// NewJSStreamStoreFailedError creates a new JSStreamStoreFailedF error: "{err}"
2799
func NewJSStreamStoreFailedError(err error, opts ...ErrorOption) *ApiError {
2,487✔
2800
        eopts := parseOpts(opts)
2,487✔
2801
        if ae, ok := eopts.err.(*ApiError); ok {
2,487✔
2802
                return ae
×
2803
        }
×
2804

2805
        e := ApiErrors[JSStreamStoreFailedF]
2,487✔
2806
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2,487✔
2807
        return &ApiError{
2,487✔
2808
                Code:        e.Code,
2,487✔
2809
                ErrCode:     e.ErrCode,
2,487✔
2810
                Description: strings.NewReplacer(args...).Replace(e.Description),
2,487✔
2811
        }
2,487✔
2812
}
2813

2814
// NewJSStreamSubjectOverlapError creates a new JSStreamSubjectOverlapErr error: "subjects overlap with an existing stream"
2815
func NewJSStreamSubjectOverlapError(opts ...ErrorOption) *ApiError {
43✔
2816
        eopts := parseOpts(opts)
43✔
2817
        if ae, ok := eopts.err.(*ApiError); ok {
43✔
2818
                return ae
×
2819
        }
×
2820

2821
        return ApiErrors[JSStreamSubjectOverlapErr]
43✔
2822
}
2823

2824
// NewJSStreamTemplateCreateError creates a new JSStreamTemplateCreateErrF error: "{err}"
2825
func NewJSStreamTemplateCreateError(err error, opts ...ErrorOption) *ApiError {
×
2826
        eopts := parseOpts(opts)
×
2827
        if ae, ok := eopts.err.(*ApiError); ok {
×
2828
                return ae
×
2829
        }
×
2830

2831
        e := ApiErrors[JSStreamTemplateCreateErrF]
×
2832
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2833
        return &ApiError{
×
2834
                Code:        e.Code,
×
2835
                ErrCode:     e.ErrCode,
×
2836
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2837
        }
×
2838
}
2839

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

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

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

2863
        return ApiErrors[JSStreamTemplateNotFoundErr]
4✔
2864
}
2865

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

2873
        return ApiErrors[JSStreamTooManyRequests]
184✔
2874
}
2875

2876
// NewJSStreamTransformInvalidDestinationError creates a new JSStreamTransformInvalidDestination error: "stream transform: {err}"
2877
func NewJSStreamTransformInvalidDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
2878
        eopts := parseOpts(opts)
1✔
2879
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2880
                return ae
×
2881
        }
×
2882

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

2892
// NewJSStreamTransformInvalidSourceError creates a new JSStreamTransformInvalidSource error: "stream transform source: {err}"
2893
func NewJSStreamTransformInvalidSourceError(err error, opts ...ErrorOption) *ApiError {
1✔
2894
        eopts := parseOpts(opts)
1✔
2895
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2896
                return ae
×
2897
        }
×
2898

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

2908
// NewJSStreamUpdateError creates a new JSStreamUpdateErrF error: "{err}"
2909
func NewJSStreamUpdateError(err error, opts ...ErrorOption) *ApiError {
24✔
2910
        eopts := parseOpts(opts)
24✔
2911
        if ae, ok := eopts.err.(*ApiError); ok {
42✔
2912
                return ae
18✔
2913
        }
18✔
2914

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

2924
// NewJSStreamWrongLastMsgIDError creates a new JSStreamWrongLastMsgIDErrF error: "wrong last msg ID: {id}"
2925
func NewJSStreamWrongLastMsgIDError(id interface{}, opts ...ErrorOption) *ApiError {
5✔
2926
        eopts := parseOpts(opts)
5✔
2927
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2928
                return ae
×
2929
        }
×
2930

2931
        e := ApiErrors[JSStreamWrongLastMsgIDErrF]
5✔
2932
        args := e.toReplacerArgs([]interface{}{"{id}", id})
5✔
2933
        return &ApiError{
5✔
2934
                Code:        e.Code,
5✔
2935
                ErrCode:     e.ErrCode,
5✔
2936
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
2937
        }
5✔
2938
}
2939

2940
// NewJSStreamWrongLastSequenceConstantError creates a new JSStreamWrongLastSequenceConstantErr error: "wrong last sequence"
2941
func NewJSStreamWrongLastSequenceConstantError(opts ...ErrorOption) *ApiError {
24✔
2942
        eopts := parseOpts(opts)
24✔
2943
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
2944
                return ae
×
2945
        }
×
2946

2947
        return ApiErrors[JSStreamWrongLastSequenceConstantErr]
24✔
2948
}
2949

2950
// NewJSStreamWrongLastSequenceError creates a new JSStreamWrongLastSequenceErrF error: "wrong last sequence: {seq}"
2951
func NewJSStreamWrongLastSequenceError(seq uint64, opts ...ErrorOption) *ApiError {
60✔
2952
        eopts := parseOpts(opts)
60✔
2953
        if ae, ok := eopts.err.(*ApiError); ok {
60✔
2954
                return ae
×
2955
        }
×
2956

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

2966
// NewJSTempStorageFailedError creates a new JSTempStorageFailedErr error: "JetStream unable to open temp storage for restore"
2967
func NewJSTempStorageFailedError(opts ...ErrorOption) *ApiError {
×
2968
        eopts := parseOpts(opts)
×
2969
        if ae, ok := eopts.err.(*ApiError); ok {
×
2970
                return ae
×
2971
        }
×
2972

2973
        return ApiErrors[JSTempStorageFailedErr]
×
2974
}
2975

2976
// NewJSTemplateNameNotMatchSubjectError creates a new JSTemplateNameNotMatchSubjectErr error: "template name in subject does not match request"
2977
func NewJSTemplateNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
1✔
2978
        eopts := parseOpts(opts)
1✔
2979
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2980
                return ae
×
2981
        }
×
2982

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