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

nats-io / nats-server / 12730529914

10 Jan 2025 10:21PM UTC coverage: 85.521% (-0.08%) from 85.604%
12730529914

push

github

web-flow
Test: expected a fully formed cluster error (#6364)

Cluster tests would sometimes fail with the following error message:
```
jetstream_helpers_test.go:774: Expected a fully formed cluster, only 0 of 3 peers seen
```

This was due to a logic error in the tests, where it was assumed that
once a meta leader is chosen it will remain the same. That's not always
true as the meta leader can still shift around. So, keep fetching the
latest leader and check the peers on that.

Previously it would fail by selecting a meta leader, the meta leader
would change, and the follower would then be used to request peers on.
But because of the following lines in `JetStreamClusterPeers()`:
```go
	cc := js.cluster
	if !cc.isLeader() || cc.meta == nil {
		return nil
	}
```
You'd get no peers at all, leading into that error message.

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

68601 of 80215 relevant lines covered (85.52%)

946577.03 hits per line

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

52.23
/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
        // JSBadRequestErr bad request
12
        JSBadRequestErr ErrorIdentifier = 10003
13

14
        // JSClusterIncompleteErr incomplete results
15
        JSClusterIncompleteErr ErrorIdentifier = 10004
16

17
        // JSClusterNoPeersErrF Error causing no peers to be available ({err})
18
        JSClusterNoPeersErrF ErrorIdentifier = 10005
19

20
        // JSClusterNotActiveErr JetStream not in clustered mode
21
        JSClusterNotActiveErr ErrorIdentifier = 10006
22

23
        // JSClusterNotAssignedErr JetStream cluster not assigned to this server
24
        JSClusterNotAssignedErr ErrorIdentifier = 10007
25

26
        // JSClusterNotAvailErr JetStream system temporarily unavailable
27
        JSClusterNotAvailErr ErrorIdentifier = 10008
28

29
        // JSClusterNotLeaderErr JetStream cluster can not handle request
30
        JSClusterNotLeaderErr ErrorIdentifier = 10009
31

32
        // JSClusterPeerNotMemberErr peer not a member
33
        JSClusterPeerNotMemberErr ErrorIdentifier = 10040
34

35
        // JSClusterRequiredErr JetStream clustering support required
36
        JSClusterRequiredErr ErrorIdentifier = 10010
37

38
        // JSClusterServerNotMemberErr server is not a member of the cluster
39
        JSClusterServerNotMemberErr ErrorIdentifier = 10044
40

41
        // JSClusterTagsErr tags placement not supported for operation
42
        JSClusterTagsErr ErrorIdentifier = 10011
43

44
        // JSClusterUnSupportFeatureErr not currently supported in clustered mode
45
        JSClusterUnSupportFeatureErr ErrorIdentifier = 10036
46

47
        // JSConsumerAlreadyExists action CREATE is used for a existing consumer with a different config (consumer already exists)
48
        JSConsumerAlreadyExists ErrorIdentifier = 10148
49

50
        // JSConsumerBadDurableNameErr durable name can not contain '.', '*', '>'
51
        JSConsumerBadDurableNameErr ErrorIdentifier = 10103
52

53
        // JSConsumerConfigRequiredErr consumer config required
54
        JSConsumerConfigRequiredErr ErrorIdentifier = 10078
55

56
        // JSConsumerCreateDurableAndNameMismatch Consumer Durable and Name have to be equal if both are provided
57
        JSConsumerCreateDurableAndNameMismatch ErrorIdentifier = 10132
58

59
        // JSConsumerCreateErrF General consumer creation failure string ({err})
60
        JSConsumerCreateErrF ErrorIdentifier = 10012
61

62
        // JSConsumerCreateFilterSubjectMismatchErr Consumer create request did not match filtered subject from create subject
63
        JSConsumerCreateFilterSubjectMismatchErr ErrorIdentifier = 10131
64

65
        // JSConsumerDeliverCycleErr consumer deliver subject forms a cycle
66
        JSConsumerDeliverCycleErr ErrorIdentifier = 10081
67

68
        // JSConsumerDeliverToWildcardsErr consumer deliver subject has wildcards
69
        JSConsumerDeliverToWildcardsErr ErrorIdentifier = 10079
70

71
        // JSConsumerDescriptionTooLongErrF consumer description is too long, maximum allowed is {max}
72
        JSConsumerDescriptionTooLongErrF ErrorIdentifier = 10107
73

74
        // JSConsumerDirectRequiresEphemeralErr consumer direct requires an ephemeral consumer
75
        JSConsumerDirectRequiresEphemeralErr ErrorIdentifier = 10091
76

77
        // JSConsumerDirectRequiresPushErr consumer direct requires a push based consumer
78
        JSConsumerDirectRequiresPushErr ErrorIdentifier = 10090
79

80
        // JSConsumerDoesNotExist action UPDATE is used for a nonexisting consumer (consumer does not exist)
81
        JSConsumerDoesNotExist ErrorIdentifier = 10149
82

83
        // JSConsumerDuplicateFilterSubjects consumer cannot have both FilterSubject and FilterSubjects specified
84
        JSConsumerDuplicateFilterSubjects ErrorIdentifier = 10136
85

86
        // JSConsumerDurableNameNotInSubjectErr consumer expected to be durable but no durable name set in subject
87
        JSConsumerDurableNameNotInSubjectErr ErrorIdentifier = 10016
88

89
        // JSConsumerDurableNameNotMatchSubjectErr consumer name in subject does not match durable name in request
90
        JSConsumerDurableNameNotMatchSubjectErr ErrorIdentifier = 10017
91

92
        // JSConsumerDurableNameNotSetErr consumer expected to be durable but a durable name was not set
93
        JSConsumerDurableNameNotSetErr ErrorIdentifier = 10018
94

95
        // JSConsumerEmptyFilter consumer filter in FilterSubjects cannot be empty
96
        JSConsumerEmptyFilter ErrorIdentifier = 10139
97

98
        // JSConsumerEmptyGroupName Group name cannot be an empty string
99
        JSConsumerEmptyGroupName ErrorIdentifier = 10161
100

101
        // JSConsumerEphemeralWithDurableInSubjectErr consumer expected to be ephemeral but detected a durable name set in subject
102
        JSConsumerEphemeralWithDurableInSubjectErr ErrorIdentifier = 10019
103

104
        // JSConsumerEphemeralWithDurableNameErr consumer expected to be ephemeral but a durable name was set in request
105
        JSConsumerEphemeralWithDurableNameErr ErrorIdentifier = 10020
106

107
        // JSConsumerExistingActiveErr consumer already exists and is still active
108
        JSConsumerExistingActiveErr ErrorIdentifier = 10105
109

110
        // JSConsumerFCRequiresPushErr consumer flow control requires a push based consumer
111
        JSConsumerFCRequiresPushErr ErrorIdentifier = 10089
112

113
        // JSConsumerFilterNotSubsetErr consumer filter subject is not a valid subset of the interest subjects
114
        JSConsumerFilterNotSubsetErr ErrorIdentifier = 10093
115

116
        // JSConsumerHBRequiresPushErr consumer idle heartbeat requires a push based consumer
117
        JSConsumerHBRequiresPushErr ErrorIdentifier = 10088
118

119
        // JSConsumerInactiveThresholdExcess consumer inactive threshold exceeds system limit of {limit}
120
        JSConsumerInactiveThresholdExcess ErrorIdentifier = 10153
121

122
        // JSConsumerInvalidDeliverSubject invalid push consumer deliver subject
123
        JSConsumerInvalidDeliverSubject ErrorIdentifier = 10112
124

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

128
        // JSConsumerInvalidPolicyErrF Generic delivery policy error ({err})
129
        JSConsumerInvalidPolicyErrF ErrorIdentifier = 10094
130

131
        // JSConsumerInvalidPriorityGroupErr Provided priority group does not exist for this consumer
132
        JSConsumerInvalidPriorityGroupErr ErrorIdentifier = 10160
133

134
        // JSConsumerInvalidSamplingErrF failed to parse consumer sampling configuration: {err}
135
        JSConsumerInvalidSamplingErrF ErrorIdentifier = 10095
136

137
        // JSConsumerMaxDeliverBackoffErr max deliver is required to be > length of backoff values
138
        JSConsumerMaxDeliverBackoffErr ErrorIdentifier = 10116
139

140
        // JSConsumerMaxPendingAckExcessErrF consumer max ack pending exceeds system limit of {limit}
141
        JSConsumerMaxPendingAckExcessErrF ErrorIdentifier = 10121
142

143
        // JSConsumerMaxPendingAckPolicyRequiredErr consumer requires ack policy for max ack pending
144
        JSConsumerMaxPendingAckPolicyRequiredErr ErrorIdentifier = 10082
145

146
        // JSConsumerMaxRequestBatchExceededF consumer max request batch exceeds server limit of {limit}
147
        JSConsumerMaxRequestBatchExceededF ErrorIdentifier = 10125
148

149
        // JSConsumerMaxRequestBatchNegativeErr consumer max request batch needs to be > 0
150
        JSConsumerMaxRequestBatchNegativeErr ErrorIdentifier = 10114
151

152
        // JSConsumerMaxRequestExpiresToSmall consumer max request expires needs to be >= 1ms
153
        JSConsumerMaxRequestExpiresToSmall ErrorIdentifier = 10115
154

155
        // JSConsumerMaxWaitingNegativeErr consumer max waiting needs to be positive
156
        JSConsumerMaxWaitingNegativeErr ErrorIdentifier = 10087
157

158
        // JSConsumerMetadataLengthErrF consumer metadata exceeds maximum size of {limit}
159
        JSConsumerMetadataLengthErrF ErrorIdentifier = 10135
160

161
        // JSConsumerMultipleFiltersNotAllowed consumer with multiple subject filters cannot use subject based API
162
        JSConsumerMultipleFiltersNotAllowed ErrorIdentifier = 10137
163

164
        // JSConsumerNameContainsPathSeparatorsErr Consumer name can not contain path separators
165
        JSConsumerNameContainsPathSeparatorsErr ErrorIdentifier = 10127
166

167
        // JSConsumerNameExistErr consumer name already in use
168
        JSConsumerNameExistErr ErrorIdentifier = 10013
169

170
        // JSConsumerNameTooLongErrF consumer name is too long, maximum allowed is {max}
171
        JSConsumerNameTooLongErrF ErrorIdentifier = 10102
172

173
        // JSConsumerNotFoundErr consumer not found
174
        JSConsumerNotFoundErr ErrorIdentifier = 10014
175

176
        // JSConsumerOfflineErr consumer is offline
177
        JSConsumerOfflineErr ErrorIdentifier = 10119
178

179
        // JSConsumerOnMappedErr consumer direct on a mapped consumer
180
        JSConsumerOnMappedErr ErrorIdentifier = 10092
181

182
        // JSConsumerOverlappingSubjectFilters consumer subject filters cannot overlap
183
        JSConsumerOverlappingSubjectFilters ErrorIdentifier = 10138
184

185
        // JSConsumerPriorityPolicyWithoutGroup Setting PriorityPolicy requires at least one PriorityGroup to be set
186
        JSConsumerPriorityPolicyWithoutGroup ErrorIdentifier = 10159
187

188
        // JSConsumerPullNotDurableErr consumer in pull mode requires a durable name
189
        JSConsumerPullNotDurableErr ErrorIdentifier = 10085
190

191
        // JSConsumerPullRequiresAckErr consumer in pull mode requires explicit ack policy on workqueue stream
192
        JSConsumerPullRequiresAckErr ErrorIdentifier = 10084
193

194
        // JSConsumerPullWithRateLimitErr consumer in pull mode can not have rate limit set
195
        JSConsumerPullWithRateLimitErr ErrorIdentifier = 10086
196

197
        // JSConsumerPushMaxWaitingErr consumer in push mode can not set max waiting
198
        JSConsumerPushMaxWaitingErr ErrorIdentifier = 10080
199

200
        // JSConsumerReplacementWithDifferentNameErr consumer replacement durable config not the same
201
        JSConsumerReplacementWithDifferentNameErr ErrorIdentifier = 10106
202

203
        // JSConsumerReplicasExceedsStream consumer config replica count exceeds parent stream
204
        JSConsumerReplicasExceedsStream ErrorIdentifier = 10126
205

206
        // JSConsumerReplicasShouldMatchStream consumer config replicas must match interest retention stream's replicas
207
        JSConsumerReplicasShouldMatchStream ErrorIdentifier = 10134
208

209
        // JSConsumerSmallHeartbeatErr consumer idle heartbeat needs to be >= 100ms
210
        JSConsumerSmallHeartbeatErr ErrorIdentifier = 10083
211

212
        // JSConsumerStoreFailedErrF error creating store for consumer: {err}
213
        JSConsumerStoreFailedErrF ErrorIdentifier = 10104
214

215
        // JSConsumerWQConsumerNotDeliverAllErr consumer must be deliver all on workqueue stream
216
        JSConsumerWQConsumerNotDeliverAllErr ErrorIdentifier = 10101
217

218
        // JSConsumerWQConsumerNotUniqueErr filtered consumer not unique on workqueue stream
219
        JSConsumerWQConsumerNotUniqueErr ErrorIdentifier = 10100
220

221
        // JSConsumerWQMultipleUnfilteredErr multiple non-filtered consumers not allowed on workqueue stream
222
        JSConsumerWQMultipleUnfilteredErr ErrorIdentifier = 10099
223

224
        // JSConsumerWQRequiresExplicitAckErr workqueue stream requires explicit ack
225
        JSConsumerWQRequiresExplicitAckErr ErrorIdentifier = 10098
226

227
        // JSConsumerWithFlowControlNeedsHeartbeats consumer with flow control also needs heartbeats
228
        JSConsumerWithFlowControlNeedsHeartbeats ErrorIdentifier = 10108
229

230
        // JSInsufficientResourcesErr insufficient resources
231
        JSInsufficientResourcesErr ErrorIdentifier = 10023
232

233
        // JSInvalidJSONErr invalid JSON: {err}
234
        JSInvalidJSONErr ErrorIdentifier = 10025
235

236
        // JSMaximumConsumersLimitErr maximum consumers limit reached
237
        JSMaximumConsumersLimitErr ErrorIdentifier = 10026
238

239
        // JSMaximumStreamsLimitErr maximum number of streams reached
240
        JSMaximumStreamsLimitErr ErrorIdentifier = 10027
241

242
        // JSMemoryResourcesExceededErr insufficient memory resources available
243
        JSMemoryResourcesExceededErr ErrorIdentifier = 10028
244

245
        // JSMessageTTLInvalidErr invalid per-message TTL
246
        JSMessageTTLInvalidErr ErrorIdentifier = 10165
247

248
        // JSMirrorConsumerSetupFailedErrF generic mirror consumer setup failure string ({err})
249
        JSMirrorConsumerSetupFailedErrF ErrorIdentifier = 10029
250

251
        // JSMirrorInvalidStreamName mirrored stream name is invalid
252
        JSMirrorInvalidStreamName ErrorIdentifier = 10142
253

254
        // JSMirrorInvalidSubjectFilter mirror transform source: {err}
255
        JSMirrorInvalidSubjectFilter ErrorIdentifier = 10151
256

257
        // JSMirrorInvalidTransformDestination mirror transform: {err}
258
        JSMirrorInvalidTransformDestination ErrorIdentifier = 10154
259

260
        // JSMirrorMaxMessageSizeTooBigErr stream mirror must have max message size >= source
261
        JSMirrorMaxMessageSizeTooBigErr ErrorIdentifier = 10030
262

263
        // JSMirrorMultipleFiltersNotAllowed mirror with multiple subject transforms cannot also have a single subject filter
264
        JSMirrorMultipleFiltersNotAllowed ErrorIdentifier = 10150
265

266
        // JSMirrorOverlappingSubjectFilters mirror subject filters can not overlap
267
        JSMirrorOverlappingSubjectFilters ErrorIdentifier = 10152
268

269
        // JSMirrorWithFirstSeqErr stream mirrors can not have first sequence configured
270
        JSMirrorWithFirstSeqErr ErrorIdentifier = 10143
271

272
        // JSMirrorWithSourcesErr stream mirrors can not also contain other sources
273
        JSMirrorWithSourcesErr ErrorIdentifier = 10031
274

275
        // JSMirrorWithStartSeqAndTimeErr stream mirrors can not have both start seq and start time configured
276
        JSMirrorWithStartSeqAndTimeErr ErrorIdentifier = 10032
277

278
        // JSMirrorWithSubjectFiltersErr stream mirrors can not contain filtered subjects
279
        JSMirrorWithSubjectFiltersErr ErrorIdentifier = 10033
280

281
        // JSMirrorWithSubjectsErr stream mirrors can not contain subjects
282
        JSMirrorWithSubjectsErr ErrorIdentifier = 10034
283

284
        // JSNoAccountErr account not found
285
        JSNoAccountErr ErrorIdentifier = 10035
286

287
        // JSNoLimitsErr no JetStream default or applicable tiered limit present
288
        JSNoLimitsErr ErrorIdentifier = 10120
289

290
        // JSNoMessageFoundErr no message found
291
        JSNoMessageFoundErr ErrorIdentifier = 10037
292

293
        // JSNotEmptyRequestErr expected an empty request payload
294
        JSNotEmptyRequestErr ErrorIdentifier = 10038
295

296
        // JSNotEnabledErr JetStream not enabled
297
        JSNotEnabledErr ErrorIdentifier = 10076
298

299
        // JSNotEnabledForAccountErr JetStream not enabled for account
300
        JSNotEnabledForAccountErr ErrorIdentifier = 10039
301

302
        // JSPedanticErrF pedantic mode: {err}
303
        JSPedanticErrF ErrorIdentifier = 10157
304

305
        // JSPeerRemapErr peer remap failed
306
        JSPeerRemapErr ErrorIdentifier = 10075
307

308
        // JSRaftGeneralErrF General RAFT error string ({err})
309
        JSRaftGeneralErrF ErrorIdentifier = 10041
310

311
        // JSReplicasCountCannotBeNegative replicas count cannot be negative
312
        JSReplicasCountCannotBeNegative ErrorIdentifier = 10133
313

314
        // JSRestoreSubscribeFailedErrF JetStream unable to subscribe to restore snapshot {subject}: {err}
315
        JSRestoreSubscribeFailedErrF ErrorIdentifier = 10042
316

317
        // JSSequenceNotFoundErrF sequence {seq} not found
318
        JSSequenceNotFoundErrF ErrorIdentifier = 10043
319

320
        // JSSnapshotDeliverSubjectInvalidErr deliver subject not valid
321
        JSSnapshotDeliverSubjectInvalidErr ErrorIdentifier = 10015
322

323
        // JSSourceConsumerSetupFailedErrF General source consumer setup failure string ({err})
324
        JSSourceConsumerSetupFailedErrF ErrorIdentifier = 10045
325

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

329
        // JSSourceInvalidStreamName sourced stream name is invalid
330
        JSSourceInvalidStreamName ErrorIdentifier = 10141
331

332
        // JSSourceInvalidSubjectFilter source transform source: {err}
333
        JSSourceInvalidSubjectFilter ErrorIdentifier = 10145
334

335
        // JSSourceInvalidTransformDestination source transform: {err}
336
        JSSourceInvalidTransformDestination ErrorIdentifier = 10146
337

338
        // JSSourceMaxMessageSizeTooBigErr stream source must have max message size >= target
339
        JSSourceMaxMessageSizeTooBigErr ErrorIdentifier = 10046
340

341
        // JSSourceMultipleFiltersNotAllowed source with multiple subject transforms cannot also have a single subject filter
342
        JSSourceMultipleFiltersNotAllowed ErrorIdentifier = 10144
343

344
        // JSSourceOverlappingSubjectFilters source filters can not overlap
345
        JSSourceOverlappingSubjectFilters ErrorIdentifier = 10147
346

347
        // JSStorageResourcesExceededErr insufficient storage resources available
348
        JSStorageResourcesExceededErr ErrorIdentifier = 10047
349

350
        // JSStreamAssignmentErrF Generic stream assignment error string ({err})
351
        JSStreamAssignmentErrF ErrorIdentifier = 10048
352

353
        // JSStreamCreateErrF Generic stream creation error string ({err})
354
        JSStreamCreateErrF ErrorIdentifier = 10049
355

356
        // JSStreamDeleteErrF General stream deletion error string ({err})
357
        JSStreamDeleteErrF ErrorIdentifier = 10050
358

359
        // JSStreamDuplicateMessageConflict duplicate message id is in process
360
        JSStreamDuplicateMessageConflict ErrorIdentifier = 10158
361

362
        // JSStreamExpectedLastSeqPerSubjectNotReady expected last sequence per subject temporarily unavailable
363
        JSStreamExpectedLastSeqPerSubjectNotReady ErrorIdentifier = 10163
364

365
        // JSStreamExternalApiOverlapErrF stream external api prefix {prefix} must not overlap with {subject}
366
        JSStreamExternalApiOverlapErrF ErrorIdentifier = 10021
367

368
        // JSStreamExternalDelPrefixOverlapsErrF stream external delivery prefix {prefix} overlaps with stream subject {subject}
369
        JSStreamExternalDelPrefixOverlapsErrF ErrorIdentifier = 10022
370

371
        // JSStreamGeneralErrorF General stream failure string ({err})
372
        JSStreamGeneralErrorF ErrorIdentifier = 10051
373

374
        // JSStreamHeaderExceedsMaximumErr header size exceeds maximum allowed of 64k
375
        JSStreamHeaderExceedsMaximumErr ErrorIdentifier = 10097
376

377
        // JSStreamInfoMaxSubjectsErr subject details would exceed maximum allowed
378
        JSStreamInfoMaxSubjectsErr ErrorIdentifier = 10117
379

380
        // JSStreamInvalidConfigF Stream configuration validation error string ({err})
381
        JSStreamInvalidConfigF ErrorIdentifier = 10052
382

383
        // JSStreamInvalidErr stream not valid
384
        JSStreamInvalidErr ErrorIdentifier = 10096
385

386
        // JSStreamInvalidExternalDeliverySubjErrF stream external delivery prefix {prefix} must not contain wildcards
387
        JSStreamInvalidExternalDeliverySubjErrF ErrorIdentifier = 10024
388

389
        // JSStreamLimitsErrF General stream limits exceeded error string ({err})
390
        JSStreamLimitsErrF ErrorIdentifier = 10053
391

392
        // JSStreamMaxBytesRequired account requires a stream config to have max bytes set
393
        JSStreamMaxBytesRequired ErrorIdentifier = 10113
394

395
        // JSStreamMaxStreamBytesExceeded stream max bytes exceeds account limit max stream bytes
396
        JSStreamMaxStreamBytesExceeded ErrorIdentifier = 10122
397

398
        // JSStreamMessageExceedsMaximumErr message size exceeds maximum allowed
399
        JSStreamMessageExceedsMaximumErr ErrorIdentifier = 10054
400

401
        // JSStreamMirrorNotUpdatableErr stream mirror configuration can not be updated
402
        JSStreamMirrorNotUpdatableErr ErrorIdentifier = 10055
403

404
        // JSStreamMismatchErr stream name in subject does not match request
405
        JSStreamMismatchErr ErrorIdentifier = 10056
406

407
        // JSStreamMoveAndScaleErr can not move and scale a stream in a single update
408
        JSStreamMoveAndScaleErr ErrorIdentifier = 10123
409

410
        // JSStreamMoveInProgressF stream move already in progress: {msg}
411
        JSStreamMoveInProgressF ErrorIdentifier = 10124
412

413
        // JSStreamMoveNotInProgress stream move not in progress
414
        JSStreamMoveNotInProgress ErrorIdentifier = 10129
415

416
        // JSStreamMsgDeleteFailedF Generic message deletion failure error string ({err})
417
        JSStreamMsgDeleteFailedF ErrorIdentifier = 10057
418

419
        // JSStreamNameContainsPathSeparatorsErr Stream name can not contain path separators
420
        JSStreamNameContainsPathSeparatorsErr ErrorIdentifier = 10128
421

422
        // JSStreamNameExistErr stream name already in use with a different configuration
423
        JSStreamNameExistErr ErrorIdentifier = 10058
424

425
        // JSStreamNameExistRestoreFailedErr stream name already in use, cannot restore
426
        JSStreamNameExistRestoreFailedErr ErrorIdentifier = 10130
427

428
        // JSStreamNotFoundErr stream not found
429
        JSStreamNotFoundErr ErrorIdentifier = 10059
430

431
        // JSStreamNotMatchErr expected stream does not match
432
        JSStreamNotMatchErr ErrorIdentifier = 10060
433

434
        // JSStreamOfflineErr stream is offline
435
        JSStreamOfflineErr ErrorIdentifier = 10118
436

437
        // JSStreamPurgeFailedF Generic stream purge failure error string ({err})
438
        JSStreamPurgeFailedF ErrorIdentifier = 10110
439

440
        // JSStreamReplicasNotSupportedErr replicas > 1 not supported in non-clustered mode
441
        JSStreamReplicasNotSupportedErr ErrorIdentifier = 10074
442

443
        // JSStreamReplicasNotUpdatableErr Replicas configuration can not be updated
444
        JSStreamReplicasNotUpdatableErr ErrorIdentifier = 10061
445

446
        // JSStreamRestoreErrF restore failed: {err}
447
        JSStreamRestoreErrF ErrorIdentifier = 10062
448

449
        // JSStreamRollupFailedF Generic stream rollup failure error string ({err})
450
        JSStreamRollupFailedF ErrorIdentifier = 10111
451

452
        // JSStreamSealedErr invalid operation on sealed stream
453
        JSStreamSealedErr ErrorIdentifier = 10109
454

455
        // JSStreamSequenceNotMatchErr expected stream sequence does not match
456
        JSStreamSequenceNotMatchErr ErrorIdentifier = 10063
457

458
        // JSStreamSnapshotErrF snapshot failed: {err}
459
        JSStreamSnapshotErrF ErrorIdentifier = 10064
460

461
        // JSStreamStoreFailedF Generic error when storing a message failed ({err})
462
        JSStreamStoreFailedF ErrorIdentifier = 10077
463

464
        // JSStreamSubjectOverlapErr subjects overlap with an existing stream
465
        JSStreamSubjectOverlapErr ErrorIdentifier = 10065
466

467
        // JSStreamTemplateCreateErrF Generic template creation failed string ({err})
468
        JSStreamTemplateCreateErrF ErrorIdentifier = 10066
469

470
        // JSStreamTemplateDeleteErrF Generic stream template deletion failed error string ({err})
471
        JSStreamTemplateDeleteErrF ErrorIdentifier = 10067
472

473
        // JSStreamTemplateNotFoundErr template not found
474
        JSStreamTemplateNotFoundErr ErrorIdentifier = 10068
475

476
        // JSStreamTransformInvalidDestination stream transform: {err}
477
        JSStreamTransformInvalidDestination ErrorIdentifier = 10156
478

479
        // JSStreamTransformInvalidSource stream transform source: {err}
480
        JSStreamTransformInvalidSource ErrorIdentifier = 10155
481

482
        // JSStreamUpdateErrF Generic stream update error string ({err})
483
        JSStreamUpdateErrF ErrorIdentifier = 10069
484

485
        // JSStreamWrongLastMsgIDErrF wrong last msg ID: {id}
486
        JSStreamWrongLastMsgIDErrF ErrorIdentifier = 10070
487

488
        // JSStreamWrongLastSequenceConstantErr wrong last sequence
489
        JSStreamWrongLastSequenceConstantErr ErrorIdentifier = 10164
490

491
        // JSStreamWrongLastSequenceErrF wrong last sequence: {seq}
492
        JSStreamWrongLastSequenceErrF ErrorIdentifier = 10071
493

494
        // JSTempStorageFailedErr JetStream unable to open temp storage for restore
495
        JSTempStorageFailedErr ErrorIdentifier = 10072
496

497
        // JSTemplateNameNotMatchSubjectErr template name in subject does not match request
498
        JSTemplateNameNotMatchSubjectErr ErrorIdentifier = 10073
499
)
500

501
var (
502
        ApiErrors = map[ErrorIdentifier]*ApiError{
503
                JSAccountResourcesExceededErr:              {Code: 400, ErrCode: 10002, Description: "resource limits exceeded for account"},
504
                JSBadRequestErr:                            {Code: 400, ErrCode: 10003, Description: "bad request"},
505
                JSClusterIncompleteErr:                     {Code: 503, ErrCode: 10004, Description: "incomplete results"},
506
                JSClusterNoPeersErrF:                       {Code: 400, ErrCode: 10005, Description: "{err}"},
507
                JSClusterNotActiveErr:                      {Code: 500, ErrCode: 10006, Description: "JetStream not in clustered mode"},
508
                JSClusterNotAssignedErr:                    {Code: 500, ErrCode: 10007, Description: "JetStream cluster not assigned to this server"},
509
                JSClusterNotAvailErr:                       {Code: 503, ErrCode: 10008, Description: "JetStream system temporarily unavailable"},
510
                JSClusterNotLeaderErr:                      {Code: 500, ErrCode: 10009, Description: "JetStream cluster can not handle request"},
511
                JSClusterPeerNotMemberErr:                  {Code: 400, ErrCode: 10040, Description: "peer not a member"},
512
                JSClusterRequiredErr:                       {Code: 503, ErrCode: 10010, Description: "JetStream clustering support required"},
513
                JSClusterServerNotMemberErr:                {Code: 400, ErrCode: 10044, Description: "server is not a member of the cluster"},
514
                JSClusterTagsErr:                           {Code: 400, ErrCode: 10011, Description: "tags placement not supported for operation"},
515
                JSClusterUnSupportFeatureErr:               {Code: 503, ErrCode: 10036, Description: "not currently supported in clustered mode"},
516
                JSConsumerAlreadyExists:                    {Code: 400, ErrCode: 10148, Description: "consumer already exists"},
517
                JSConsumerBadDurableNameErr:                {Code: 400, ErrCode: 10103, Description: "durable name can not contain '.', '*', '>'"},
518
                JSConsumerConfigRequiredErr:                {Code: 400, ErrCode: 10078, Description: "consumer config required"},
519
                JSConsumerCreateDurableAndNameMismatch:     {Code: 400, ErrCode: 10132, Description: "Consumer Durable and Name have to be equal if both are provided"},
520
                JSConsumerCreateErrF:                       {Code: 500, ErrCode: 10012, Description: "{err}"},
521
                JSConsumerCreateFilterSubjectMismatchErr:   {Code: 400, ErrCode: 10131, Description: "Consumer create request did not match filtered subject from create subject"},
522
                JSConsumerDeliverCycleErr:                  {Code: 400, ErrCode: 10081, Description: "consumer deliver subject forms a cycle"},
523
                JSConsumerDeliverToWildcardsErr:            {Code: 400, ErrCode: 10079, Description: "consumer deliver subject has wildcards"},
524
                JSConsumerDescriptionTooLongErrF:           {Code: 400, ErrCode: 10107, Description: "consumer description is too long, maximum allowed is {max}"},
525
                JSConsumerDirectRequiresEphemeralErr:       {Code: 400, ErrCode: 10091, Description: "consumer direct requires an ephemeral consumer"},
526
                JSConsumerDirectRequiresPushErr:            {Code: 400, ErrCode: 10090, Description: "consumer direct requires a push based consumer"},
527
                JSConsumerDoesNotExist:                     {Code: 400, ErrCode: 10149, Description: "consumer does not exist"},
528
                JSConsumerDuplicateFilterSubjects:          {Code: 400, ErrCode: 10136, Description: "consumer cannot have both FilterSubject and FilterSubjects specified"},
529
                JSConsumerDurableNameNotInSubjectErr:       {Code: 400, ErrCode: 10016, Description: "consumer expected to be durable but no durable name set in subject"},
530
                JSConsumerDurableNameNotMatchSubjectErr:    {Code: 400, ErrCode: 10017, Description: "consumer name in subject does not match durable name in request"},
531
                JSConsumerDurableNameNotSetErr:             {Code: 400, ErrCode: 10018, Description: "consumer expected to be durable but a durable name was not set"},
532
                JSConsumerEmptyFilter:                      {Code: 400, ErrCode: 10139, Description: "consumer filter in FilterSubjects cannot be empty"},
533
                JSConsumerEmptyGroupName:                   {Code: 400, ErrCode: 10161, Description: "Group name cannot be an empty string"},
534
                JSConsumerEphemeralWithDurableInSubjectErr: {Code: 400, ErrCode: 10019, Description: "consumer expected to be ephemeral but detected a durable name set in subject"},
535
                JSConsumerEphemeralWithDurableNameErr:      {Code: 400, ErrCode: 10020, Description: "consumer expected to be ephemeral but a durable name was set in request"},
536
                JSConsumerExistingActiveErr:                {Code: 400, ErrCode: 10105, Description: "consumer already exists and is still active"},
537
                JSConsumerFCRequiresPushErr:                {Code: 400, ErrCode: 10089, Description: "consumer flow control requires a push based consumer"},
538
                JSConsumerFilterNotSubsetErr:               {Code: 400, ErrCode: 10093, Description: "consumer filter subject is not a valid subset of the interest subjects"},
539
                JSConsumerHBRequiresPushErr:                {Code: 400, ErrCode: 10088, Description: "consumer idle heartbeat requires a push based consumer"},
540
                JSConsumerInactiveThresholdExcess:          {Code: 400, ErrCode: 10153, Description: "consumer inactive threshold exceeds system limit of {limit}"},
541
                JSConsumerInvalidDeliverSubject:            {Code: 400, ErrCode: 10112, Description: "invalid push consumer deliver subject"},
542
                JSConsumerInvalidGroupNameErr:              {Code: 400, ErrCode: 10162, Description: "Valid priority group name must match A-Z, a-z, 0-9, -_/=)+ and may not exceed 16 characters"},
543
                JSConsumerInvalidPolicyErrF:                {Code: 400, ErrCode: 10094, Description: "{err}"},
544
                JSConsumerInvalidPriorityGroupErr:          {Code: 400, ErrCode: 10160, Description: "Provided priority group does not exist for this consumer"},
545
                JSConsumerInvalidSamplingErrF:              {Code: 400, ErrCode: 10095, Description: "failed to parse consumer sampling configuration: {err}"},
546
                JSConsumerMaxDeliverBackoffErr:             {Code: 400, ErrCode: 10116, Description: "max deliver is required to be > length of backoff values"},
547
                JSConsumerMaxPendingAckExcessErrF:          {Code: 400, ErrCode: 10121, Description: "consumer max ack pending exceeds system limit of {limit}"},
548
                JSConsumerMaxPendingAckPolicyRequiredErr:   {Code: 400, ErrCode: 10082, Description: "consumer requires ack policy for max ack pending"},
549
                JSConsumerMaxRequestBatchExceededF:         {Code: 400, ErrCode: 10125, Description: "consumer max request batch exceeds server limit of {limit}"},
550
                JSConsumerMaxRequestBatchNegativeErr:       {Code: 400, ErrCode: 10114, Description: "consumer max request batch needs to be > 0"},
551
                JSConsumerMaxRequestExpiresToSmall:         {Code: 400, ErrCode: 10115, Description: "consumer max request expires needs to be >= 1ms"},
552
                JSConsumerMaxWaitingNegativeErr:            {Code: 400, ErrCode: 10087, Description: "consumer max waiting needs to be positive"},
553
                JSConsumerMetadataLengthErrF:               {Code: 400, ErrCode: 10135, Description: "consumer metadata exceeds maximum size of {limit}"},
554
                JSConsumerMultipleFiltersNotAllowed:        {Code: 400, ErrCode: 10137, Description: "consumer with multiple subject filters cannot use subject based API"},
555
                JSConsumerNameContainsPathSeparatorsErr:    {Code: 400, ErrCode: 10127, Description: "Consumer name can not contain path separators"},
556
                JSConsumerNameExistErr:                     {Code: 400, ErrCode: 10013, Description: "consumer name already in use"},
557
                JSConsumerNameTooLongErrF:                  {Code: 400, ErrCode: 10102, Description: "consumer name is too long, maximum allowed is {max}"},
558
                JSConsumerNotFoundErr:                      {Code: 404, ErrCode: 10014, Description: "consumer not found"},
559
                JSConsumerOfflineErr:                       {Code: 500, ErrCode: 10119, Description: "consumer is offline"},
560
                JSConsumerOnMappedErr:                      {Code: 400, ErrCode: 10092, Description: "consumer direct on a mapped consumer"},
561
                JSConsumerOverlappingSubjectFilters:        {Code: 400, ErrCode: 10138, Description: "consumer subject filters cannot overlap"},
562
                JSConsumerPriorityPolicyWithoutGroup:       {Code: 400, ErrCode: 10159, Description: "Setting PriorityPolicy requires at least one PriorityGroup to be set"},
563
                JSConsumerPullNotDurableErr:                {Code: 400, ErrCode: 10085, Description: "consumer in pull mode requires a durable name"},
564
                JSConsumerPullRequiresAckErr:               {Code: 400, ErrCode: 10084, Description: "consumer in pull mode requires explicit ack policy on workqueue stream"},
565
                JSConsumerPullWithRateLimitErr:             {Code: 400, ErrCode: 10086, Description: "consumer in pull mode can not have rate limit set"},
566
                JSConsumerPushMaxWaitingErr:                {Code: 400, ErrCode: 10080, Description: "consumer in push mode can not set max waiting"},
567
                JSConsumerReplacementWithDifferentNameErr:  {Code: 400, ErrCode: 10106, Description: "consumer replacement durable config not the same"},
568
                JSConsumerReplicasExceedsStream:            {Code: 400, ErrCode: 10126, Description: "consumer config replica count exceeds parent stream"},
569
                JSConsumerReplicasShouldMatchStream:        {Code: 400, ErrCode: 10134, Description: "consumer config replicas must match interest retention stream's replicas"},
570
                JSConsumerSmallHeartbeatErr:                {Code: 400, ErrCode: 10083, Description: "consumer idle heartbeat needs to be >= 100ms"},
571
                JSConsumerStoreFailedErrF:                  {Code: 500, ErrCode: 10104, Description: "error creating store for consumer: {err}"},
572
                JSConsumerWQConsumerNotDeliverAllErr:       {Code: 400, ErrCode: 10101, Description: "consumer must be deliver all on workqueue stream"},
573
                JSConsumerWQConsumerNotUniqueErr:           {Code: 400, ErrCode: 10100, Description: "filtered consumer not unique on workqueue stream"},
574
                JSConsumerWQMultipleUnfilteredErr:          {Code: 400, ErrCode: 10099, Description: "multiple non-filtered consumers not allowed on workqueue stream"},
575
                JSConsumerWQRequiresExplicitAckErr:         {Code: 400, ErrCode: 10098, Description: "workqueue stream requires explicit ack"},
576
                JSConsumerWithFlowControlNeedsHeartbeats:   {Code: 400, ErrCode: 10108, Description: "consumer with flow control also needs heartbeats"},
577
                JSInsufficientResourcesErr:                 {Code: 503, ErrCode: 10023, Description: "insufficient resources"},
578
                JSInvalidJSONErr:                           {Code: 400, ErrCode: 10025, Description: "invalid JSON: {err}"},
579
                JSMaximumConsumersLimitErr:                 {Code: 400, ErrCode: 10026, Description: "maximum consumers limit reached"},
580
                JSMaximumStreamsLimitErr:                   {Code: 400, ErrCode: 10027, Description: "maximum number of streams reached"},
581
                JSMemoryResourcesExceededErr:               {Code: 500, ErrCode: 10028, Description: "insufficient memory resources available"},
582
                JSMessageTTLInvalidErr:                     {Code: 400, ErrCode: 10165, Description: "invalid per-message TTL"},
583
                JSMirrorConsumerSetupFailedErrF:            {Code: 500, ErrCode: 10029, Description: "{err}"},
584
                JSMirrorInvalidStreamName:                  {Code: 400, ErrCode: 10142, Description: "mirrored stream name is invalid"},
585
                JSMirrorInvalidSubjectFilter:               {Code: 400, ErrCode: 10151, Description: "mirror transform source: {err}"},
586
                JSMirrorInvalidTransformDestination:        {Code: 400, ErrCode: 10154, Description: "mirror transform: {err}"},
587
                JSMirrorMaxMessageSizeTooBigErr:            {Code: 400, ErrCode: 10030, Description: "stream mirror must have max message size >= source"},
588
                JSMirrorMultipleFiltersNotAllowed:          {Code: 400, ErrCode: 10150, Description: "mirror with multiple subject transforms cannot also have a single subject filter"},
589
                JSMirrorOverlappingSubjectFilters:          {Code: 400, ErrCode: 10152, Description: "mirror subject filters can not overlap"},
590
                JSMirrorWithFirstSeqErr:                    {Code: 400, ErrCode: 10143, Description: "stream mirrors can not have first sequence configured"},
591
                JSMirrorWithSourcesErr:                     {Code: 400, ErrCode: 10031, Description: "stream mirrors can not also contain other sources"},
592
                JSMirrorWithStartSeqAndTimeErr:             {Code: 400, ErrCode: 10032, Description: "stream mirrors can not have both start seq and start time configured"},
593
                JSMirrorWithSubjectFiltersErr:              {Code: 400, ErrCode: 10033, Description: "stream mirrors can not contain filtered subjects"},
594
                JSMirrorWithSubjectsErr:                    {Code: 400, ErrCode: 10034, Description: "stream mirrors can not contain subjects"},
595
                JSNoAccountErr:                             {Code: 503, ErrCode: 10035, Description: "account not found"},
596
                JSNoLimitsErr:                              {Code: 400, ErrCode: 10120, Description: "no JetStream default or applicable tiered limit present"},
597
                JSNoMessageFoundErr:                        {Code: 404, ErrCode: 10037, Description: "no message found"},
598
                JSNotEmptyRequestErr:                       {Code: 400, ErrCode: 10038, Description: "expected an empty request payload"},
599
                JSNotEnabledErr:                            {Code: 503, ErrCode: 10076, Description: "JetStream not enabled"},
600
                JSNotEnabledForAccountErr:                  {Code: 503, ErrCode: 10039, Description: "JetStream not enabled for account"},
601
                JSPedanticErrF:                             {Code: 400, ErrCode: 10157, Description: "pedantic mode: {err}"},
602
                JSPeerRemapErr:                             {Code: 503, ErrCode: 10075, Description: "peer remap failed"},
603
                JSRaftGeneralErrF:                          {Code: 500, ErrCode: 10041, Description: "{err}"},
604
                JSReplicasCountCannotBeNegative:            {Code: 400, ErrCode: 10133, Description: "replicas count cannot be negative"},
605
                JSRestoreSubscribeFailedErrF:               {Code: 500, ErrCode: 10042, Description: "JetStream unable to subscribe to restore snapshot {subject}: {err}"},
606
                JSSequenceNotFoundErrF:                     {Code: 400, ErrCode: 10043, Description: "sequence {seq} not found"},
607
                JSSnapshotDeliverSubjectInvalidErr:         {Code: 400, ErrCode: 10015, Description: "deliver subject not valid"},
608
                JSSourceConsumerSetupFailedErrF:            {Code: 500, ErrCode: 10045, Description: "{err}"},
609
                JSSourceDuplicateDetected:                  {Code: 400, ErrCode: 10140, Description: "duplicate source configuration detected"},
610
                JSSourceInvalidStreamName:                  {Code: 400, ErrCode: 10141, Description: "sourced stream name is invalid"},
611
                JSSourceInvalidSubjectFilter:               {Code: 400, ErrCode: 10145, Description: "source transform source: {err}"},
612
                JSSourceInvalidTransformDestination:        {Code: 400, ErrCode: 10146, Description: "source transform: {err}"},
613
                JSSourceMaxMessageSizeTooBigErr:            {Code: 400, ErrCode: 10046, Description: "stream source must have max message size >= target"},
614
                JSSourceMultipleFiltersNotAllowed:          {Code: 400, ErrCode: 10144, Description: "source with multiple subject transforms cannot also have a single subject filter"},
615
                JSSourceOverlappingSubjectFilters:          {Code: 400, ErrCode: 10147, Description: "source filters can not overlap"},
616
                JSStorageResourcesExceededErr:              {Code: 500, ErrCode: 10047, Description: "insufficient storage resources available"},
617
                JSStreamAssignmentErrF:                     {Code: 500, ErrCode: 10048, Description: "{err}"},
618
                JSStreamCreateErrF:                         {Code: 500, ErrCode: 10049, Description: "{err}"},
619
                JSStreamDeleteErrF:                         {Code: 500, ErrCode: 10050, Description: "{err}"},
620
                JSStreamDuplicateMessageConflict:           {Code: 409, ErrCode: 10158, Description: "duplicate message id is in process"},
621
                JSStreamExpectedLastSeqPerSubjectNotReady:  {Code: 503, ErrCode: 10163, Description: "expected last sequence per subject temporarily unavailable"},
622
                JSStreamExternalApiOverlapErrF:             {Code: 400, ErrCode: 10021, Description: "stream external api prefix {prefix} must not overlap with {subject}"},
623
                JSStreamExternalDelPrefixOverlapsErrF:      {Code: 400, ErrCode: 10022, Description: "stream external delivery prefix {prefix} overlaps with stream subject {subject}"},
624
                JSStreamGeneralErrorF:                      {Code: 500, ErrCode: 10051, Description: "{err}"},
625
                JSStreamHeaderExceedsMaximumErr:            {Code: 400, ErrCode: 10097, Description: "header size exceeds maximum allowed of 64k"},
626
                JSStreamInfoMaxSubjectsErr:                 {Code: 500, ErrCode: 10117, Description: "subject details would exceed maximum allowed"},
627
                JSStreamInvalidConfigF:                     {Code: 500, ErrCode: 10052, Description: "{err}"},
628
                JSStreamInvalidErr:                         {Code: 500, ErrCode: 10096, Description: "stream not valid"},
629
                JSStreamInvalidExternalDeliverySubjErrF:    {Code: 400, ErrCode: 10024, Description: "stream external delivery prefix {prefix} must not contain wildcards"},
630
                JSStreamLimitsErrF:                         {Code: 500, ErrCode: 10053, Description: "{err}"},
631
                JSStreamMaxBytesRequired:                   {Code: 400, ErrCode: 10113, Description: "account requires a stream config to have max bytes set"},
632
                JSStreamMaxStreamBytesExceeded:             {Code: 400, ErrCode: 10122, Description: "stream max bytes exceeds account limit max stream bytes"},
633
                JSStreamMessageExceedsMaximumErr:           {Code: 400, ErrCode: 10054, Description: "message size exceeds maximum allowed"},
634
                JSStreamMirrorNotUpdatableErr:              {Code: 400, ErrCode: 10055, Description: "stream mirror configuration can not be updated"},
635
                JSStreamMismatchErr:                        {Code: 400, ErrCode: 10056, Description: "stream name in subject does not match request"},
636
                JSStreamMoveAndScaleErr:                    {Code: 400, ErrCode: 10123, Description: "can not move and scale a stream in a single update"},
637
                JSStreamMoveInProgressF:                    {Code: 400, ErrCode: 10124, Description: "stream move already in progress: {msg}"},
638
                JSStreamMoveNotInProgress:                  {Code: 400, ErrCode: 10129, Description: "stream move not in progress"},
639
                JSStreamMsgDeleteFailedF:                   {Code: 500, ErrCode: 10057, Description: "{err}"},
640
                JSStreamNameContainsPathSeparatorsErr:      {Code: 400, ErrCode: 10128, Description: "Stream name can not contain path separators"},
641
                JSStreamNameExistErr:                       {Code: 400, ErrCode: 10058, Description: "stream name already in use with a different configuration"},
642
                JSStreamNameExistRestoreFailedErr:          {Code: 400, ErrCode: 10130, Description: "stream name already in use, cannot restore"},
643
                JSStreamNotFoundErr:                        {Code: 404, ErrCode: 10059, Description: "stream not found"},
644
                JSStreamNotMatchErr:                        {Code: 400, ErrCode: 10060, Description: "expected stream does not match"},
645
                JSStreamOfflineErr:                         {Code: 500, ErrCode: 10118, Description: "stream is offline"},
646
                JSStreamPurgeFailedF:                       {Code: 500, ErrCode: 10110, Description: "{err}"},
647
                JSStreamReplicasNotSupportedErr:            {Code: 500, ErrCode: 10074, Description: "replicas > 1 not supported in non-clustered mode"},
648
                JSStreamReplicasNotUpdatableErr:            {Code: 400, ErrCode: 10061, Description: "Replicas configuration can not be updated"},
649
                JSStreamRestoreErrF:                        {Code: 500, ErrCode: 10062, Description: "restore failed: {err}"},
650
                JSStreamRollupFailedF:                      {Code: 500, ErrCode: 10111, Description: "{err}"},
651
                JSStreamSealedErr:                          {Code: 400, ErrCode: 10109, Description: "invalid operation on sealed stream"},
652
                JSStreamSequenceNotMatchErr:                {Code: 503, ErrCode: 10063, Description: "expected stream sequence does not match"},
653
                JSStreamSnapshotErrF:                       {Code: 500, ErrCode: 10064, Description: "snapshot failed: {err}"},
654
                JSStreamStoreFailedF:                       {Code: 503, ErrCode: 10077, Description: "{err}"},
655
                JSStreamSubjectOverlapErr:                  {Code: 400, ErrCode: 10065, Description: "subjects overlap with an existing stream"},
656
                JSStreamTemplateCreateErrF:                 {Code: 500, ErrCode: 10066, Description: "{err}"},
657
                JSStreamTemplateDeleteErrF:                 {Code: 500, ErrCode: 10067, Description: "{err}"},
658
                JSStreamTemplateNotFoundErr:                {Code: 404, ErrCode: 10068, Description: "template not found"},
659
                JSStreamTransformInvalidDestination:        {Code: 400, ErrCode: 10156, Description: "stream transform: {err}"},
660
                JSStreamTransformInvalidSource:             {Code: 400, ErrCode: 10155, Description: "stream transform source: {err}"},
661
                JSStreamUpdateErrF:                         {Code: 500, ErrCode: 10069, Description: "{err}"},
662
                JSStreamWrongLastMsgIDErrF:                 {Code: 400, ErrCode: 10070, Description: "wrong last msg ID: {id}"},
663
                JSStreamWrongLastSequenceConstantErr:       {Code: 400, ErrCode: 10164, Description: "wrong last sequence"},
664
                JSStreamWrongLastSequenceErrF:              {Code: 400, ErrCode: 10071, Description: "wrong last sequence: {seq}"},
665
                JSTempStorageFailedErr:                     {Code: 500, ErrCode: 10072, Description: "JetStream unable to open temp storage for restore"},
666
                JSTemplateNameNotMatchSubjectErr:           {Code: 400, ErrCode: 10073, Description: "template name in subject does not match request"},
667
        }
668
        // ErrJetStreamNotClustered Deprecated by JSClusterNotActiveErr ApiError, use IsNatsError() for comparisons
669
        ErrJetStreamNotClustered = ApiErrors[JSClusterNotActiveErr]
670
        // ErrJetStreamNotAssigned Deprecated by JSClusterNotAssignedErr ApiError, use IsNatsError() for comparisons
671
        ErrJetStreamNotAssigned = ApiErrors[JSClusterNotAssignedErr]
672
        // ErrJetStreamNotLeader Deprecated by JSClusterNotLeaderErr ApiError, use IsNatsError() for comparisons
673
        ErrJetStreamNotLeader = ApiErrors[JSClusterNotLeaderErr]
674
        // ErrJetStreamConsumerAlreadyUsed Deprecated by JSConsumerNameExistErr ApiError, use IsNatsError() for comparisons
675
        ErrJetStreamConsumerAlreadyUsed = ApiErrors[JSConsumerNameExistErr]
676
        // ErrJetStreamResourcesExceeded Deprecated by JSInsufficientResourcesErr ApiError, use IsNatsError() for comparisons
677
        ErrJetStreamResourcesExceeded = ApiErrors[JSInsufficientResourcesErr]
678
        // ErrMemoryResourcesExceeded Deprecated by JSMemoryResourcesExceededErr ApiError, use IsNatsError() for comparisons
679
        ErrMemoryResourcesExceeded = ApiErrors[JSMemoryResourcesExceededErr]
680
        // ErrJetStreamNotEnabled Deprecated by JSNotEnabledErr ApiError, use IsNatsError() for comparisons
681
        ErrJetStreamNotEnabled = ApiErrors[JSNotEnabledErr]
682
        // ErrStorageResourcesExceeded Deprecated by JSStorageResourcesExceededErr ApiError, use IsNatsError() for comparisons
683
        ErrStorageResourcesExceeded = ApiErrors[JSStorageResourcesExceededErr]
684
        // ErrJetStreamStreamAlreadyUsed Deprecated by JSStreamNameExistErr ApiError, use IsNatsError() for comparisons
685
        ErrJetStreamStreamAlreadyUsed = ApiErrors[JSStreamNameExistErr]
686
        // ErrJetStreamStreamNotFound Deprecated by JSStreamNotFoundErr ApiError, use IsNatsError() for comparisons
687
        ErrJetStreamStreamNotFound = ApiErrors[JSStreamNotFoundErr]
688
        // ErrReplicasNotSupported Deprecated by JSStreamReplicasNotSupportedErr ApiError, use IsNatsError() for comparisons
689
        ErrReplicasNotSupported = ApiErrors[JSStreamReplicasNotSupportedErr]
690
)
691

692
// NewJSAccountResourcesExceededError creates a new JSAccountResourcesExceededErr error: "resource limits exceeded for account"
693
func NewJSAccountResourcesExceededError(opts ...ErrorOption) *ApiError {
20,061✔
694
        eopts := parseOpts(opts)
20,061✔
695
        if ae, ok := eopts.err.(*ApiError); ok {
20,061✔
696
                return ae
×
697
        }
×
698

699
        return ApiErrors[JSAccountResourcesExceededErr]
20,061✔
700
}
701

702
// NewJSBadRequestError creates a new JSBadRequestErr error: "bad request"
703
func NewJSBadRequestError(opts ...ErrorOption) *ApiError {
10✔
704
        eopts := parseOpts(opts)
10✔
705
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
706
                return ae
×
707
        }
×
708

709
        return ApiErrors[JSBadRequestErr]
10✔
710
}
711

712
// NewJSClusterIncompleteError creates a new JSClusterIncompleteErr error: "incomplete results"
713
func NewJSClusterIncompleteError(opts ...ErrorOption) *ApiError {
×
714
        eopts := parseOpts(opts)
×
715
        if ae, ok := eopts.err.(*ApiError); ok {
×
716
                return ae
×
717
        }
×
718

719
        return ApiErrors[JSClusterIncompleteErr]
×
720
}
721

722
// NewJSClusterNoPeersError creates a new JSClusterNoPeersErrF error: "{err}"
723
func NewJSClusterNoPeersError(err error, opts ...ErrorOption) *ApiError {
55✔
724
        eopts := parseOpts(opts)
55✔
725
        if ae, ok := eopts.err.(*ApiError); ok {
55✔
726
                return ae
×
727
        }
×
728

729
        e := ApiErrors[JSClusterNoPeersErrF]
55✔
730
        args := e.toReplacerArgs([]interface{}{"{err}", err})
55✔
731
        return &ApiError{
55✔
732
                Code:        e.Code,
55✔
733
                ErrCode:     e.ErrCode,
55✔
734
                Description: strings.NewReplacer(args...).Replace(e.Description),
55✔
735
        }
55✔
736
}
737

738
// NewJSClusterNotActiveError creates a new JSClusterNotActiveErr error: "JetStream not in clustered mode"
739
func NewJSClusterNotActiveError(opts ...ErrorOption) *ApiError {
1✔
740
        eopts := parseOpts(opts)
1✔
741
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
742
                return ae
×
743
        }
×
744

745
        return ApiErrors[JSClusterNotActiveErr]
1✔
746
}
747

748
// NewJSClusterNotAssignedError creates a new JSClusterNotAssignedErr error: "JetStream cluster not assigned to this server"
749
func NewJSClusterNotAssignedError(opts ...ErrorOption) *ApiError {
28✔
750
        eopts := parseOpts(opts)
28✔
751
        if ae, ok := eopts.err.(*ApiError); ok {
28✔
752
                return ae
×
753
        }
×
754

755
        return ApiErrors[JSClusterNotAssignedErr]
28✔
756
}
757

758
// NewJSClusterNotAvailError creates a new JSClusterNotAvailErr error: "JetStream system temporarily unavailable"
759
func NewJSClusterNotAvailError(opts ...ErrorOption) *ApiError {
13✔
760
        eopts := parseOpts(opts)
13✔
761
        if ae, ok := eopts.err.(*ApiError); ok {
13✔
762
                return ae
×
763
        }
×
764

765
        return ApiErrors[JSClusterNotAvailErr]
13✔
766
}
767

768
// NewJSClusterNotLeaderError creates a new JSClusterNotLeaderErr error: "JetStream cluster can not handle request"
769
func NewJSClusterNotLeaderError(opts ...ErrorOption) *ApiError {
4✔
770
        eopts := parseOpts(opts)
4✔
771
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
772
                return ae
×
773
        }
×
774

775
        return ApiErrors[JSClusterNotLeaderErr]
4✔
776
}
777

778
// NewJSClusterPeerNotMemberError creates a new JSClusterPeerNotMemberErr error: "peer not a member"
779
func NewJSClusterPeerNotMemberError(opts ...ErrorOption) *ApiError {
1✔
780
        eopts := parseOpts(opts)
1✔
781
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
782
                return ae
×
783
        }
×
784

785
        return ApiErrors[JSClusterPeerNotMemberErr]
1✔
786
}
787

788
// NewJSClusterRequiredError creates a new JSClusterRequiredErr error: "JetStream clustering support required"
789
func NewJSClusterRequiredError(opts ...ErrorOption) *ApiError {
×
790
        eopts := parseOpts(opts)
×
791
        if ae, ok := eopts.err.(*ApiError); ok {
×
792
                return ae
×
793
        }
×
794

795
        return ApiErrors[JSClusterRequiredErr]
×
796
}
797

798
// NewJSClusterServerNotMemberError creates a new JSClusterServerNotMemberErr error: "server is not a member of the cluster"
799
func NewJSClusterServerNotMemberError(opts ...ErrorOption) *ApiError {
3✔
800
        eopts := parseOpts(opts)
3✔
801
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
802
                return ae
×
803
        }
×
804

805
        return ApiErrors[JSClusterServerNotMemberErr]
3✔
806
}
807

808
// NewJSClusterTagsError creates a new JSClusterTagsErr error: "tags placement not supported for operation"
809
func NewJSClusterTagsError(opts ...ErrorOption) *ApiError {
×
810
        eopts := parseOpts(opts)
×
811
        if ae, ok := eopts.err.(*ApiError); ok {
×
812
                return ae
×
813
        }
×
814

815
        return ApiErrors[JSClusterTagsErr]
×
816
}
817

818
// NewJSClusterUnSupportFeatureError creates a new JSClusterUnSupportFeatureErr error: "not currently supported in clustered mode"
819
func NewJSClusterUnSupportFeatureError(opts ...ErrorOption) *ApiError {
6✔
820
        eopts := parseOpts(opts)
6✔
821
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
822
                return ae
×
823
        }
×
824

825
        return ApiErrors[JSClusterUnSupportFeatureErr]
6✔
826
}
827

828
// NewJSConsumerAlreadyExistsError creates a new JSConsumerAlreadyExists error: "consumer already exists"
829
func NewJSConsumerAlreadyExistsError(opts ...ErrorOption) *ApiError {
5✔
830
        eopts := parseOpts(opts)
5✔
831
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
832
                return ae
×
833
        }
×
834

835
        return ApiErrors[JSConsumerAlreadyExists]
5✔
836
}
837

838
// NewJSConsumerBadDurableNameError creates a new JSConsumerBadDurableNameErr error: "durable name can not contain '.', '*', '>'"
839
func NewJSConsumerBadDurableNameError(opts ...ErrorOption) *ApiError {
×
840
        eopts := parseOpts(opts)
×
841
        if ae, ok := eopts.err.(*ApiError); ok {
×
842
                return ae
×
843
        }
×
844

845
        return ApiErrors[JSConsumerBadDurableNameErr]
×
846
}
847

848
// NewJSConsumerConfigRequiredError creates a new JSConsumerConfigRequiredErr error: "consumer config required"
849
func NewJSConsumerConfigRequiredError(opts ...ErrorOption) *ApiError {
2✔
850
        eopts := parseOpts(opts)
2✔
851
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
852
                return ae
×
853
        }
×
854

855
        return ApiErrors[JSConsumerConfigRequiredErr]
2✔
856
}
857

858
// NewJSConsumerCreateDurableAndNameMismatchError creates a new JSConsumerCreateDurableAndNameMismatch error: "Consumer Durable and Name have to be equal if both are provided"
859
func NewJSConsumerCreateDurableAndNameMismatchError(opts ...ErrorOption) *ApiError {
1✔
860
        eopts := parseOpts(opts)
1✔
861
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
862
                return ae
×
863
        }
×
864

865
        return ApiErrors[JSConsumerCreateDurableAndNameMismatch]
1✔
866
}
867

868
// NewJSConsumerCreateError creates a new JSConsumerCreateErrF error: "{err}"
869
func NewJSConsumerCreateError(err error, opts ...ErrorOption) *ApiError {
64✔
870
        eopts := parseOpts(opts)
64✔
871
        if ae, ok := eopts.err.(*ApiError); ok {
112✔
872
                return ae
48✔
873
        }
48✔
874

875
        e := ApiErrors[JSConsumerCreateErrF]
16✔
876
        args := e.toReplacerArgs([]interface{}{"{err}", err})
16✔
877
        return &ApiError{
16✔
878
                Code:        e.Code,
16✔
879
                ErrCode:     e.ErrCode,
16✔
880
                Description: strings.NewReplacer(args...).Replace(e.Description),
16✔
881
        }
16✔
882
}
883

884
// NewJSConsumerCreateFilterSubjectMismatchError creates a new JSConsumerCreateFilterSubjectMismatchErr error: "Consumer create request did not match filtered subject from create subject"
885
func NewJSConsumerCreateFilterSubjectMismatchError(opts ...ErrorOption) *ApiError {
2✔
886
        eopts := parseOpts(opts)
2✔
887
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
888
                return ae
×
889
        }
×
890

891
        return ApiErrors[JSConsumerCreateFilterSubjectMismatchErr]
2✔
892
}
893

894
// NewJSConsumerDeliverCycleError creates a new JSConsumerDeliverCycleErr error: "consumer deliver subject forms a cycle"
895
func NewJSConsumerDeliverCycleError(opts ...ErrorOption) *ApiError {
4✔
896
        eopts := parseOpts(opts)
4✔
897
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
898
                return ae
×
899
        }
×
900

901
        return ApiErrors[JSConsumerDeliverCycleErr]
4✔
902
}
903

904
// NewJSConsumerDeliverToWildcardsError creates a new JSConsumerDeliverToWildcardsErr error: "consumer deliver subject has wildcards"
905
func NewJSConsumerDeliverToWildcardsError(opts ...ErrorOption) *ApiError {
4✔
906
        eopts := parseOpts(opts)
4✔
907
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
908
                return ae
×
909
        }
×
910

911
        return ApiErrors[JSConsumerDeliverToWildcardsErr]
4✔
912
}
913

914
// NewJSConsumerDescriptionTooLongError creates a new JSConsumerDescriptionTooLongErrF error: "consumer description is too long, maximum allowed is {max}"
915
func NewJSConsumerDescriptionTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
1✔
916
        eopts := parseOpts(opts)
1✔
917
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
918
                return ae
×
919
        }
×
920

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

930
// NewJSConsumerDirectRequiresEphemeralError creates a new JSConsumerDirectRequiresEphemeralErr error: "consumer direct requires an ephemeral consumer"
931
func NewJSConsumerDirectRequiresEphemeralError(opts ...ErrorOption) *ApiError {
×
932
        eopts := parseOpts(opts)
×
933
        if ae, ok := eopts.err.(*ApiError); ok {
×
934
                return ae
×
935
        }
×
936

937
        return ApiErrors[JSConsumerDirectRequiresEphemeralErr]
×
938
}
939

940
// NewJSConsumerDirectRequiresPushError creates a new JSConsumerDirectRequiresPushErr error: "consumer direct requires a push based consumer"
941
func NewJSConsumerDirectRequiresPushError(opts ...ErrorOption) *ApiError {
×
942
        eopts := parseOpts(opts)
×
943
        if ae, ok := eopts.err.(*ApiError); ok {
×
944
                return ae
×
945
        }
×
946

947
        return ApiErrors[JSConsumerDirectRequiresPushErr]
×
948
}
949

950
// NewJSConsumerDoesNotExistError creates a new JSConsumerDoesNotExist error: "consumer does not exist"
951
func NewJSConsumerDoesNotExistError(opts ...ErrorOption) *ApiError {
3✔
952
        eopts := parseOpts(opts)
3✔
953
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
954
                return ae
×
955
        }
×
956

957
        return ApiErrors[JSConsumerDoesNotExist]
3✔
958
}
959

960
// NewJSConsumerDuplicateFilterSubjectsError creates a new JSConsumerDuplicateFilterSubjects error: "consumer cannot have both FilterSubject and FilterSubjects specified"
961
func NewJSConsumerDuplicateFilterSubjectsError(opts ...ErrorOption) *ApiError {
1✔
962
        eopts := parseOpts(opts)
1✔
963
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
964
                return ae
×
965
        }
×
966

967
        return ApiErrors[JSConsumerDuplicateFilterSubjects]
1✔
968
}
969

970
// NewJSConsumerDurableNameNotInSubjectError creates a new JSConsumerDurableNameNotInSubjectErr error: "consumer expected to be durable but no durable name set in subject"
971
func NewJSConsumerDurableNameNotInSubjectError(opts ...ErrorOption) *ApiError {
×
972
        eopts := parseOpts(opts)
×
973
        if ae, ok := eopts.err.(*ApiError); ok {
×
974
                return ae
×
975
        }
×
976

977
        return ApiErrors[JSConsumerDurableNameNotInSubjectErr]
×
978
}
979

980
// NewJSConsumerDurableNameNotMatchSubjectError creates a new JSConsumerDurableNameNotMatchSubjectErr error: "consumer name in subject does not match durable name in request"
981
func NewJSConsumerDurableNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
×
982
        eopts := parseOpts(opts)
×
983
        if ae, ok := eopts.err.(*ApiError); ok {
×
984
                return ae
×
985
        }
×
986

987
        return ApiErrors[JSConsumerDurableNameNotMatchSubjectErr]
×
988
}
989

990
// NewJSConsumerDurableNameNotSetError creates a new JSConsumerDurableNameNotSetErr error: "consumer expected to be durable but a durable name was not set"
991
func NewJSConsumerDurableNameNotSetError(opts ...ErrorOption) *ApiError {
1✔
992
        eopts := parseOpts(opts)
1✔
993
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
994
                return ae
×
995
        }
×
996

997
        return ApiErrors[JSConsumerDurableNameNotSetErr]
1✔
998
}
999

1000
// NewJSConsumerEmptyFilterError creates a new JSConsumerEmptyFilter error: "consumer filter in FilterSubjects cannot be empty"
1001
func NewJSConsumerEmptyFilterError(opts ...ErrorOption) *ApiError {
1✔
1002
        eopts := parseOpts(opts)
1✔
1003
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1004
                return ae
×
1005
        }
×
1006

1007
        return ApiErrors[JSConsumerEmptyFilter]
1✔
1008
}
1009

1010
// NewJSConsumerEmptyGroupNameError creates a new JSConsumerEmptyGroupName error: "Group name cannot be an empty string"
1011
func NewJSConsumerEmptyGroupNameError(opts ...ErrorOption) *ApiError {
4✔
1012
        eopts := parseOpts(opts)
4✔
1013
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1014
                return ae
×
1015
        }
×
1016

1017
        return ApiErrors[JSConsumerEmptyGroupName]
4✔
1018
}
1019

1020
// NewJSConsumerEphemeralWithDurableInSubjectError creates a new JSConsumerEphemeralWithDurableInSubjectErr error: "consumer expected to be ephemeral but detected a durable name set in subject"
1021
func NewJSConsumerEphemeralWithDurableInSubjectError(opts ...ErrorOption) *ApiError {
×
1022
        eopts := parseOpts(opts)
×
1023
        if ae, ok := eopts.err.(*ApiError); ok {
×
1024
                return ae
×
1025
        }
×
1026

1027
        return ApiErrors[JSConsumerEphemeralWithDurableInSubjectErr]
×
1028
}
1029

1030
// NewJSConsumerEphemeralWithDurableNameError creates a new JSConsumerEphemeralWithDurableNameErr error: "consumer expected to be ephemeral but a durable name was set in request"
1031
func NewJSConsumerEphemeralWithDurableNameError(opts ...ErrorOption) *ApiError {
3✔
1032
        eopts := parseOpts(opts)
3✔
1033
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1034
                return ae
×
1035
        }
×
1036

1037
        return ApiErrors[JSConsumerEphemeralWithDurableNameErr]
3✔
1038
}
1039

1040
// NewJSConsumerExistingActiveError creates a new JSConsumerExistingActiveErr error: "consumer already exists and is still active"
1041
func NewJSConsumerExistingActiveError(opts ...ErrorOption) *ApiError {
×
1042
        eopts := parseOpts(opts)
×
1043
        if ae, ok := eopts.err.(*ApiError); ok {
×
1044
                return ae
×
1045
        }
×
1046

1047
        return ApiErrors[JSConsumerExistingActiveErr]
×
1048
}
1049

1050
// NewJSConsumerFCRequiresPushError creates a new JSConsumerFCRequiresPushErr error: "consumer flow control requires a push based consumer"
1051
func NewJSConsumerFCRequiresPushError(opts ...ErrorOption) *ApiError {
×
1052
        eopts := parseOpts(opts)
×
1053
        if ae, ok := eopts.err.(*ApiError); ok {
×
1054
                return ae
×
1055
        }
×
1056

1057
        return ApiErrors[JSConsumerFCRequiresPushErr]
×
1058
}
1059

1060
// NewJSConsumerFilterNotSubsetError creates a new JSConsumerFilterNotSubsetErr error: "consumer filter subject is not a valid subset of the interest subjects"
1061
func NewJSConsumerFilterNotSubsetError(opts ...ErrorOption) *ApiError {
×
1062
        eopts := parseOpts(opts)
×
1063
        if ae, ok := eopts.err.(*ApiError); ok {
×
1064
                return ae
×
1065
        }
×
1066

1067
        return ApiErrors[JSConsumerFilterNotSubsetErr]
×
1068
}
1069

1070
// NewJSConsumerHBRequiresPushError creates a new JSConsumerHBRequiresPushErr error: "consumer idle heartbeat requires a push based consumer"
1071
func NewJSConsumerHBRequiresPushError(opts ...ErrorOption) *ApiError {
×
1072
        eopts := parseOpts(opts)
×
1073
        if ae, ok := eopts.err.(*ApiError); ok {
×
1074
                return ae
×
1075
        }
×
1076

1077
        return ApiErrors[JSConsumerHBRequiresPushErr]
×
1078
}
1079

1080
// NewJSConsumerInactiveThresholdExcessError creates a new JSConsumerInactiveThresholdExcess error: "consumer inactive threshold exceeds system limit of {limit}"
1081
func NewJSConsumerInactiveThresholdExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
2✔
1082
        eopts := parseOpts(opts)
2✔
1083
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1084
                return ae
×
1085
        }
×
1086

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

1096
// NewJSConsumerInvalidDeliverSubjectError creates a new JSConsumerInvalidDeliverSubject error: "invalid push consumer deliver subject"
1097
func NewJSConsumerInvalidDeliverSubjectError(opts ...ErrorOption) *ApiError {
2✔
1098
        eopts := parseOpts(opts)
2✔
1099
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1100
                return ae
×
1101
        }
×
1102

1103
        return ApiErrors[JSConsumerInvalidDeliverSubject]
2✔
1104
}
1105

1106
// NewJSConsumerInvalidGroupNameError creates a new JSConsumerInvalidGroupNameErr error: "Valid priority group name must match A-Z, a-z, 0-9, -_/=)+ and may not exceed 16 characters"
1107
func NewJSConsumerInvalidGroupNameError(opts ...ErrorOption) *ApiError {
4✔
1108
        eopts := parseOpts(opts)
4✔
1109
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1110
                return ae
×
1111
        }
×
1112

1113
        return ApiErrors[JSConsumerInvalidGroupNameErr]
4✔
1114
}
1115

1116
// NewJSConsumerInvalidPolicyError creates a new JSConsumerInvalidPolicyErrF error: "{err}"
1117
func NewJSConsumerInvalidPolicyError(err error, opts ...ErrorOption) *ApiError {
10✔
1118
        eopts := parseOpts(opts)
10✔
1119
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1120
                return ae
×
1121
        }
×
1122

1123
        e := ApiErrors[JSConsumerInvalidPolicyErrF]
10✔
1124
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1125
        return &ApiError{
10✔
1126
                Code:        e.Code,
10✔
1127
                ErrCode:     e.ErrCode,
10✔
1128
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1129
        }
10✔
1130
}
1131

1132
// NewJSConsumerInvalidPriorityGroupError creates a new JSConsumerInvalidPriorityGroupErr error: "Provided priority group does not exist for this consumer"
1133
func NewJSConsumerInvalidPriorityGroupError(opts ...ErrorOption) *ApiError {
2✔
1134
        eopts := parseOpts(opts)
2✔
1135
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1136
                return ae
×
1137
        }
×
1138

1139
        return ApiErrors[JSConsumerInvalidPriorityGroupErr]
2✔
1140
}
1141

1142
// NewJSConsumerInvalidSamplingError creates a new JSConsumerInvalidSamplingErrF error: "failed to parse consumer sampling configuration: {err}"
1143
func NewJSConsumerInvalidSamplingError(err error, opts ...ErrorOption) *ApiError {
×
1144
        eopts := parseOpts(opts)
×
1145
        if ae, ok := eopts.err.(*ApiError); ok {
×
1146
                return ae
×
1147
        }
×
1148

1149
        e := ApiErrors[JSConsumerInvalidSamplingErrF]
×
1150
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1151
        return &ApiError{
×
1152
                Code:        e.Code,
×
1153
                ErrCode:     e.ErrCode,
×
1154
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1155
        }
×
1156
}
1157

1158
// NewJSConsumerMaxDeliverBackoffError creates a new JSConsumerMaxDeliverBackoffErr error: "max deliver is required to be > length of backoff values"
1159
func NewJSConsumerMaxDeliverBackoffError(opts ...ErrorOption) *ApiError {
3✔
1160
        eopts := parseOpts(opts)
3✔
1161
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1162
                return ae
×
1163
        }
×
1164

1165
        return ApiErrors[JSConsumerMaxDeliverBackoffErr]
3✔
1166
}
1167

1168
// NewJSConsumerMaxPendingAckExcessError creates a new JSConsumerMaxPendingAckExcessErrF error: "consumer max ack pending exceeds system limit of {limit}"
1169
func NewJSConsumerMaxPendingAckExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
12✔
1170
        eopts := parseOpts(opts)
12✔
1171
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
1172
                return ae
×
1173
        }
×
1174

1175
        e := ApiErrors[JSConsumerMaxPendingAckExcessErrF]
12✔
1176
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
12✔
1177
        return &ApiError{
12✔
1178
                Code:        e.Code,
12✔
1179
                ErrCode:     e.ErrCode,
12✔
1180
                Description: strings.NewReplacer(args...).Replace(e.Description),
12✔
1181
        }
12✔
1182
}
1183

1184
// NewJSConsumerMaxPendingAckPolicyRequiredError creates a new JSConsumerMaxPendingAckPolicyRequiredErr error: "consumer requires ack policy for max ack pending"
1185
func NewJSConsumerMaxPendingAckPolicyRequiredError(opts ...ErrorOption) *ApiError {
2✔
1186
        eopts := parseOpts(opts)
2✔
1187
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1188
                return ae
×
1189
        }
×
1190

1191
        return ApiErrors[JSConsumerMaxPendingAckPolicyRequiredErr]
2✔
1192
}
1193

1194
// NewJSConsumerMaxRequestBatchExceededError creates a new JSConsumerMaxRequestBatchExceededF error: "consumer max request batch exceeds server limit of {limit}"
1195
func NewJSConsumerMaxRequestBatchExceededError(limit interface{}, opts ...ErrorOption) *ApiError {
4✔
1196
        eopts := parseOpts(opts)
4✔
1197
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1198
                return ae
×
1199
        }
×
1200

1201
        e := ApiErrors[JSConsumerMaxRequestBatchExceededF]
4✔
1202
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
4✔
1203
        return &ApiError{
4✔
1204
                Code:        e.Code,
4✔
1205
                ErrCode:     e.ErrCode,
4✔
1206
                Description: strings.NewReplacer(args...).Replace(e.Description),
4✔
1207
        }
4✔
1208
}
1209

1210
// NewJSConsumerMaxRequestBatchNegativeError creates a new JSConsumerMaxRequestBatchNegativeErr error: "consumer max request batch needs to be > 0"
1211
func NewJSConsumerMaxRequestBatchNegativeError(opts ...ErrorOption) *ApiError {
×
1212
        eopts := parseOpts(opts)
×
1213
        if ae, ok := eopts.err.(*ApiError); ok {
×
1214
                return ae
×
1215
        }
×
1216

1217
        return ApiErrors[JSConsumerMaxRequestBatchNegativeErr]
×
1218
}
1219

1220
// NewJSConsumerMaxRequestExpiresToSmallError creates a new JSConsumerMaxRequestExpiresToSmall error: "consumer max request expires needs to be >= 1ms"
1221
func NewJSConsumerMaxRequestExpiresToSmallError(opts ...ErrorOption) *ApiError {
×
1222
        eopts := parseOpts(opts)
×
1223
        if ae, ok := eopts.err.(*ApiError); ok {
×
1224
                return ae
×
1225
        }
×
1226

1227
        return ApiErrors[JSConsumerMaxRequestExpiresToSmall]
×
1228
}
1229

1230
// NewJSConsumerMaxWaitingNegativeError creates a new JSConsumerMaxWaitingNegativeErr error: "consumer max waiting needs to be positive"
1231
func NewJSConsumerMaxWaitingNegativeError(opts ...ErrorOption) *ApiError {
2✔
1232
        eopts := parseOpts(opts)
2✔
1233
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1234
                return ae
×
1235
        }
×
1236

1237
        return ApiErrors[JSConsumerMaxWaitingNegativeErr]
2✔
1238
}
1239

1240
// NewJSConsumerMetadataLengthError creates a new JSConsumerMetadataLengthErrF error: "consumer metadata exceeds maximum size of {limit}"
1241
func NewJSConsumerMetadataLengthError(limit interface{}, opts ...ErrorOption) *ApiError {
1✔
1242
        eopts := parseOpts(opts)
1✔
1243
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1244
                return ae
×
1245
        }
×
1246

1247
        e := ApiErrors[JSConsumerMetadataLengthErrF]
1✔
1248
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
1✔
1249
        return &ApiError{
1✔
1250
                Code:        e.Code,
1✔
1251
                ErrCode:     e.ErrCode,
1✔
1252
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1253
        }
1✔
1254
}
1255

1256
// NewJSConsumerMultipleFiltersNotAllowedError creates a new JSConsumerMultipleFiltersNotAllowed error: "consumer with multiple subject filters cannot use subject based API"
1257
func NewJSConsumerMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
1258
        eopts := parseOpts(opts)
1✔
1259
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1260
                return ae
×
1261
        }
×
1262

1263
        return ApiErrors[JSConsumerMultipleFiltersNotAllowed]
1✔
1264
}
1265

1266
// NewJSConsumerNameContainsPathSeparatorsError creates a new JSConsumerNameContainsPathSeparatorsErr error: "Consumer name can not contain path separators"
1267
func NewJSConsumerNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
8✔
1268
        eopts := parseOpts(opts)
8✔
1269
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1270
                return ae
×
1271
        }
×
1272

1273
        return ApiErrors[JSConsumerNameContainsPathSeparatorsErr]
8✔
1274
}
1275

1276
// NewJSConsumerNameExistError creates a new JSConsumerNameExistErr error: "consumer name already in use"
1277
func NewJSConsumerNameExistError(opts ...ErrorOption) *ApiError {
2✔
1278
        eopts := parseOpts(opts)
2✔
1279
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1280
                return ae
×
1281
        }
×
1282

1283
        return ApiErrors[JSConsumerNameExistErr]
2✔
1284
}
1285

1286
// NewJSConsumerNameTooLongError creates a new JSConsumerNameTooLongErrF error: "consumer name is too long, maximum allowed is {max}"
1287
func NewJSConsumerNameTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
×
1288
        eopts := parseOpts(opts)
×
1289
        if ae, ok := eopts.err.(*ApiError); ok {
×
1290
                return ae
×
1291
        }
×
1292

1293
        e := ApiErrors[JSConsumerNameTooLongErrF]
×
1294
        args := e.toReplacerArgs([]interface{}{"{max}", max})
×
1295
        return &ApiError{
×
1296
                Code:        e.Code,
×
1297
                ErrCode:     e.ErrCode,
×
1298
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1299
        }
×
1300
}
1301

1302
// NewJSConsumerNotFoundError creates a new JSConsumerNotFoundErr error: "consumer not found"
1303
func NewJSConsumerNotFoundError(opts ...ErrorOption) *ApiError {
2,763✔
1304
        eopts := parseOpts(opts)
2,763✔
1305
        if ae, ok := eopts.err.(*ApiError); ok {
2,763✔
1306
                return ae
×
1307
        }
×
1308

1309
        return ApiErrors[JSConsumerNotFoundErr]
2,763✔
1310
}
1311

1312
// NewJSConsumerOfflineError creates a new JSConsumerOfflineErr error: "consumer is offline"
1313
func NewJSConsumerOfflineError(opts ...ErrorOption) *ApiError {
2✔
1314
        eopts := parseOpts(opts)
2✔
1315
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1316
                return ae
×
1317
        }
×
1318

1319
        return ApiErrors[JSConsumerOfflineErr]
2✔
1320
}
1321

1322
// NewJSConsumerOnMappedError creates a new JSConsumerOnMappedErr error: "consumer direct on a mapped consumer"
1323
func NewJSConsumerOnMappedError(opts ...ErrorOption) *ApiError {
×
1324
        eopts := parseOpts(opts)
×
1325
        if ae, ok := eopts.err.(*ApiError); ok {
×
1326
                return ae
×
1327
        }
×
1328

1329
        return ApiErrors[JSConsumerOnMappedErr]
×
1330
}
1331

1332
// NewJSConsumerOverlappingSubjectFiltersError creates a new JSConsumerOverlappingSubjectFilters error: "consumer subject filters cannot overlap"
1333
func NewJSConsumerOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
1✔
1334
        eopts := parseOpts(opts)
1✔
1335
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1336
                return ae
×
1337
        }
×
1338

1339
        return ApiErrors[JSConsumerOverlappingSubjectFilters]
1✔
1340
}
1341

1342
// NewJSConsumerPriorityPolicyWithoutGroupError creates a new JSConsumerPriorityPolicyWithoutGroup error: "Setting PriorityPolicy requires at least one PriorityGroup to be set"
1343
func NewJSConsumerPriorityPolicyWithoutGroupError(opts ...ErrorOption) *ApiError {
4✔
1344
        eopts := parseOpts(opts)
4✔
1345
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1346
                return ae
×
1347
        }
×
1348

1349
        return ApiErrors[JSConsumerPriorityPolicyWithoutGroup]
4✔
1350
}
1351

1352
// NewJSConsumerPullNotDurableError creates a new JSConsumerPullNotDurableErr error: "consumer in pull mode requires a durable name"
1353
func NewJSConsumerPullNotDurableError(opts ...ErrorOption) *ApiError {
×
1354
        eopts := parseOpts(opts)
×
1355
        if ae, ok := eopts.err.(*ApiError); ok {
×
1356
                return ae
×
1357
        }
×
1358

1359
        return ApiErrors[JSConsumerPullNotDurableErr]
×
1360
}
1361

1362
// NewJSConsumerPullRequiresAckError creates a new JSConsumerPullRequiresAckErr error: "consumer in pull mode requires explicit ack policy on workqueue stream"
1363
func NewJSConsumerPullRequiresAckError(opts ...ErrorOption) *ApiError {
6✔
1364
        eopts := parseOpts(opts)
6✔
1365
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1366
                return ae
×
1367
        }
×
1368

1369
        return ApiErrors[JSConsumerPullRequiresAckErr]
6✔
1370
}
1371

1372
// NewJSConsumerPullWithRateLimitError creates a new JSConsumerPullWithRateLimitErr error: "consumer in pull mode can not have rate limit set"
1373
func NewJSConsumerPullWithRateLimitError(opts ...ErrorOption) *ApiError {
1✔
1374
        eopts := parseOpts(opts)
1✔
1375
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1376
                return ae
×
1377
        }
×
1378

1379
        return ApiErrors[JSConsumerPullWithRateLimitErr]
1✔
1380
}
1381

1382
// NewJSConsumerPushMaxWaitingError creates a new JSConsumerPushMaxWaitingErr error: "consumer in push mode can not set max waiting"
1383
func NewJSConsumerPushMaxWaitingError(opts ...ErrorOption) *ApiError {
3✔
1384
        eopts := parseOpts(opts)
3✔
1385
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1386
                return ae
×
1387
        }
×
1388

1389
        return ApiErrors[JSConsumerPushMaxWaitingErr]
3✔
1390
}
1391

1392
// NewJSConsumerReplacementWithDifferentNameError creates a new JSConsumerReplacementWithDifferentNameErr error: "consumer replacement durable config not the same"
1393
func NewJSConsumerReplacementWithDifferentNameError(opts ...ErrorOption) *ApiError {
×
1394
        eopts := parseOpts(opts)
×
1395
        if ae, ok := eopts.err.(*ApiError); ok {
×
1396
                return ae
×
1397
        }
×
1398

1399
        return ApiErrors[JSConsumerReplacementWithDifferentNameErr]
×
1400
}
1401

1402
// NewJSConsumerReplicasExceedsStreamError creates a new JSConsumerReplicasExceedsStream error: "consumer config replica count exceeds parent stream"
1403
func NewJSConsumerReplicasExceedsStreamError(opts ...ErrorOption) *ApiError {
1✔
1404
        eopts := parseOpts(opts)
1✔
1405
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1406
                return ae
×
1407
        }
×
1408

1409
        return ApiErrors[JSConsumerReplicasExceedsStream]
1✔
1410
}
1411

1412
// NewJSConsumerReplicasShouldMatchStreamError creates a new JSConsumerReplicasShouldMatchStream error: "consumer config replicas must match interest retention stream's replicas"
1413
func NewJSConsumerReplicasShouldMatchStreamError(opts ...ErrorOption) *ApiError {
2✔
1414
        eopts := parseOpts(opts)
2✔
1415
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1416
                return ae
×
1417
        }
×
1418

1419
        return ApiErrors[JSConsumerReplicasShouldMatchStream]
2✔
1420
}
1421

1422
// NewJSConsumerSmallHeartbeatError creates a new JSConsumerSmallHeartbeatErr error: "consumer idle heartbeat needs to be >= 100ms"
1423
func NewJSConsumerSmallHeartbeatError(opts ...ErrorOption) *ApiError {
1✔
1424
        eopts := parseOpts(opts)
1✔
1425
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1426
                return ae
×
1427
        }
×
1428

1429
        return ApiErrors[JSConsumerSmallHeartbeatErr]
1✔
1430
}
1431

1432
// NewJSConsumerStoreFailedError creates a new JSConsumerStoreFailedErrF error: "error creating store for consumer: {err}"
1433
func NewJSConsumerStoreFailedError(err error, opts ...ErrorOption) *ApiError {
10✔
1434
        eopts := parseOpts(opts)
10✔
1435
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1436
                return ae
×
1437
        }
×
1438

1439
        e := ApiErrors[JSConsumerStoreFailedErrF]
10✔
1440
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1441
        return &ApiError{
10✔
1442
                Code:        e.Code,
10✔
1443
                ErrCode:     e.ErrCode,
10✔
1444
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1445
        }
10✔
1446
}
1447

1448
// NewJSConsumerWQConsumerNotDeliverAllError creates a new JSConsumerWQConsumerNotDeliverAllErr error: "consumer must be deliver all on workqueue stream"
1449
func NewJSConsumerWQConsumerNotDeliverAllError(opts ...ErrorOption) *ApiError {
×
1450
        eopts := parseOpts(opts)
×
1451
        if ae, ok := eopts.err.(*ApiError); ok {
×
1452
                return ae
×
1453
        }
×
1454

1455
        return ApiErrors[JSConsumerWQConsumerNotDeliverAllErr]
×
1456
}
1457

1458
// NewJSConsumerWQConsumerNotUniqueError creates a new JSConsumerWQConsumerNotUniqueErr error: "filtered consumer not unique on workqueue stream"
1459
func NewJSConsumerWQConsumerNotUniqueError(opts ...ErrorOption) *ApiError {
11✔
1460
        eopts := parseOpts(opts)
11✔
1461
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
1462
                return ae
×
1463
        }
×
1464

1465
        return ApiErrors[JSConsumerWQConsumerNotUniqueErr]
11✔
1466
}
1467

1468
// NewJSConsumerWQMultipleUnfilteredError creates a new JSConsumerWQMultipleUnfilteredErr error: "multiple non-filtered consumers not allowed on workqueue stream"
1469
func NewJSConsumerWQMultipleUnfilteredError(opts ...ErrorOption) *ApiError {
2✔
1470
        eopts := parseOpts(opts)
2✔
1471
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1472
                return ae
×
1473
        }
×
1474

1475
        return ApiErrors[JSConsumerWQMultipleUnfilteredErr]
2✔
1476
}
1477

1478
// NewJSConsumerWQRequiresExplicitAckError creates a new JSConsumerWQRequiresExplicitAckErr error: "workqueue stream requires explicit ack"
1479
func NewJSConsumerWQRequiresExplicitAckError(opts ...ErrorOption) *ApiError {
×
1480
        eopts := parseOpts(opts)
×
1481
        if ae, ok := eopts.err.(*ApiError); ok {
×
1482
                return ae
×
1483
        }
×
1484

1485
        return ApiErrors[JSConsumerWQRequiresExplicitAckErr]
×
1486
}
1487

1488
// NewJSConsumerWithFlowControlNeedsHeartbeatsError creates a new JSConsumerWithFlowControlNeedsHeartbeats error: "consumer with flow control also needs heartbeats"
1489
func NewJSConsumerWithFlowControlNeedsHeartbeatsError(opts ...ErrorOption) *ApiError {
4✔
1490
        eopts := parseOpts(opts)
4✔
1491
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1492
                return ae
×
1493
        }
×
1494

1495
        return ApiErrors[JSConsumerWithFlowControlNeedsHeartbeats]
4✔
1496
}
1497

1498
// NewJSInsufficientResourcesError creates a new JSInsufficientResourcesErr error: "insufficient resources"
1499
func NewJSInsufficientResourcesError(opts ...ErrorOption) *ApiError {
10✔
1500
        eopts := parseOpts(opts)
10✔
1501
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1502
                return ae
×
1503
        }
×
1504

1505
        return ApiErrors[JSInsufficientResourcesErr]
10✔
1506
}
1507

1508
// NewJSInvalidJSONError creates a new JSInvalidJSONErr error: "invalid JSON: {err}"
1509
func NewJSInvalidJSONError(err error, opts ...ErrorOption) *ApiError {
10✔
1510
        eopts := parseOpts(opts)
10✔
1511
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1512
                return ae
×
1513
        }
×
1514

1515
        e := ApiErrors[JSInvalidJSONErr]
10✔
1516
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1517
        return &ApiError{
10✔
1518
                Code:        e.Code,
10✔
1519
                ErrCode:     e.ErrCode,
10✔
1520
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1521
        }
10✔
1522
}
1523

1524
// NewJSMaximumConsumersLimitError creates a new JSMaximumConsumersLimitErr error: "maximum consumers limit reached"
1525
func NewJSMaximumConsumersLimitError(opts ...ErrorOption) *ApiError {
29✔
1526
        eopts := parseOpts(opts)
29✔
1527
        if ae, ok := eopts.err.(*ApiError); ok {
29✔
1528
                return ae
×
1529
        }
×
1530

1531
        return ApiErrors[JSMaximumConsumersLimitErr]
29✔
1532
}
1533

1534
// NewJSMaximumStreamsLimitError creates a new JSMaximumStreamsLimitErr error: "maximum number of streams reached"
1535
func NewJSMaximumStreamsLimitError(opts ...ErrorOption) *ApiError {
16✔
1536
        eopts := parseOpts(opts)
16✔
1537
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
1538
                return ae
×
1539
        }
×
1540

1541
        return ApiErrors[JSMaximumStreamsLimitErr]
16✔
1542
}
1543

1544
// NewJSMemoryResourcesExceededError creates a new JSMemoryResourcesExceededErr error: "insufficient memory resources available"
1545
func NewJSMemoryResourcesExceededError(opts ...ErrorOption) *ApiError {
4✔
1546
        eopts := parseOpts(opts)
4✔
1547
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1548
                return ae
×
1549
        }
×
1550

1551
        return ApiErrors[JSMemoryResourcesExceededErr]
4✔
1552
}
1553

1554
// NewJSMessageTTLInvalidError creates a new JSMessageTTLInvalidErr error: "invalid per-message TTL"
1555
func NewJSMessageTTLInvalidError(opts ...ErrorOption) *ApiError {
4✔
1556
        eopts := parseOpts(opts)
4✔
1557
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1558
                return ae
×
1559
        }
×
1560

1561
        return ApiErrors[JSMessageTTLInvalidErr]
4✔
1562
}
1563

1564
// NewJSMirrorConsumerSetupFailedError creates a new JSMirrorConsumerSetupFailedErrF error: "{err}"
1565
func NewJSMirrorConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
1566
        eopts := parseOpts(opts)
×
1567
        if ae, ok := eopts.err.(*ApiError); ok {
×
1568
                return ae
×
1569
        }
×
1570

1571
        e := ApiErrors[JSMirrorConsumerSetupFailedErrF]
×
1572
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1573
        return &ApiError{
×
1574
                Code:        e.Code,
×
1575
                ErrCode:     e.ErrCode,
×
1576
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1577
        }
×
1578
}
1579

1580
// NewJSMirrorInvalidStreamNameError creates a new JSMirrorInvalidStreamName error: "mirrored stream name is invalid"
1581
func NewJSMirrorInvalidStreamNameError(opts ...ErrorOption) *ApiError {
×
1582
        eopts := parseOpts(opts)
×
1583
        if ae, ok := eopts.err.(*ApiError); ok {
×
1584
                return ae
×
1585
        }
×
1586

1587
        return ApiErrors[JSMirrorInvalidStreamName]
×
1588
}
1589

1590
// NewJSMirrorInvalidSubjectFilterError creates a new JSMirrorInvalidSubjectFilter error: "mirror transform source: {err}"
1591
func NewJSMirrorInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
2✔
1592
        eopts := parseOpts(opts)
2✔
1593
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1594
                return ae
×
1595
        }
×
1596

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

1606
// NewJSMirrorInvalidTransformDestinationError creates a new JSMirrorInvalidTransformDestination error: "mirror transform: {err}"
1607
func NewJSMirrorInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
2✔
1608
        eopts := parseOpts(opts)
2✔
1609
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1610
                return ae
×
1611
        }
×
1612

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

1622
// NewJSMirrorMaxMessageSizeTooBigError creates a new JSMirrorMaxMessageSizeTooBigErr error: "stream mirror must have max message size >= source"
1623
func NewJSMirrorMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
1624
        eopts := parseOpts(opts)
×
1625
        if ae, ok := eopts.err.(*ApiError); ok {
×
1626
                return ae
×
1627
        }
×
1628

1629
        return ApiErrors[JSMirrorMaxMessageSizeTooBigErr]
×
1630
}
1631

1632
// NewJSMirrorMultipleFiltersNotAllowedError creates a new JSMirrorMultipleFiltersNotAllowed error: "mirror with multiple subject transforms cannot also have a single subject filter"
1633
func NewJSMirrorMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
1634
        eopts := parseOpts(opts)
1✔
1635
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1636
                return ae
×
1637
        }
×
1638

1639
        return ApiErrors[JSMirrorMultipleFiltersNotAllowed]
1✔
1640
}
1641

1642
// NewJSMirrorOverlappingSubjectFiltersError creates a new JSMirrorOverlappingSubjectFilters error: "mirror subject filters can not overlap"
1643
func NewJSMirrorOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
2✔
1644
        eopts := parseOpts(opts)
2✔
1645
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1646
                return ae
×
1647
        }
×
1648

1649
        return ApiErrors[JSMirrorOverlappingSubjectFilters]
2✔
1650
}
1651

1652
// NewJSMirrorWithFirstSeqError creates a new JSMirrorWithFirstSeqErr error: "stream mirrors can not have first sequence configured"
1653
func NewJSMirrorWithFirstSeqError(opts ...ErrorOption) *ApiError {
2✔
1654
        eopts := parseOpts(opts)
2✔
1655
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1656
                return ae
×
1657
        }
×
1658

1659
        return ApiErrors[JSMirrorWithFirstSeqErr]
2✔
1660
}
1661

1662
// NewJSMirrorWithSourcesError creates a new JSMirrorWithSourcesErr error: "stream mirrors can not also contain other sources"
1663
func NewJSMirrorWithSourcesError(opts ...ErrorOption) *ApiError {
×
1664
        eopts := parseOpts(opts)
×
1665
        if ae, ok := eopts.err.(*ApiError); ok {
×
1666
                return ae
×
1667
        }
×
1668

1669
        return ApiErrors[JSMirrorWithSourcesErr]
×
1670
}
1671

1672
// NewJSMirrorWithStartSeqAndTimeError creates a new JSMirrorWithStartSeqAndTimeErr error: "stream mirrors can not have both start seq and start time configured"
1673
func NewJSMirrorWithStartSeqAndTimeError(opts ...ErrorOption) *ApiError {
×
1674
        eopts := parseOpts(opts)
×
1675
        if ae, ok := eopts.err.(*ApiError); ok {
×
1676
                return ae
×
1677
        }
×
1678

1679
        return ApiErrors[JSMirrorWithStartSeqAndTimeErr]
×
1680
}
1681

1682
// NewJSMirrorWithSubjectFiltersError creates a new JSMirrorWithSubjectFiltersErr error: "stream mirrors can not contain filtered subjects"
1683
func NewJSMirrorWithSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
1684
        eopts := parseOpts(opts)
×
1685
        if ae, ok := eopts.err.(*ApiError); ok {
×
1686
                return ae
×
1687
        }
×
1688

1689
        return ApiErrors[JSMirrorWithSubjectFiltersErr]
×
1690
}
1691

1692
// NewJSMirrorWithSubjectsError creates a new JSMirrorWithSubjectsErr error: "stream mirrors can not contain subjects"
1693
func NewJSMirrorWithSubjectsError(opts ...ErrorOption) *ApiError {
2✔
1694
        eopts := parseOpts(opts)
2✔
1695
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1696
                return ae
×
1697
        }
×
1698

1699
        return ApiErrors[JSMirrorWithSubjectsErr]
2✔
1700
}
1701

1702
// NewJSNoAccountError creates a new JSNoAccountErr error: "account not found"
1703
func NewJSNoAccountError(opts ...ErrorOption) *ApiError {
3✔
1704
        eopts := parseOpts(opts)
3✔
1705
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1706
                return ae
×
1707
        }
×
1708

1709
        return ApiErrors[JSNoAccountErr]
3✔
1710
}
1711

1712
// NewJSNoLimitsError creates a new JSNoLimitsErr error: "no JetStream default or applicable tiered limit present"
1713
func NewJSNoLimitsError(opts ...ErrorOption) *ApiError {
4✔
1714
        eopts := parseOpts(opts)
4✔
1715
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1716
                return ae
×
1717
        }
×
1718

1719
        return ApiErrors[JSNoLimitsErr]
4✔
1720
}
1721

1722
// NewJSNoMessageFoundError creates a new JSNoMessageFoundErr error: "no message found"
1723
func NewJSNoMessageFoundError(opts ...ErrorOption) *ApiError {
392✔
1724
        eopts := parseOpts(opts)
392✔
1725
        if ae, ok := eopts.err.(*ApiError); ok {
392✔
1726
                return ae
×
1727
        }
×
1728

1729
        return ApiErrors[JSNoMessageFoundErr]
392✔
1730
}
1731

1732
// NewJSNotEmptyRequestError creates a new JSNotEmptyRequestErr error: "expected an empty request payload"
1733
func NewJSNotEmptyRequestError(opts ...ErrorOption) *ApiError {
3✔
1734
        eopts := parseOpts(opts)
3✔
1735
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1736
                return ae
×
1737
        }
×
1738

1739
        return ApiErrors[JSNotEmptyRequestErr]
3✔
1740
}
1741

1742
// NewJSNotEnabledError creates a new JSNotEnabledErr error: "JetStream not enabled"
1743
func NewJSNotEnabledError(opts ...ErrorOption) *ApiError {
10✔
1744
        eopts := parseOpts(opts)
10✔
1745
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1746
                return ae
×
1747
        }
×
1748

1749
        return ApiErrors[JSNotEnabledErr]
10✔
1750
}
1751

1752
// NewJSNotEnabledForAccountError creates a new JSNotEnabledForAccountErr error: "JetStream not enabled for account"
1753
func NewJSNotEnabledForAccountError(opts ...ErrorOption) *ApiError {
361✔
1754
        eopts := parseOpts(opts)
361✔
1755
        if ae, ok := eopts.err.(*ApiError); ok {
361✔
1756
                return ae
×
1757
        }
×
1758

1759
        return ApiErrors[JSNotEnabledForAccountErr]
361✔
1760
}
1761

1762
// NewJSPedanticError creates a new JSPedanticErrF error: "pedantic mode: {err}"
1763
func NewJSPedanticError(err error, opts ...ErrorOption) *ApiError {
8✔
1764
        eopts := parseOpts(opts)
8✔
1765
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1766
                return ae
×
1767
        }
×
1768

1769
        e := ApiErrors[JSPedanticErrF]
8✔
1770
        args := e.toReplacerArgs([]interface{}{"{err}", err})
8✔
1771
        return &ApiError{
8✔
1772
                Code:        e.Code,
8✔
1773
                ErrCode:     e.ErrCode,
8✔
1774
                Description: strings.NewReplacer(args...).Replace(e.Description),
8✔
1775
        }
8✔
1776
}
1777

1778
// NewJSPeerRemapError creates a new JSPeerRemapErr error: "peer remap failed"
1779
func NewJSPeerRemapError(opts ...ErrorOption) *ApiError {
5✔
1780
        eopts := parseOpts(opts)
5✔
1781
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1782
                return ae
1✔
1783
        }
1✔
1784

1785
        return ApiErrors[JSPeerRemapErr]
4✔
1786
}
1787

1788
// NewJSRaftGeneralError creates a new JSRaftGeneralErrF error: "{err}"
1789
func NewJSRaftGeneralError(err error, opts ...ErrorOption) *ApiError {
×
1790
        eopts := parseOpts(opts)
×
1791
        if ae, ok := eopts.err.(*ApiError); ok {
×
1792
                return ae
×
1793
        }
×
1794

1795
        e := ApiErrors[JSRaftGeneralErrF]
×
1796
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1797
        return &ApiError{
×
1798
                Code:        e.Code,
×
1799
                ErrCode:     e.ErrCode,
×
1800
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1801
        }
×
1802
}
1803

1804
// NewJSReplicasCountCannotBeNegativeError creates a new JSReplicasCountCannotBeNegative error: "replicas count cannot be negative"
1805
func NewJSReplicasCountCannotBeNegativeError(opts ...ErrorOption) *ApiError {
16✔
1806
        eopts := parseOpts(opts)
16✔
1807
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
1808
                return ae
×
1809
        }
×
1810

1811
        return ApiErrors[JSReplicasCountCannotBeNegative]
16✔
1812
}
1813

1814
// NewJSRestoreSubscribeFailedError creates a new JSRestoreSubscribeFailedErrF error: "JetStream unable to subscribe to restore snapshot {subject}: {err}"
1815
func NewJSRestoreSubscribeFailedError(err error, subject interface{}, opts ...ErrorOption) *ApiError {
1✔
1816
        eopts := parseOpts(opts)
1✔
1817
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1818
                return ae
×
1819
        }
×
1820

1821
        e := ApiErrors[JSRestoreSubscribeFailedErrF]
1✔
1822
        args := e.toReplacerArgs([]interface{}{"{err}", err, "{subject}", subject})
1✔
1823
        return &ApiError{
1✔
1824
                Code:        e.Code,
1✔
1825
                ErrCode:     e.ErrCode,
1✔
1826
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1827
        }
1✔
1828
}
1829

1830
// NewJSSequenceNotFoundError creates a new JSSequenceNotFoundErrF error: "sequence {seq} not found"
1831
func NewJSSequenceNotFoundError(seq uint64, opts ...ErrorOption) *ApiError {
×
1832
        eopts := parseOpts(opts)
×
1833
        if ae, ok := eopts.err.(*ApiError); ok {
×
1834
                return ae
×
1835
        }
×
1836

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

1846
// NewJSSnapshotDeliverSubjectInvalidError creates a new JSSnapshotDeliverSubjectInvalidErr error: "deliver subject not valid"
1847
func NewJSSnapshotDeliverSubjectInvalidError(opts ...ErrorOption) *ApiError {
1✔
1848
        eopts := parseOpts(opts)
1✔
1849
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1850
                return ae
×
1851
        }
×
1852

1853
        return ApiErrors[JSSnapshotDeliverSubjectInvalidErr]
1✔
1854
}
1855

1856
// NewJSSourceConsumerSetupFailedError creates a new JSSourceConsumerSetupFailedErrF error: "{err}"
1857
func NewJSSourceConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
1858
        eopts := parseOpts(opts)
×
1859
        if ae, ok := eopts.err.(*ApiError); ok {
×
1860
                return ae
×
1861
        }
×
1862

1863
        e := ApiErrors[JSSourceConsumerSetupFailedErrF]
×
1864
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1865
        return &ApiError{
×
1866
                Code:        e.Code,
×
1867
                ErrCode:     e.ErrCode,
×
1868
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1869
        }
×
1870
}
1871

1872
// NewJSSourceDuplicateDetectedError creates a new JSSourceDuplicateDetected error: "duplicate source configuration detected"
1873
func NewJSSourceDuplicateDetectedError(opts ...ErrorOption) *ApiError {
×
1874
        eopts := parseOpts(opts)
×
1875
        if ae, ok := eopts.err.(*ApiError); ok {
×
1876
                return ae
×
1877
        }
×
1878

1879
        return ApiErrors[JSSourceDuplicateDetected]
×
1880
}
1881

1882
// NewJSSourceInvalidStreamNameError creates a new JSSourceInvalidStreamName error: "sourced stream name is invalid"
1883
func NewJSSourceInvalidStreamNameError(opts ...ErrorOption) *ApiError {
1✔
1884
        eopts := parseOpts(opts)
1✔
1885
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1886
                return ae
×
1887
        }
×
1888

1889
        return ApiErrors[JSSourceInvalidStreamName]
1✔
1890
}
1891

1892
// NewJSSourceInvalidSubjectFilterError creates a new JSSourceInvalidSubjectFilter error: "source transform source: {err}"
1893
func NewJSSourceInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
1✔
1894
        eopts := parseOpts(opts)
1✔
1895
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1896
                return ae
×
1897
        }
×
1898

1899
        e := ApiErrors[JSSourceInvalidSubjectFilter]
1✔
1900
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
1901
        return &ApiError{
1✔
1902
                Code:        e.Code,
1✔
1903
                ErrCode:     e.ErrCode,
1✔
1904
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1905
        }
1✔
1906
}
1907

1908
// NewJSSourceInvalidTransformDestinationError creates a new JSSourceInvalidTransformDestination error: "source transform: {err}"
1909
func NewJSSourceInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
1910
        eopts := parseOpts(opts)
1✔
1911
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1912
                return ae
×
1913
        }
×
1914

1915
        e := ApiErrors[JSSourceInvalidTransformDestination]
1✔
1916
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
1917
        return &ApiError{
1✔
1918
                Code:        e.Code,
1✔
1919
                ErrCode:     e.ErrCode,
1✔
1920
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1921
        }
1✔
1922
}
1923

1924
// NewJSSourceMaxMessageSizeTooBigError creates a new JSSourceMaxMessageSizeTooBigErr error: "stream source must have max message size >= target"
1925
func NewJSSourceMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
1926
        eopts := parseOpts(opts)
×
1927
        if ae, ok := eopts.err.(*ApiError); ok {
×
1928
                return ae
×
1929
        }
×
1930

1931
        return ApiErrors[JSSourceMaxMessageSizeTooBigErr]
×
1932
}
1933

1934
// NewJSSourceMultipleFiltersNotAllowedError creates a new JSSourceMultipleFiltersNotAllowed error: "source with multiple subject transforms cannot also have a single subject filter"
1935
func NewJSSourceMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
×
1936
        eopts := parseOpts(opts)
×
1937
        if ae, ok := eopts.err.(*ApiError); ok {
×
1938
                return ae
×
1939
        }
×
1940

1941
        return ApiErrors[JSSourceMultipleFiltersNotAllowed]
×
1942
}
1943

1944
// NewJSSourceOverlappingSubjectFiltersError creates a new JSSourceOverlappingSubjectFilters error: "source filters can not overlap"
1945
func NewJSSourceOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
1946
        eopts := parseOpts(opts)
×
1947
        if ae, ok := eopts.err.(*ApiError); ok {
×
1948
                return ae
×
1949
        }
×
1950

1951
        return ApiErrors[JSSourceOverlappingSubjectFilters]
×
1952
}
1953

1954
// NewJSStorageResourcesExceededError creates a new JSStorageResourcesExceededErr error: "insufficient storage resources available"
1955
func NewJSStorageResourcesExceededError(opts ...ErrorOption) *ApiError {
25✔
1956
        eopts := parseOpts(opts)
25✔
1957
        if ae, ok := eopts.err.(*ApiError); ok {
25✔
1958
                return ae
×
1959
        }
×
1960

1961
        return ApiErrors[JSStorageResourcesExceededErr]
25✔
1962
}
1963

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

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

1980
// NewJSStreamCreateError creates a new JSStreamCreateErrF error: "{err}"
1981
func NewJSStreamCreateError(err error, opts ...ErrorOption) *ApiError {
66✔
1982
        eopts := parseOpts(opts)
66✔
1983
        if ae, ok := eopts.err.(*ApiError); ok {
132✔
1984
                return ae
66✔
1985
        }
66✔
1986

1987
        e := ApiErrors[JSStreamCreateErrF]
×
1988
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1989
        return &ApiError{
×
1990
                Code:        e.Code,
×
1991
                ErrCode:     e.ErrCode,
×
1992
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1993
        }
×
1994
}
1995

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

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

2012
// NewJSStreamDuplicateMessageConflictError creates a new JSStreamDuplicateMessageConflict error: "duplicate message id is in process"
2013
func NewJSStreamDuplicateMessageConflictError(opts ...ErrorOption) *ApiError {
×
2014
        eopts := parseOpts(opts)
×
2015
        if ae, ok := eopts.err.(*ApiError); ok {
×
2016
                return ae
×
2017
        }
×
2018

2019
        return ApiErrors[JSStreamDuplicateMessageConflict]
×
2020
}
2021

2022
// NewJSStreamExpectedLastSeqPerSubjectNotReadyError creates a new JSStreamExpectedLastSeqPerSubjectNotReady error: "expected last sequence per subject temporarily unavailable"
2023
func NewJSStreamExpectedLastSeqPerSubjectNotReadyError(opts ...ErrorOption) *ApiError {
2✔
2024
        eopts := parseOpts(opts)
2✔
2025
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2026
                return ae
×
2027
        }
×
2028

2029
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectNotReady]
2✔
2030
}
2031

2032
// NewJSStreamExternalApiOverlapError creates a new JSStreamExternalApiOverlapErrF error: "stream external api prefix {prefix} must not overlap with {subject}"
2033
func NewJSStreamExternalApiOverlapError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
2✔
2034
        eopts := parseOpts(opts)
2✔
2035
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2036
                return ae
×
2037
        }
×
2038

2039
        e := ApiErrors[JSStreamExternalApiOverlapErrF]
2✔
2040
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
2✔
2041
        return &ApiError{
2✔
2042
                Code:        e.Code,
2✔
2043
                ErrCode:     e.ErrCode,
2✔
2044
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2045
        }
2✔
2046
}
2047

2048
// NewJSStreamExternalDelPrefixOverlapsError creates a new JSStreamExternalDelPrefixOverlapsErrF error: "stream external delivery prefix {prefix} overlaps with stream subject {subject}"
2049
func NewJSStreamExternalDelPrefixOverlapsError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
×
2050
        eopts := parseOpts(opts)
×
2051
        if ae, ok := eopts.err.(*ApiError); ok {
×
2052
                return ae
×
2053
        }
×
2054

2055
        e := ApiErrors[JSStreamExternalDelPrefixOverlapsErrF]
×
2056
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
×
2057
        return &ApiError{
×
2058
                Code:        e.Code,
×
2059
                ErrCode:     e.ErrCode,
×
2060
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2061
        }
×
2062
}
2063

2064
// NewJSStreamGeneralError creates a new JSStreamGeneralErrorF error: "{err}"
2065
func NewJSStreamGeneralError(err error, opts ...ErrorOption) *ApiError {
3✔
2066
        eopts := parseOpts(opts)
3✔
2067
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2068
                return ae
×
2069
        }
×
2070

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

2080
// NewJSStreamHeaderExceedsMaximumError creates a new JSStreamHeaderExceedsMaximumErr error: "header size exceeds maximum allowed of 64k"
2081
func NewJSStreamHeaderExceedsMaximumError(opts ...ErrorOption) *ApiError {
1✔
2082
        eopts := parseOpts(opts)
1✔
2083
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2084
                return ae
×
2085
        }
×
2086

2087
        return ApiErrors[JSStreamHeaderExceedsMaximumErr]
1✔
2088
}
2089

2090
// NewJSStreamInfoMaxSubjectsError creates a new JSStreamInfoMaxSubjectsErr error: "subject details would exceed maximum allowed"
2091
func NewJSStreamInfoMaxSubjectsError(opts ...ErrorOption) *ApiError {
×
2092
        eopts := parseOpts(opts)
×
2093
        if ae, ok := eopts.err.(*ApiError); ok {
×
2094
                return ae
×
2095
        }
×
2096

2097
        return ApiErrors[JSStreamInfoMaxSubjectsErr]
×
2098
}
2099

2100
// NewJSStreamInvalidConfigError creates a new JSStreamInvalidConfigF error: "{err}"
2101
func NewJSStreamInvalidConfigError(err error, opts ...ErrorOption) *ApiError {
114✔
2102
        eopts := parseOpts(opts)
114✔
2103
        if ae, ok := eopts.err.(*ApiError); ok {
135✔
2104
                return ae
21✔
2105
        }
21✔
2106

2107
        e := ApiErrors[JSStreamInvalidConfigF]
93✔
2108
        args := e.toReplacerArgs([]interface{}{"{err}", err})
93✔
2109
        return &ApiError{
93✔
2110
                Code:        e.Code,
93✔
2111
                ErrCode:     e.ErrCode,
93✔
2112
                Description: strings.NewReplacer(args...).Replace(e.Description),
93✔
2113
        }
93✔
2114
}
2115

2116
// NewJSStreamInvalidError creates a new JSStreamInvalidErr error: "stream not valid"
2117
func NewJSStreamInvalidError(opts ...ErrorOption) *ApiError {
×
2118
        eopts := parseOpts(opts)
×
2119
        if ae, ok := eopts.err.(*ApiError); ok {
×
2120
                return ae
×
2121
        }
×
2122

2123
        return ApiErrors[JSStreamInvalidErr]
×
2124
}
2125

2126
// NewJSStreamInvalidExternalDeliverySubjError creates a new JSStreamInvalidExternalDeliverySubjErrF error: "stream external delivery prefix {prefix} must not contain wildcards"
2127
func NewJSStreamInvalidExternalDeliverySubjError(prefix interface{}, opts ...ErrorOption) *ApiError {
×
2128
        eopts := parseOpts(opts)
×
2129
        if ae, ok := eopts.err.(*ApiError); ok {
×
2130
                return ae
×
2131
        }
×
2132

2133
        e := ApiErrors[JSStreamInvalidExternalDeliverySubjErrF]
×
2134
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix})
×
2135
        return &ApiError{
×
2136
                Code:        e.Code,
×
2137
                ErrCode:     e.ErrCode,
×
2138
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2139
        }
×
2140
}
2141

2142
// NewJSStreamLimitsError creates a new JSStreamLimitsErrF error: "{err}"
2143
func NewJSStreamLimitsError(err error, opts ...ErrorOption) *ApiError {
8✔
2144
        eopts := parseOpts(opts)
8✔
2145
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2146
                return ae
8✔
2147
        }
8✔
2148

2149
        e := ApiErrors[JSStreamLimitsErrF]
×
2150
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2151
        return &ApiError{
×
2152
                Code:        e.Code,
×
2153
                ErrCode:     e.ErrCode,
×
2154
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2155
        }
×
2156
}
2157

2158
// NewJSStreamMaxBytesRequiredError creates a new JSStreamMaxBytesRequired error: "account requires a stream config to have max bytes set"
2159
func NewJSStreamMaxBytesRequiredError(opts ...ErrorOption) *ApiError {
3✔
2160
        eopts := parseOpts(opts)
3✔
2161
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2162
                return ae
×
2163
        }
×
2164

2165
        return ApiErrors[JSStreamMaxBytesRequired]
3✔
2166
}
2167

2168
// NewJSStreamMaxStreamBytesExceededError creates a new JSStreamMaxStreamBytesExceeded error: "stream max bytes exceeds account limit max stream bytes"
2169
func NewJSStreamMaxStreamBytesExceededError(opts ...ErrorOption) *ApiError {
2✔
2170
        eopts := parseOpts(opts)
2✔
2171
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2172
                return ae
×
2173
        }
×
2174

2175
        return ApiErrors[JSStreamMaxStreamBytesExceeded]
2✔
2176
}
2177

2178
// NewJSStreamMessageExceedsMaximumError creates a new JSStreamMessageExceedsMaximumErr error: "message size exceeds maximum allowed"
2179
func NewJSStreamMessageExceedsMaximumError(opts ...ErrorOption) *ApiError {
7✔
2180
        eopts := parseOpts(opts)
7✔
2181
        if ae, ok := eopts.err.(*ApiError); ok {
7✔
2182
                return ae
×
2183
        }
×
2184

2185
        return ApiErrors[JSStreamMessageExceedsMaximumErr]
7✔
2186
}
2187

2188
// NewJSStreamMirrorNotUpdatableError creates a new JSStreamMirrorNotUpdatableErr error: "stream mirror configuration can not be updated"
2189
func NewJSStreamMirrorNotUpdatableError(opts ...ErrorOption) *ApiError {
4✔
2190
        eopts := parseOpts(opts)
4✔
2191
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2192
                return ae
×
2193
        }
×
2194

2195
        return ApiErrors[JSStreamMirrorNotUpdatableErr]
4✔
2196
}
2197

2198
// NewJSStreamMismatchError creates a new JSStreamMismatchErr error: "stream name in subject does not match request"
2199
func NewJSStreamMismatchError(opts ...ErrorOption) *ApiError {
3✔
2200
        eopts := parseOpts(opts)
3✔
2201
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2202
                return ae
×
2203
        }
×
2204

2205
        return ApiErrors[JSStreamMismatchErr]
3✔
2206
}
2207

2208
// NewJSStreamMoveAndScaleError creates a new JSStreamMoveAndScaleErr error: "can not move and scale a stream in a single update"
2209
func NewJSStreamMoveAndScaleError(opts ...ErrorOption) *ApiError {
4✔
2210
        eopts := parseOpts(opts)
4✔
2211
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2212
                return ae
×
2213
        }
×
2214

2215
        return ApiErrors[JSStreamMoveAndScaleErr]
4✔
2216
}
2217

2218
// NewJSStreamMoveInProgressError creates a new JSStreamMoveInProgressF error: "stream move already in progress: {msg}"
2219
func NewJSStreamMoveInProgressError(msg interface{}, opts ...ErrorOption) *ApiError {
2✔
2220
        eopts := parseOpts(opts)
2✔
2221
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2222
                return ae
×
2223
        }
×
2224

2225
        e := ApiErrors[JSStreamMoveInProgressF]
2✔
2226
        args := e.toReplacerArgs([]interface{}{"{msg}", msg})
2✔
2227
        return &ApiError{
2✔
2228
                Code:        e.Code,
2✔
2229
                ErrCode:     e.ErrCode,
2✔
2230
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2231
        }
2✔
2232
}
2233

2234
// NewJSStreamMoveNotInProgressError creates a new JSStreamMoveNotInProgress error: "stream move not in progress"
2235
func NewJSStreamMoveNotInProgressError(opts ...ErrorOption) *ApiError {
×
2236
        eopts := parseOpts(opts)
×
2237
        if ae, ok := eopts.err.(*ApiError); ok {
×
2238
                return ae
×
2239
        }
×
2240

2241
        return ApiErrors[JSStreamMoveNotInProgress]
×
2242
}
2243

2244
// NewJSStreamMsgDeleteFailedError creates a new JSStreamMsgDeleteFailedF error: "{err}"
2245
func NewJSStreamMsgDeleteFailedError(err error, opts ...ErrorOption) *ApiError {
1✔
2246
        eopts := parseOpts(opts)
1✔
2247
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2248
                return ae
×
2249
        }
×
2250

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

2260
// NewJSStreamNameContainsPathSeparatorsError creates a new JSStreamNameContainsPathSeparatorsErr error: "Stream name can not contain path separators"
2261
func NewJSStreamNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
6✔
2262
        eopts := parseOpts(opts)
6✔
2263
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2264
                return ae
×
2265
        }
×
2266

2267
        return ApiErrors[JSStreamNameContainsPathSeparatorsErr]
6✔
2268
}
2269

2270
// NewJSStreamNameExistError creates a new JSStreamNameExistErr error: "stream name already in use with a different configuration"
2271
func NewJSStreamNameExistError(opts ...ErrorOption) *ApiError {
×
2272
        eopts := parseOpts(opts)
×
2273
        if ae, ok := eopts.err.(*ApiError); ok {
×
2274
                return ae
×
2275
        }
×
2276

2277
        return ApiErrors[JSStreamNameExistErr]
×
2278
}
2279

2280
// NewJSStreamNameExistRestoreFailedError creates a new JSStreamNameExistRestoreFailedErr error: "stream name already in use, cannot restore"
2281
func NewJSStreamNameExistRestoreFailedError(opts ...ErrorOption) *ApiError {
3✔
2282
        eopts := parseOpts(opts)
3✔
2283
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2284
                return ae
×
2285
        }
×
2286

2287
        return ApiErrors[JSStreamNameExistRestoreFailedErr]
3✔
2288
}
2289

2290
// NewJSStreamNotFoundError creates a new JSStreamNotFoundErr error: "stream not found"
2291
func NewJSStreamNotFoundError(opts ...ErrorOption) *ApiError {
23,232✔
2292
        eopts := parseOpts(opts)
23,232✔
2293
        if ae, ok := eopts.err.(*ApiError); ok {
23,900✔
2294
                return ae
668✔
2295
        }
668✔
2296

2297
        return ApiErrors[JSStreamNotFoundErr]
22,564✔
2298
}
2299

2300
// NewJSStreamNotMatchError creates a new JSStreamNotMatchErr error: "expected stream does not match"
2301
func NewJSStreamNotMatchError(opts ...ErrorOption) *ApiError {
5✔
2302
        eopts := parseOpts(opts)
5✔
2303
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2304
                return ae
×
2305
        }
×
2306

2307
        return ApiErrors[JSStreamNotMatchErr]
5✔
2308
}
2309

2310
// NewJSStreamOfflineError creates a new JSStreamOfflineErr error: "stream is offline"
2311
func NewJSStreamOfflineError(opts ...ErrorOption) *ApiError {
2✔
2312
        eopts := parseOpts(opts)
2✔
2313
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2314
                return ae
×
2315
        }
×
2316

2317
        return ApiErrors[JSStreamOfflineErr]
2✔
2318
}
2319

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

2327
        e := ApiErrors[JSStreamPurgeFailedF]
1✔
2328
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2329
        return &ApiError{
1✔
2330
                Code:        e.Code,
1✔
2331
                ErrCode:     e.ErrCode,
1✔
2332
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2333
        }
1✔
2334
}
2335

2336
// NewJSStreamReplicasNotSupportedError creates a new JSStreamReplicasNotSupportedErr error: "replicas > 1 not supported in non-clustered mode"
2337
func NewJSStreamReplicasNotSupportedError(opts ...ErrorOption) *ApiError {
1✔
2338
        eopts := parseOpts(opts)
1✔
2339
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2340
                return ae
×
2341
        }
×
2342

2343
        return ApiErrors[JSStreamReplicasNotSupportedErr]
1✔
2344
}
2345

2346
// NewJSStreamReplicasNotUpdatableError creates a new JSStreamReplicasNotUpdatableErr error: "Replicas configuration can not be updated"
2347
func NewJSStreamReplicasNotUpdatableError(opts ...ErrorOption) *ApiError {
×
2348
        eopts := parseOpts(opts)
×
2349
        if ae, ok := eopts.err.(*ApiError); ok {
×
2350
                return ae
×
2351
        }
×
2352

2353
        return ApiErrors[JSStreamReplicasNotUpdatableErr]
×
2354
}
2355

2356
// NewJSStreamRestoreError creates a new JSStreamRestoreErrF error: "restore failed: {err}"
2357
func NewJSStreamRestoreError(err error, opts ...ErrorOption) *ApiError {
7✔
2358
        eopts := parseOpts(opts)
7✔
2359
        if ae, ok := eopts.err.(*ApiError); ok {
9✔
2360
                return ae
2✔
2361
        }
2✔
2362

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

2372
// NewJSStreamRollupFailedError creates a new JSStreamRollupFailedF error: "{err}"
2373
func NewJSStreamRollupFailedError(err error, opts ...ErrorOption) *ApiError {
8✔
2374
        eopts := parseOpts(opts)
8✔
2375
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
2376
                return ae
×
2377
        }
×
2378

2379
        e := ApiErrors[JSStreamRollupFailedF]
8✔
2380
        args := e.toReplacerArgs([]interface{}{"{err}", err})
8✔
2381
        return &ApiError{
8✔
2382
                Code:        e.Code,
8✔
2383
                ErrCode:     e.ErrCode,
8✔
2384
                Description: strings.NewReplacer(args...).Replace(e.Description),
8✔
2385
        }
8✔
2386
}
2387

2388
// NewJSStreamSealedError creates a new JSStreamSealedErr error: "invalid operation on sealed stream"
2389
func NewJSStreamSealedError(opts ...ErrorOption) *ApiError {
10✔
2390
        eopts := parseOpts(opts)
10✔
2391
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2392
                return ae
×
2393
        }
×
2394

2395
        return ApiErrors[JSStreamSealedErr]
10✔
2396
}
2397

2398
// NewJSStreamSequenceNotMatchError creates a new JSStreamSequenceNotMatchErr error: "expected stream sequence does not match"
2399
func NewJSStreamSequenceNotMatchError(opts ...ErrorOption) *ApiError {
×
2400
        eopts := parseOpts(opts)
×
2401
        if ae, ok := eopts.err.(*ApiError); ok {
×
2402
                return ae
×
2403
        }
×
2404

2405
        return ApiErrors[JSStreamSequenceNotMatchErr]
×
2406
}
2407

2408
// NewJSStreamSnapshotError creates a new JSStreamSnapshotErrF error: "snapshot failed: {err}"
2409
func NewJSStreamSnapshotError(err error, opts ...ErrorOption) *ApiError {
×
2410
        eopts := parseOpts(opts)
×
2411
        if ae, ok := eopts.err.(*ApiError); ok {
×
2412
                return ae
×
2413
        }
×
2414

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

2424
// NewJSStreamStoreFailedError creates a new JSStreamStoreFailedF error: "{err}"
2425
func NewJSStreamStoreFailedError(err error, opts ...ErrorOption) *ApiError {
144,823✔
2426
        eopts := parseOpts(opts)
144,823✔
2427
        if ae, ok := eopts.err.(*ApiError); ok {
144,823✔
2428
                return ae
×
2429
        }
×
2430

2431
        e := ApiErrors[JSStreamStoreFailedF]
144,823✔
2432
        args := e.toReplacerArgs([]interface{}{"{err}", err})
144,823✔
2433
        return &ApiError{
144,823✔
2434
                Code:        e.Code,
144,823✔
2435
                ErrCode:     e.ErrCode,
144,823✔
2436
                Description: strings.NewReplacer(args...).Replace(e.Description),
144,823✔
2437
        }
144,823✔
2438
}
2439

2440
// NewJSStreamSubjectOverlapError creates a new JSStreamSubjectOverlapErr error: "subjects overlap with an existing stream"
2441
func NewJSStreamSubjectOverlapError(opts ...ErrorOption) *ApiError {
39✔
2442
        eopts := parseOpts(opts)
39✔
2443
        if ae, ok := eopts.err.(*ApiError); ok {
39✔
2444
                return ae
×
2445
        }
×
2446

2447
        return ApiErrors[JSStreamSubjectOverlapErr]
39✔
2448
}
2449

2450
// NewJSStreamTemplateCreateError creates a new JSStreamTemplateCreateErrF error: "{err}"
2451
func NewJSStreamTemplateCreateError(err error, opts ...ErrorOption) *ApiError {
×
2452
        eopts := parseOpts(opts)
×
2453
        if ae, ok := eopts.err.(*ApiError); ok {
×
2454
                return ae
×
2455
        }
×
2456

2457
        e := ApiErrors[JSStreamTemplateCreateErrF]
×
2458
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2459
        return &ApiError{
×
2460
                Code:        e.Code,
×
2461
                ErrCode:     e.ErrCode,
×
2462
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2463
        }
×
2464
}
2465

2466
// NewJSStreamTemplateDeleteError creates a new JSStreamTemplateDeleteErrF error: "{err}"
2467
func NewJSStreamTemplateDeleteError(err error, opts ...ErrorOption) *ApiError {
1✔
2468
        eopts := parseOpts(opts)
1✔
2469
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2470
                return ae
1✔
2471
        }
1✔
2472

2473
        e := ApiErrors[JSStreamTemplateDeleteErrF]
×
2474
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2475
        return &ApiError{
×
2476
                Code:        e.Code,
×
2477
                ErrCode:     e.ErrCode,
×
2478
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2479
        }
×
2480
}
2481

2482
// NewJSStreamTemplateNotFoundError creates a new JSStreamTemplateNotFoundErr error: "template not found"
2483
func NewJSStreamTemplateNotFoundError(opts ...ErrorOption) *ApiError {
4✔
2484
        eopts := parseOpts(opts)
4✔
2485
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2486
                return ae
×
2487
        }
×
2488

2489
        return ApiErrors[JSStreamTemplateNotFoundErr]
4✔
2490
}
2491

2492
// NewJSStreamTransformInvalidDestinationError creates a new JSStreamTransformInvalidDestination error: "stream transform: {err}"
2493
func NewJSStreamTransformInvalidDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
2494
        eopts := parseOpts(opts)
1✔
2495
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2496
                return ae
×
2497
        }
×
2498

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

2508
// NewJSStreamTransformInvalidSourceError creates a new JSStreamTransformInvalidSource error: "stream transform source: {err}"
2509
func NewJSStreamTransformInvalidSourceError(err error, opts ...ErrorOption) *ApiError {
1✔
2510
        eopts := parseOpts(opts)
1✔
2511
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2512
                return ae
×
2513
        }
×
2514

2515
        e := ApiErrors[JSStreamTransformInvalidSource]
1✔
2516
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2517
        return &ApiError{
1✔
2518
                Code:        e.Code,
1✔
2519
                ErrCode:     e.ErrCode,
1✔
2520
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2521
        }
1✔
2522
}
2523

2524
// NewJSStreamUpdateError creates a new JSStreamUpdateErrF error: "{err}"
2525
func NewJSStreamUpdateError(err error, opts ...ErrorOption) *ApiError {
20✔
2526
        eopts := parseOpts(opts)
20✔
2527
        if ae, ok := eopts.err.(*ApiError); ok {
34✔
2528
                return ae
14✔
2529
        }
14✔
2530

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

2540
// NewJSStreamWrongLastMsgIDError creates a new JSStreamWrongLastMsgIDErrF error: "wrong last msg ID: {id}"
2541
func NewJSStreamWrongLastMsgIDError(id interface{}, opts ...ErrorOption) *ApiError {
5✔
2542
        eopts := parseOpts(opts)
5✔
2543
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2544
                return ae
×
2545
        }
×
2546

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

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

2563
        return ApiErrors[JSStreamWrongLastSequenceConstantErr]
11✔
2564
}
2565

2566
// NewJSStreamWrongLastSequenceError creates a new JSStreamWrongLastSequenceErrF error: "wrong last sequence: {seq}"
2567
func NewJSStreamWrongLastSequenceError(seq uint64, opts ...ErrorOption) *ApiError {
57✔
2568
        eopts := parseOpts(opts)
57✔
2569
        if ae, ok := eopts.err.(*ApiError); ok {
57✔
2570
                return ae
×
2571
        }
×
2572

2573
        e := ApiErrors[JSStreamWrongLastSequenceErrF]
57✔
2574
        args := e.toReplacerArgs([]interface{}{"{seq}", seq})
57✔
2575
        return &ApiError{
57✔
2576
                Code:        e.Code,
57✔
2577
                ErrCode:     e.ErrCode,
57✔
2578
                Description: strings.NewReplacer(args...).Replace(e.Description),
57✔
2579
        }
57✔
2580
}
2581

2582
// NewJSTempStorageFailedError creates a new JSTempStorageFailedErr error: "JetStream unable to open temp storage for restore"
2583
func NewJSTempStorageFailedError(opts ...ErrorOption) *ApiError {
×
2584
        eopts := parseOpts(opts)
×
2585
        if ae, ok := eopts.err.(*ApiError); ok {
×
2586
                return ae
×
2587
        }
×
2588

2589
        return ApiErrors[JSTempStorageFailedErr]
×
2590
}
2591

2592
// NewJSTemplateNameNotMatchSubjectError creates a new JSTemplateNameNotMatchSubjectErr error: "template name in subject does not match request"
2593
func NewJSTemplateNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
1✔
2594
        eopts := parseOpts(opts)
1✔
2595
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2596
                return ae
×
2597
        }
×
2598

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