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

nats-io / nats-server / 16186387856

09 Jul 2025 02:54PM UTC coverage: 85.683% (-0.09%) from 85.77%
16186387856

push

github

web-flow
De-flake TestGatewayTLSMixedIPAndDNS (#7050)

The would flake (especially under CI) when the first gateway connection
would fail. The reconnect would not be done because they are implicit
gateway connections for this test, which don't retry unless configured.
Configuring retries makes this test not flake anymore.

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

70722 of 82539 relevant lines covered (85.68%)

363781.18 hits per line

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

53.0
/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
        // JSMessageCounterBrokenErr message counter is broken
246
        JSMessageCounterBrokenErr ErrorIdentifier = 10172
247

248
        // JSMessageIncrDisabledErr message counters is disabled
249
        JSMessageIncrDisabledErr ErrorIdentifier = 10168
250

251
        // JSMessageIncrInvalidErr message counter increment is invalid
252
        JSMessageIncrInvalidErr ErrorIdentifier = 10171
253

254
        // JSMessageIncrMissingErr message counter increment is missing
255
        JSMessageIncrMissingErr ErrorIdentifier = 10169
256

257
        // JSMessageIncrPayloadErr message counter has payload
258
        JSMessageIncrPayloadErr ErrorIdentifier = 10170
259

260
        // JSMessageTTLDisabledErr per-message TTL is disabled
261
        JSMessageTTLDisabledErr ErrorIdentifier = 10166
262

263
        // JSMessageTTLInvalidErr invalid per-message TTL
264
        JSMessageTTLInvalidErr ErrorIdentifier = 10165
265

266
        // JSMirrorConsumerSetupFailedErrF generic mirror consumer setup failure string ({err})
267
        JSMirrorConsumerSetupFailedErrF ErrorIdentifier = 10029
268

269
        // JSMirrorInvalidStreamName mirrored stream name is invalid
270
        JSMirrorInvalidStreamName ErrorIdentifier = 10142
271

272
        // JSMirrorInvalidSubjectFilter mirror transform source: {err}
273
        JSMirrorInvalidSubjectFilter ErrorIdentifier = 10151
274

275
        // JSMirrorInvalidTransformDestination mirror transform: {err}
276
        JSMirrorInvalidTransformDestination ErrorIdentifier = 10154
277

278
        // JSMirrorMaxMessageSizeTooBigErr stream mirror must have max message size >= source
279
        JSMirrorMaxMessageSizeTooBigErr ErrorIdentifier = 10030
280

281
        // JSMirrorMultipleFiltersNotAllowed mirror with multiple subject transforms cannot also have a single subject filter
282
        JSMirrorMultipleFiltersNotAllowed ErrorIdentifier = 10150
283

284
        // JSMirrorOverlappingSubjectFilters mirror subject filters can not overlap
285
        JSMirrorOverlappingSubjectFilters ErrorIdentifier = 10152
286

287
        // JSMirrorWithCountersErr stream mirrors can not also calculate counters
288
        JSMirrorWithCountersErr ErrorIdentifier = 10173
289

290
        // JSMirrorWithFirstSeqErr stream mirrors can not have first sequence configured
291
        JSMirrorWithFirstSeqErr ErrorIdentifier = 10143
292

293
        // JSMirrorWithSourcesErr stream mirrors can not also contain other sources
294
        JSMirrorWithSourcesErr ErrorIdentifier = 10031
295

296
        // JSMirrorWithStartSeqAndTimeErr stream mirrors can not have both start seq and start time configured
297
        JSMirrorWithStartSeqAndTimeErr ErrorIdentifier = 10032
298

299
        // JSMirrorWithSubjectFiltersErr stream mirrors can not contain filtered subjects
300
        JSMirrorWithSubjectFiltersErr ErrorIdentifier = 10033
301

302
        // JSMirrorWithSubjectsErr stream mirrors can not contain subjects
303
        JSMirrorWithSubjectsErr ErrorIdentifier = 10034
304

305
        // JSNoAccountErr account not found
306
        JSNoAccountErr ErrorIdentifier = 10035
307

308
        // JSNoLimitsErr no JetStream default or applicable tiered limit present
309
        JSNoLimitsErr ErrorIdentifier = 10120
310

311
        // JSNoMessageFoundErr no message found
312
        JSNoMessageFoundErr ErrorIdentifier = 10037
313

314
        // JSNotEmptyRequestErr expected an empty request payload
315
        JSNotEmptyRequestErr ErrorIdentifier = 10038
316

317
        // JSNotEnabledErr JetStream not enabled
318
        JSNotEnabledErr ErrorIdentifier = 10076
319

320
        // JSNotEnabledForAccountErr JetStream not enabled for account
321
        JSNotEnabledForAccountErr ErrorIdentifier = 10039
322

323
        // JSPedanticErrF pedantic mode: {err}
324
        JSPedanticErrF ErrorIdentifier = 10157
325

326
        // JSPeerRemapErr peer remap failed
327
        JSPeerRemapErr ErrorIdentifier = 10075
328

329
        // JSRaftGeneralErrF General RAFT error string ({err})
330
        JSRaftGeneralErrF ErrorIdentifier = 10041
331

332
        // JSReplicasCountCannotBeNegative replicas count cannot be negative
333
        JSReplicasCountCannotBeNegative ErrorIdentifier = 10133
334

335
        // JSRestoreSubscribeFailedErrF JetStream unable to subscribe to restore snapshot {subject}: {err}
336
        JSRestoreSubscribeFailedErrF ErrorIdentifier = 10042
337

338
        // JSSequenceNotFoundErrF sequence {seq} not found
339
        JSSequenceNotFoundErrF ErrorIdentifier = 10043
340

341
        // JSSnapshotDeliverSubjectInvalidErr deliver subject not valid
342
        JSSnapshotDeliverSubjectInvalidErr ErrorIdentifier = 10015
343

344
        // JSSourceConsumerSetupFailedErrF General source consumer setup failure string ({err})
345
        JSSourceConsumerSetupFailedErrF ErrorIdentifier = 10045
346

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

350
        // JSSourceInvalidStreamName sourced stream name is invalid
351
        JSSourceInvalidStreamName ErrorIdentifier = 10141
352

353
        // JSSourceInvalidSubjectFilter source transform source: {err}
354
        JSSourceInvalidSubjectFilter ErrorIdentifier = 10145
355

356
        // JSSourceInvalidTransformDestination source transform: {err}
357
        JSSourceInvalidTransformDestination ErrorIdentifier = 10146
358

359
        // JSSourceMaxMessageSizeTooBigErr stream source must have max message size >= target
360
        JSSourceMaxMessageSizeTooBigErr ErrorIdentifier = 10046
361

362
        // JSSourceMultipleFiltersNotAllowed source with multiple subject transforms cannot also have a single subject filter
363
        JSSourceMultipleFiltersNotAllowed ErrorIdentifier = 10144
364

365
        // JSSourceOverlappingSubjectFilters source filters can not overlap
366
        JSSourceOverlappingSubjectFilters ErrorIdentifier = 10147
367

368
        // JSStorageResourcesExceededErr insufficient storage resources available
369
        JSStorageResourcesExceededErr ErrorIdentifier = 10047
370

371
        // JSStreamAssignmentErrF Generic stream assignment error string ({err})
372
        JSStreamAssignmentErrF ErrorIdentifier = 10048
373

374
        // JSStreamCreateErrF Generic stream creation error string ({err})
375
        JSStreamCreateErrF ErrorIdentifier = 10049
376

377
        // JSStreamDeleteErrF General stream deletion error string ({err})
378
        JSStreamDeleteErrF ErrorIdentifier = 10050
379

380
        // JSStreamDuplicateMessageConflict duplicate message id is in process
381
        JSStreamDuplicateMessageConflict ErrorIdentifier = 10158
382

383
        // JSStreamExpectedLastSeqPerSubjectNotReady expected last sequence per subject temporarily unavailable
384
        JSStreamExpectedLastSeqPerSubjectNotReady ErrorIdentifier = 10163
385

386
        // JSStreamExternalApiOverlapErrF stream external api prefix {prefix} must not overlap with {subject}
387
        JSStreamExternalApiOverlapErrF ErrorIdentifier = 10021
388

389
        // JSStreamExternalDelPrefixOverlapsErrF stream external delivery prefix {prefix} overlaps with stream subject {subject}
390
        JSStreamExternalDelPrefixOverlapsErrF ErrorIdentifier = 10022
391

392
        // JSStreamGeneralErrorF General stream failure string ({err})
393
        JSStreamGeneralErrorF ErrorIdentifier = 10051
394

395
        // JSStreamHeaderExceedsMaximumErr header size exceeds maximum allowed of 64k
396
        JSStreamHeaderExceedsMaximumErr ErrorIdentifier = 10097
397

398
        // JSStreamInfoMaxSubjectsErr subject details would exceed maximum allowed
399
        JSStreamInfoMaxSubjectsErr ErrorIdentifier = 10117
400

401
        // JSStreamInvalidConfigF Stream configuration validation error string ({err})
402
        JSStreamInvalidConfigF ErrorIdentifier = 10052
403

404
        // JSStreamInvalidErr stream not valid
405
        JSStreamInvalidErr ErrorIdentifier = 10096
406

407
        // JSStreamInvalidExternalDeliverySubjErrF stream external delivery prefix {prefix} must not contain wildcards
408
        JSStreamInvalidExternalDeliverySubjErrF ErrorIdentifier = 10024
409

410
        // JSStreamLimitsErrF General stream limits exceeded error string ({err})
411
        JSStreamLimitsErrF ErrorIdentifier = 10053
412

413
        // JSStreamMaxBytesRequired account requires a stream config to have max bytes set
414
        JSStreamMaxBytesRequired ErrorIdentifier = 10113
415

416
        // JSStreamMaxStreamBytesExceeded stream max bytes exceeds account limit max stream bytes
417
        JSStreamMaxStreamBytesExceeded ErrorIdentifier = 10122
418

419
        // JSStreamMessageExceedsMaximumErr message size exceeds maximum allowed
420
        JSStreamMessageExceedsMaximumErr ErrorIdentifier = 10054
421

422
        // JSStreamMirrorNotUpdatableErr stream mirror configuration can not be updated
423
        JSStreamMirrorNotUpdatableErr ErrorIdentifier = 10055
424

425
        // JSStreamMismatchErr stream name in subject does not match request
426
        JSStreamMismatchErr ErrorIdentifier = 10056
427

428
        // JSStreamMoveAndScaleErr can not move and scale a stream in a single update
429
        JSStreamMoveAndScaleErr ErrorIdentifier = 10123
430

431
        // JSStreamMoveInProgressF stream move already in progress: {msg}
432
        JSStreamMoveInProgressF ErrorIdentifier = 10124
433

434
        // JSStreamMoveNotInProgress stream move not in progress
435
        JSStreamMoveNotInProgress ErrorIdentifier = 10129
436

437
        // JSStreamMsgDeleteFailedF Generic message deletion failure error string ({err})
438
        JSStreamMsgDeleteFailedF ErrorIdentifier = 10057
439

440
        // JSStreamNameContainsPathSeparatorsErr Stream name can not contain path separators
441
        JSStreamNameContainsPathSeparatorsErr ErrorIdentifier = 10128
442

443
        // JSStreamNameExistErr stream name already in use with a different configuration
444
        JSStreamNameExistErr ErrorIdentifier = 10058
445

446
        // JSStreamNameExistRestoreFailedErr stream name already in use, cannot restore
447
        JSStreamNameExistRestoreFailedErr ErrorIdentifier = 10130
448

449
        // JSStreamNotFoundErr stream not found
450
        JSStreamNotFoundErr ErrorIdentifier = 10059
451

452
        // JSStreamNotMatchErr expected stream does not match
453
        JSStreamNotMatchErr ErrorIdentifier = 10060
454

455
        // JSStreamOfflineErr stream is offline
456
        JSStreamOfflineErr ErrorIdentifier = 10118
457

458
        // JSStreamPurgeFailedF Generic stream purge failure error string ({err})
459
        JSStreamPurgeFailedF ErrorIdentifier = 10110
460

461
        // JSStreamReplicasNotSupportedErr replicas > 1 not supported in non-clustered mode
462
        JSStreamReplicasNotSupportedErr ErrorIdentifier = 10074
463

464
        // JSStreamReplicasNotUpdatableErr Replicas configuration can not be updated
465
        JSStreamReplicasNotUpdatableErr ErrorIdentifier = 10061
466

467
        // JSStreamRestoreErrF restore failed: {err}
468
        JSStreamRestoreErrF ErrorIdentifier = 10062
469

470
        // JSStreamRollupFailedF Generic stream rollup failure error string ({err})
471
        JSStreamRollupFailedF ErrorIdentifier = 10111
472

473
        // JSStreamSealedErr invalid operation on sealed stream
474
        JSStreamSealedErr ErrorIdentifier = 10109
475

476
        // JSStreamSequenceNotMatchErr expected stream sequence does not match
477
        JSStreamSequenceNotMatchErr ErrorIdentifier = 10063
478

479
        // JSStreamSnapshotErrF snapshot failed: {err}
480
        JSStreamSnapshotErrF ErrorIdentifier = 10064
481

482
        // JSStreamStoreFailedF Generic error when storing a message failed ({err})
483
        JSStreamStoreFailedF ErrorIdentifier = 10077
484

485
        // JSStreamSubjectOverlapErr subjects overlap with an existing stream
486
        JSStreamSubjectOverlapErr ErrorIdentifier = 10065
487

488
        // JSStreamTemplateCreateErrF Generic template creation failed string ({err})
489
        JSStreamTemplateCreateErrF ErrorIdentifier = 10066
490

491
        // JSStreamTemplateDeleteErrF Generic stream template deletion failed error string ({err})
492
        JSStreamTemplateDeleteErrF ErrorIdentifier = 10067
493

494
        // JSStreamTemplateNotFoundErr template not found
495
        JSStreamTemplateNotFoundErr ErrorIdentifier = 10068
496

497
        // JSStreamTooManyRequests too many requests
498
        JSStreamTooManyRequests ErrorIdentifier = 10167
499

500
        // JSStreamTransformInvalidDestination stream transform: {err}
501
        JSStreamTransformInvalidDestination ErrorIdentifier = 10156
502

503
        // JSStreamTransformInvalidSource stream transform source: {err}
504
        JSStreamTransformInvalidSource ErrorIdentifier = 10155
505

506
        // JSStreamUpdateErrF Generic stream update error string ({err})
507
        JSStreamUpdateErrF ErrorIdentifier = 10069
508

509
        // JSStreamWrongLastMsgIDErrF wrong last msg ID: {id}
510
        JSStreamWrongLastMsgIDErrF ErrorIdentifier = 10070
511

512
        // JSStreamWrongLastSequenceConstantErr wrong last sequence
513
        JSStreamWrongLastSequenceConstantErr ErrorIdentifier = 10164
514

515
        // JSStreamWrongLastSequenceErrF wrong last sequence: {seq}
516
        JSStreamWrongLastSequenceErrF ErrorIdentifier = 10071
517

518
        // JSTempStorageFailedErr JetStream unable to open temp storage for restore
519
        JSTempStorageFailedErr ErrorIdentifier = 10072
520

521
        // JSTemplateNameNotMatchSubjectErr template name in subject does not match request
522
        JSTemplateNameNotMatchSubjectErr ErrorIdentifier = 10073
523
)
524

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

724
// NewJSAccountResourcesExceededError creates a new JSAccountResourcesExceededErr error: "resource limits exceeded for account"
725
func NewJSAccountResourcesExceededError(opts ...ErrorOption) *ApiError {
20,061✔
726
        eopts := parseOpts(opts)
20,061✔
727
        if ae, ok := eopts.err.(*ApiError); ok {
20,061✔
728
                return ae
×
729
        }
×
730

731
        return ApiErrors[JSAccountResourcesExceededErr]
20,061✔
732
}
733

734
// NewJSBadRequestError creates a new JSBadRequestErr error: "bad request"
735
func NewJSBadRequestError(opts ...ErrorOption) *ApiError {
10✔
736
        eopts := parseOpts(opts)
10✔
737
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
738
                return ae
×
739
        }
×
740

741
        return ApiErrors[JSBadRequestErr]
10✔
742
}
743

744
// NewJSClusterIncompleteError creates a new JSClusterIncompleteErr error: "incomplete results"
745
func NewJSClusterIncompleteError(opts ...ErrorOption) *ApiError {
×
746
        eopts := parseOpts(opts)
×
747
        if ae, ok := eopts.err.(*ApiError); ok {
×
748
                return ae
×
749
        }
×
750

751
        return ApiErrors[JSClusterIncompleteErr]
×
752
}
753

754
// NewJSClusterNoPeersError creates a new JSClusterNoPeersErrF error: "{err}"
755
func NewJSClusterNoPeersError(err error, opts ...ErrorOption) *ApiError {
58✔
756
        eopts := parseOpts(opts)
58✔
757
        if ae, ok := eopts.err.(*ApiError); ok {
58✔
758
                return ae
×
759
        }
×
760

761
        e := ApiErrors[JSClusterNoPeersErrF]
58✔
762
        args := e.toReplacerArgs([]interface{}{"{err}", err})
58✔
763
        return &ApiError{
58✔
764
                Code:        e.Code,
58✔
765
                ErrCode:     e.ErrCode,
58✔
766
                Description: strings.NewReplacer(args...).Replace(e.Description),
58✔
767
        }
58✔
768
}
769

770
// NewJSClusterNotActiveError creates a new JSClusterNotActiveErr error: "JetStream not in clustered mode"
771
func NewJSClusterNotActiveError(opts ...ErrorOption) *ApiError {
1✔
772
        eopts := parseOpts(opts)
1✔
773
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
774
                return ae
×
775
        }
×
776

777
        return ApiErrors[JSClusterNotActiveErr]
1✔
778
}
779

780
// NewJSClusterNotAssignedError creates a new JSClusterNotAssignedErr error: "JetStream cluster not assigned to this server"
781
func NewJSClusterNotAssignedError(opts ...ErrorOption) *ApiError {
35✔
782
        eopts := parseOpts(opts)
35✔
783
        if ae, ok := eopts.err.(*ApiError); ok {
35✔
784
                return ae
×
785
        }
×
786

787
        return ApiErrors[JSClusterNotAssignedErr]
35✔
788
}
789

790
// NewJSClusterNotAvailError creates a new JSClusterNotAvailErr error: "JetStream system temporarily unavailable"
791
func NewJSClusterNotAvailError(opts ...ErrorOption) *ApiError {
13✔
792
        eopts := parseOpts(opts)
13✔
793
        if ae, ok := eopts.err.(*ApiError); ok {
13✔
794
                return ae
×
795
        }
×
796

797
        return ApiErrors[JSClusterNotAvailErr]
13✔
798
}
799

800
// NewJSClusterNotLeaderError creates a new JSClusterNotLeaderErr error: "JetStream cluster can not handle request"
801
func NewJSClusterNotLeaderError(opts ...ErrorOption) *ApiError {
8✔
802
        eopts := parseOpts(opts)
8✔
803
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
804
                return ae
×
805
        }
×
806

807
        return ApiErrors[JSClusterNotLeaderErr]
8✔
808
}
809

810
// NewJSClusterPeerNotMemberError creates a new JSClusterPeerNotMemberErr error: "peer not a member"
811
func NewJSClusterPeerNotMemberError(opts ...ErrorOption) *ApiError {
1✔
812
        eopts := parseOpts(opts)
1✔
813
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
814
                return ae
×
815
        }
×
816

817
        return ApiErrors[JSClusterPeerNotMemberErr]
1✔
818
}
819

820
// NewJSClusterRequiredError creates a new JSClusterRequiredErr error: "JetStream clustering support required"
821
func NewJSClusterRequiredError(opts ...ErrorOption) *ApiError {
×
822
        eopts := parseOpts(opts)
×
823
        if ae, ok := eopts.err.(*ApiError); ok {
×
824
                return ae
×
825
        }
×
826

827
        return ApiErrors[JSClusterRequiredErr]
×
828
}
829

830
// NewJSClusterServerNotMemberError creates a new JSClusterServerNotMemberErr error: "server is not a member of the cluster"
831
func NewJSClusterServerNotMemberError(opts ...ErrorOption) *ApiError {
3✔
832
        eopts := parseOpts(opts)
3✔
833
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
834
                return ae
×
835
        }
×
836

837
        return ApiErrors[JSClusterServerNotMemberErr]
3✔
838
}
839

840
// NewJSClusterTagsError creates a new JSClusterTagsErr error: "tags placement not supported for operation"
841
func NewJSClusterTagsError(opts ...ErrorOption) *ApiError {
×
842
        eopts := parseOpts(opts)
×
843
        if ae, ok := eopts.err.(*ApiError); ok {
×
844
                return ae
×
845
        }
×
846

847
        return ApiErrors[JSClusterTagsErr]
×
848
}
849

850
// NewJSClusterUnSupportFeatureError creates a new JSClusterUnSupportFeatureErr error: "not currently supported in clustered mode"
851
func NewJSClusterUnSupportFeatureError(opts ...ErrorOption) *ApiError {
6✔
852
        eopts := parseOpts(opts)
6✔
853
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
854
                return ae
×
855
        }
×
856

857
        return ApiErrors[JSClusterUnSupportFeatureErr]
6✔
858
}
859

860
// NewJSConsumerAlreadyExistsError creates a new JSConsumerAlreadyExists error: "consumer already exists"
861
func NewJSConsumerAlreadyExistsError(opts ...ErrorOption) *ApiError {
5✔
862
        eopts := parseOpts(opts)
5✔
863
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
864
                return ae
×
865
        }
×
866

867
        return ApiErrors[JSConsumerAlreadyExists]
5✔
868
}
869

870
// NewJSConsumerBadDurableNameError creates a new JSConsumerBadDurableNameErr error: "durable name can not contain '.', '*', '>'"
871
func NewJSConsumerBadDurableNameError(opts ...ErrorOption) *ApiError {
×
872
        eopts := parseOpts(opts)
×
873
        if ae, ok := eopts.err.(*ApiError); ok {
×
874
                return ae
×
875
        }
×
876

877
        return ApiErrors[JSConsumerBadDurableNameErr]
×
878
}
879

880
// NewJSConsumerConfigRequiredError creates a new JSConsumerConfigRequiredErr error: "consumer config required"
881
func NewJSConsumerConfigRequiredError(opts ...ErrorOption) *ApiError {
2✔
882
        eopts := parseOpts(opts)
2✔
883
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
884
                return ae
×
885
        }
×
886

887
        return ApiErrors[JSConsumerConfigRequiredErr]
2✔
888
}
889

890
// NewJSConsumerCreateDurableAndNameMismatchError creates a new JSConsumerCreateDurableAndNameMismatch error: "Consumer Durable and Name have to be equal if both are provided"
891
func NewJSConsumerCreateDurableAndNameMismatchError(opts ...ErrorOption) *ApiError {
1✔
892
        eopts := parseOpts(opts)
1✔
893
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
894
                return ae
×
895
        }
×
896

897
        return ApiErrors[JSConsumerCreateDurableAndNameMismatch]
1✔
898
}
899

900
// NewJSConsumerCreateError creates a new JSConsumerCreateErrF error: "{err}"
901
func NewJSConsumerCreateError(err error, opts ...ErrorOption) *ApiError {
68✔
902
        eopts := parseOpts(opts)
68✔
903
        if ae, ok := eopts.err.(*ApiError); ok {
118✔
904
                return ae
50✔
905
        }
50✔
906

907
        e := ApiErrors[JSConsumerCreateErrF]
18✔
908
        args := e.toReplacerArgs([]interface{}{"{err}", err})
18✔
909
        return &ApiError{
18✔
910
                Code:        e.Code,
18✔
911
                ErrCode:     e.ErrCode,
18✔
912
                Description: strings.NewReplacer(args...).Replace(e.Description),
18✔
913
        }
18✔
914
}
915

916
// NewJSConsumerCreateFilterSubjectMismatchError creates a new JSConsumerCreateFilterSubjectMismatchErr error: "Consumer create request did not match filtered subject from create subject"
917
func NewJSConsumerCreateFilterSubjectMismatchError(opts ...ErrorOption) *ApiError {
2✔
918
        eopts := parseOpts(opts)
2✔
919
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
920
                return ae
×
921
        }
×
922

923
        return ApiErrors[JSConsumerCreateFilterSubjectMismatchErr]
2✔
924
}
925

926
// NewJSConsumerDeliverCycleError creates a new JSConsumerDeliverCycleErr error: "consumer deliver subject forms a cycle"
927
func NewJSConsumerDeliverCycleError(opts ...ErrorOption) *ApiError {
4✔
928
        eopts := parseOpts(opts)
4✔
929
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
930
                return ae
×
931
        }
×
932

933
        return ApiErrors[JSConsumerDeliverCycleErr]
4✔
934
}
935

936
// NewJSConsumerDeliverToWildcardsError creates a new JSConsumerDeliverToWildcardsErr error: "consumer deliver subject has wildcards"
937
func NewJSConsumerDeliverToWildcardsError(opts ...ErrorOption) *ApiError {
4✔
938
        eopts := parseOpts(opts)
4✔
939
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
940
                return ae
×
941
        }
×
942

943
        return ApiErrors[JSConsumerDeliverToWildcardsErr]
4✔
944
}
945

946
// NewJSConsumerDescriptionTooLongError creates a new JSConsumerDescriptionTooLongErrF error: "consumer description is too long, maximum allowed is {max}"
947
func NewJSConsumerDescriptionTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
1✔
948
        eopts := parseOpts(opts)
1✔
949
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
950
                return ae
×
951
        }
×
952

953
        e := ApiErrors[JSConsumerDescriptionTooLongErrF]
1✔
954
        args := e.toReplacerArgs([]interface{}{"{max}", max})
1✔
955
        return &ApiError{
1✔
956
                Code:        e.Code,
1✔
957
                ErrCode:     e.ErrCode,
1✔
958
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
959
        }
1✔
960
}
961

962
// NewJSConsumerDirectRequiresEphemeralError creates a new JSConsumerDirectRequiresEphemeralErr error: "consumer direct requires an ephemeral consumer"
963
func NewJSConsumerDirectRequiresEphemeralError(opts ...ErrorOption) *ApiError {
×
964
        eopts := parseOpts(opts)
×
965
        if ae, ok := eopts.err.(*ApiError); ok {
×
966
                return ae
×
967
        }
×
968

969
        return ApiErrors[JSConsumerDirectRequiresEphemeralErr]
×
970
}
971

972
// NewJSConsumerDirectRequiresPushError creates a new JSConsumerDirectRequiresPushErr error: "consumer direct requires a push based consumer"
973
func NewJSConsumerDirectRequiresPushError(opts ...ErrorOption) *ApiError {
×
974
        eopts := parseOpts(opts)
×
975
        if ae, ok := eopts.err.(*ApiError); ok {
×
976
                return ae
×
977
        }
×
978

979
        return ApiErrors[JSConsumerDirectRequiresPushErr]
×
980
}
981

982
// NewJSConsumerDoesNotExistError creates a new JSConsumerDoesNotExist error: "consumer does not exist"
983
func NewJSConsumerDoesNotExistError(opts ...ErrorOption) *ApiError {
3✔
984
        eopts := parseOpts(opts)
3✔
985
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
986
                return ae
×
987
        }
×
988

989
        return ApiErrors[JSConsumerDoesNotExist]
3✔
990
}
991

992
// NewJSConsumerDuplicateFilterSubjectsError creates a new JSConsumerDuplicateFilterSubjects error: "consumer cannot have both FilterSubject and FilterSubjects specified"
993
func NewJSConsumerDuplicateFilterSubjectsError(opts ...ErrorOption) *ApiError {
1✔
994
        eopts := parseOpts(opts)
1✔
995
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
996
                return ae
×
997
        }
×
998

999
        return ApiErrors[JSConsumerDuplicateFilterSubjects]
1✔
1000
}
1001

1002
// NewJSConsumerDurableNameNotInSubjectError creates a new JSConsumerDurableNameNotInSubjectErr error: "consumer expected to be durable but no durable name set in subject"
1003
func NewJSConsumerDurableNameNotInSubjectError(opts ...ErrorOption) *ApiError {
×
1004
        eopts := parseOpts(opts)
×
1005
        if ae, ok := eopts.err.(*ApiError); ok {
×
1006
                return ae
×
1007
        }
×
1008

1009
        return ApiErrors[JSConsumerDurableNameNotInSubjectErr]
×
1010
}
1011

1012
// NewJSConsumerDurableNameNotMatchSubjectError creates a new JSConsumerDurableNameNotMatchSubjectErr error: "consumer name in subject does not match durable name in request"
1013
func NewJSConsumerDurableNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
×
1014
        eopts := parseOpts(opts)
×
1015
        if ae, ok := eopts.err.(*ApiError); ok {
×
1016
                return ae
×
1017
        }
×
1018

1019
        return ApiErrors[JSConsumerDurableNameNotMatchSubjectErr]
×
1020
}
1021

1022
// NewJSConsumerDurableNameNotSetError creates a new JSConsumerDurableNameNotSetErr error: "consumer expected to be durable but a durable name was not set"
1023
func NewJSConsumerDurableNameNotSetError(opts ...ErrorOption) *ApiError {
1✔
1024
        eopts := parseOpts(opts)
1✔
1025
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1026
                return ae
×
1027
        }
×
1028

1029
        return ApiErrors[JSConsumerDurableNameNotSetErr]
1✔
1030
}
1031

1032
// NewJSConsumerEmptyFilterError creates a new JSConsumerEmptyFilter error: "consumer filter in FilterSubjects cannot be empty"
1033
func NewJSConsumerEmptyFilterError(opts ...ErrorOption) *ApiError {
1✔
1034
        eopts := parseOpts(opts)
1✔
1035
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1036
                return ae
×
1037
        }
×
1038

1039
        return ApiErrors[JSConsumerEmptyFilter]
1✔
1040
}
1041

1042
// NewJSConsumerEmptyGroupNameError creates a new JSConsumerEmptyGroupName error: "Group name cannot be an empty string"
1043
func NewJSConsumerEmptyGroupNameError(opts ...ErrorOption) *ApiError {
4✔
1044
        eopts := parseOpts(opts)
4✔
1045
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1046
                return ae
×
1047
        }
×
1048

1049
        return ApiErrors[JSConsumerEmptyGroupName]
4✔
1050
}
1051

1052
// NewJSConsumerEphemeralWithDurableInSubjectError creates a new JSConsumerEphemeralWithDurableInSubjectErr error: "consumer expected to be ephemeral but detected a durable name set in subject"
1053
func NewJSConsumerEphemeralWithDurableInSubjectError(opts ...ErrorOption) *ApiError {
×
1054
        eopts := parseOpts(opts)
×
1055
        if ae, ok := eopts.err.(*ApiError); ok {
×
1056
                return ae
×
1057
        }
×
1058

1059
        return ApiErrors[JSConsumerEphemeralWithDurableInSubjectErr]
×
1060
}
1061

1062
// NewJSConsumerEphemeralWithDurableNameError creates a new JSConsumerEphemeralWithDurableNameErr error: "consumer expected to be ephemeral but a durable name was set in request"
1063
func NewJSConsumerEphemeralWithDurableNameError(opts ...ErrorOption) *ApiError {
3✔
1064
        eopts := parseOpts(opts)
3✔
1065
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1066
                return ae
×
1067
        }
×
1068

1069
        return ApiErrors[JSConsumerEphemeralWithDurableNameErr]
3✔
1070
}
1071

1072
// NewJSConsumerExistingActiveError creates a new JSConsumerExistingActiveErr error: "consumer already exists and is still active"
1073
func NewJSConsumerExistingActiveError(opts ...ErrorOption) *ApiError {
×
1074
        eopts := parseOpts(opts)
×
1075
        if ae, ok := eopts.err.(*ApiError); ok {
×
1076
                return ae
×
1077
        }
×
1078

1079
        return ApiErrors[JSConsumerExistingActiveErr]
×
1080
}
1081

1082
// NewJSConsumerFCRequiresPushError creates a new JSConsumerFCRequiresPushErr error: "consumer flow control requires a push based consumer"
1083
func NewJSConsumerFCRequiresPushError(opts ...ErrorOption) *ApiError {
×
1084
        eopts := parseOpts(opts)
×
1085
        if ae, ok := eopts.err.(*ApiError); ok {
×
1086
                return ae
×
1087
        }
×
1088

1089
        return ApiErrors[JSConsumerFCRequiresPushErr]
×
1090
}
1091

1092
// NewJSConsumerFilterNotSubsetError creates a new JSConsumerFilterNotSubsetErr error: "consumer filter subject is not a valid subset of the interest subjects"
1093
func NewJSConsumerFilterNotSubsetError(opts ...ErrorOption) *ApiError {
×
1094
        eopts := parseOpts(opts)
×
1095
        if ae, ok := eopts.err.(*ApiError); ok {
×
1096
                return ae
×
1097
        }
×
1098

1099
        return ApiErrors[JSConsumerFilterNotSubsetErr]
×
1100
}
1101

1102
// NewJSConsumerHBRequiresPushError creates a new JSConsumerHBRequiresPushErr error: "consumer idle heartbeat requires a push based consumer"
1103
func NewJSConsumerHBRequiresPushError(opts ...ErrorOption) *ApiError {
×
1104
        eopts := parseOpts(opts)
×
1105
        if ae, ok := eopts.err.(*ApiError); ok {
×
1106
                return ae
×
1107
        }
×
1108

1109
        return ApiErrors[JSConsumerHBRequiresPushErr]
×
1110
}
1111

1112
// NewJSConsumerInactiveThresholdExcessError creates a new JSConsumerInactiveThresholdExcess error: "consumer inactive threshold exceeds system limit of {limit}"
1113
func NewJSConsumerInactiveThresholdExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
2✔
1114
        eopts := parseOpts(opts)
2✔
1115
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1116
                return ae
×
1117
        }
×
1118

1119
        e := ApiErrors[JSConsumerInactiveThresholdExcess]
2✔
1120
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
2✔
1121
        return &ApiError{
2✔
1122
                Code:        e.Code,
2✔
1123
                ErrCode:     e.ErrCode,
2✔
1124
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1125
        }
2✔
1126
}
1127

1128
// NewJSConsumerInvalidDeliverSubjectError creates a new JSConsumerInvalidDeliverSubject error: "invalid push consumer deliver subject"
1129
func NewJSConsumerInvalidDeliverSubjectError(opts ...ErrorOption) *ApiError {
2✔
1130
        eopts := parseOpts(opts)
2✔
1131
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1132
                return ae
×
1133
        }
×
1134

1135
        return ApiErrors[JSConsumerInvalidDeliverSubject]
2✔
1136
}
1137

1138
// NewJSConsumerInvalidGroupNameError creates a new JSConsumerInvalidGroupNameErr error: "Valid priority group name must match A-Z, a-z, 0-9, -_/=)+ and may not exceed 16 characters"
1139
func NewJSConsumerInvalidGroupNameError(opts ...ErrorOption) *ApiError {
4✔
1140
        eopts := parseOpts(opts)
4✔
1141
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1142
                return ae
×
1143
        }
×
1144

1145
        return ApiErrors[JSConsumerInvalidGroupNameErr]
4✔
1146
}
1147

1148
// NewJSConsumerInvalidPolicyError creates a new JSConsumerInvalidPolicyErrF error: "{err}"
1149
func NewJSConsumerInvalidPolicyError(err error, opts ...ErrorOption) *ApiError {
10✔
1150
        eopts := parseOpts(opts)
10✔
1151
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1152
                return ae
×
1153
        }
×
1154

1155
        e := ApiErrors[JSConsumerInvalidPolicyErrF]
10✔
1156
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1157
        return &ApiError{
10✔
1158
                Code:        e.Code,
10✔
1159
                ErrCode:     e.ErrCode,
10✔
1160
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1161
        }
10✔
1162
}
1163

1164
// NewJSConsumerInvalidPriorityGroupError creates a new JSConsumerInvalidPriorityGroupErr error: "Provided priority group does not exist for this consumer"
1165
func NewJSConsumerInvalidPriorityGroupError(opts ...ErrorOption) *ApiError {
2✔
1166
        eopts := parseOpts(opts)
2✔
1167
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1168
                return ae
×
1169
        }
×
1170

1171
        return ApiErrors[JSConsumerInvalidPriorityGroupErr]
2✔
1172
}
1173

1174
// NewJSConsumerInvalidSamplingError creates a new JSConsumerInvalidSamplingErrF error: "failed to parse consumer sampling configuration: {err}"
1175
func NewJSConsumerInvalidSamplingError(err error, opts ...ErrorOption) *ApiError {
×
1176
        eopts := parseOpts(opts)
×
1177
        if ae, ok := eopts.err.(*ApiError); ok {
×
1178
                return ae
×
1179
        }
×
1180

1181
        e := ApiErrors[JSConsumerInvalidSamplingErrF]
×
1182
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1183
        return &ApiError{
×
1184
                Code:        e.Code,
×
1185
                ErrCode:     e.ErrCode,
×
1186
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1187
        }
×
1188
}
1189

1190
// NewJSConsumerMaxDeliverBackoffError creates a new JSConsumerMaxDeliverBackoffErr error: "max deliver is required to be > length of backoff values"
1191
func NewJSConsumerMaxDeliverBackoffError(opts ...ErrorOption) *ApiError {
3✔
1192
        eopts := parseOpts(opts)
3✔
1193
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1194
                return ae
×
1195
        }
×
1196

1197
        return ApiErrors[JSConsumerMaxDeliverBackoffErr]
3✔
1198
}
1199

1200
// NewJSConsumerMaxPendingAckExcessError creates a new JSConsumerMaxPendingAckExcessErrF error: "consumer max ack pending exceeds system limit of {limit}"
1201
func NewJSConsumerMaxPendingAckExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
12✔
1202
        eopts := parseOpts(opts)
12✔
1203
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
1204
                return ae
×
1205
        }
×
1206

1207
        e := ApiErrors[JSConsumerMaxPendingAckExcessErrF]
12✔
1208
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
12✔
1209
        return &ApiError{
12✔
1210
                Code:        e.Code,
12✔
1211
                ErrCode:     e.ErrCode,
12✔
1212
                Description: strings.NewReplacer(args...).Replace(e.Description),
12✔
1213
        }
12✔
1214
}
1215

1216
// NewJSConsumerMaxPendingAckPolicyRequiredError creates a new JSConsumerMaxPendingAckPolicyRequiredErr error: "consumer requires ack policy for max ack pending"
1217
func NewJSConsumerMaxPendingAckPolicyRequiredError(opts ...ErrorOption) *ApiError {
2✔
1218
        eopts := parseOpts(opts)
2✔
1219
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1220
                return ae
×
1221
        }
×
1222

1223
        return ApiErrors[JSConsumerMaxPendingAckPolicyRequiredErr]
2✔
1224
}
1225

1226
// NewJSConsumerMaxRequestBatchExceededError creates a new JSConsumerMaxRequestBatchExceededF error: "consumer max request batch exceeds server limit of {limit}"
1227
func NewJSConsumerMaxRequestBatchExceededError(limit interface{}, opts ...ErrorOption) *ApiError {
4✔
1228
        eopts := parseOpts(opts)
4✔
1229
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1230
                return ae
×
1231
        }
×
1232

1233
        e := ApiErrors[JSConsumerMaxRequestBatchExceededF]
4✔
1234
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
4✔
1235
        return &ApiError{
4✔
1236
                Code:        e.Code,
4✔
1237
                ErrCode:     e.ErrCode,
4✔
1238
                Description: strings.NewReplacer(args...).Replace(e.Description),
4✔
1239
        }
4✔
1240
}
1241

1242
// NewJSConsumerMaxRequestBatchNegativeError creates a new JSConsumerMaxRequestBatchNegativeErr error: "consumer max request batch needs to be > 0"
1243
func NewJSConsumerMaxRequestBatchNegativeError(opts ...ErrorOption) *ApiError {
×
1244
        eopts := parseOpts(opts)
×
1245
        if ae, ok := eopts.err.(*ApiError); ok {
×
1246
                return ae
×
1247
        }
×
1248

1249
        return ApiErrors[JSConsumerMaxRequestBatchNegativeErr]
×
1250
}
1251

1252
// NewJSConsumerMaxRequestExpiresToSmallError creates a new JSConsumerMaxRequestExpiresToSmall error: "consumer max request expires needs to be >= 1ms"
1253
func NewJSConsumerMaxRequestExpiresToSmallError(opts ...ErrorOption) *ApiError {
×
1254
        eopts := parseOpts(opts)
×
1255
        if ae, ok := eopts.err.(*ApiError); ok {
×
1256
                return ae
×
1257
        }
×
1258

1259
        return ApiErrors[JSConsumerMaxRequestExpiresToSmall]
×
1260
}
1261

1262
// NewJSConsumerMaxWaitingNegativeError creates a new JSConsumerMaxWaitingNegativeErr error: "consumer max waiting needs to be positive"
1263
func NewJSConsumerMaxWaitingNegativeError(opts ...ErrorOption) *ApiError {
2✔
1264
        eopts := parseOpts(opts)
2✔
1265
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1266
                return ae
×
1267
        }
×
1268

1269
        return ApiErrors[JSConsumerMaxWaitingNegativeErr]
2✔
1270
}
1271

1272
// NewJSConsumerMetadataLengthError creates a new JSConsumerMetadataLengthErrF error: "consumer metadata exceeds maximum size of {limit}"
1273
func NewJSConsumerMetadataLengthError(limit interface{}, opts ...ErrorOption) *ApiError {
1✔
1274
        eopts := parseOpts(opts)
1✔
1275
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1276
                return ae
×
1277
        }
×
1278

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

1288
// NewJSConsumerMultipleFiltersNotAllowedError creates a new JSConsumerMultipleFiltersNotAllowed error: "consumer with multiple subject filters cannot use subject based API"
1289
func NewJSConsumerMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
1290
        eopts := parseOpts(opts)
1✔
1291
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1292
                return ae
×
1293
        }
×
1294

1295
        return ApiErrors[JSConsumerMultipleFiltersNotAllowed]
1✔
1296
}
1297

1298
// NewJSConsumerNameContainsPathSeparatorsError creates a new JSConsumerNameContainsPathSeparatorsErr error: "Consumer name can not contain path separators"
1299
func NewJSConsumerNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
8✔
1300
        eopts := parseOpts(opts)
8✔
1301
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1302
                return ae
×
1303
        }
×
1304

1305
        return ApiErrors[JSConsumerNameContainsPathSeparatorsErr]
8✔
1306
}
1307

1308
// NewJSConsumerNameExistError creates a new JSConsumerNameExistErr error: "consumer name already in use"
1309
func NewJSConsumerNameExistError(opts ...ErrorOption) *ApiError {
×
1310
        eopts := parseOpts(opts)
×
1311
        if ae, ok := eopts.err.(*ApiError); ok {
×
1312
                return ae
×
1313
        }
×
1314

1315
        return ApiErrors[JSConsumerNameExistErr]
×
1316
}
1317

1318
// NewJSConsumerNameTooLongError creates a new JSConsumerNameTooLongErrF error: "consumer name is too long, maximum allowed is {max}"
1319
func NewJSConsumerNameTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
×
1320
        eopts := parseOpts(opts)
×
1321
        if ae, ok := eopts.err.(*ApiError); ok {
×
1322
                return ae
×
1323
        }
×
1324

1325
        e := ApiErrors[JSConsumerNameTooLongErrF]
×
1326
        args := e.toReplacerArgs([]interface{}{"{max}", max})
×
1327
        return &ApiError{
×
1328
                Code:        e.Code,
×
1329
                ErrCode:     e.ErrCode,
×
1330
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1331
        }
×
1332
}
1333

1334
// NewJSConsumerNotFoundError creates a new JSConsumerNotFoundErr error: "consumer not found"
1335
func NewJSConsumerNotFoundError(opts ...ErrorOption) *ApiError {
2,736✔
1336
        eopts := parseOpts(opts)
2,736✔
1337
        if ae, ok := eopts.err.(*ApiError); ok {
2,736✔
1338
                return ae
×
1339
        }
×
1340

1341
        return ApiErrors[JSConsumerNotFoundErr]
2,736✔
1342
}
1343

1344
// NewJSConsumerOfflineError creates a new JSConsumerOfflineErr error: "consumer is offline"
1345
func NewJSConsumerOfflineError(opts ...ErrorOption) *ApiError {
6✔
1346
        eopts := parseOpts(opts)
6✔
1347
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1348
                return ae
×
1349
        }
×
1350

1351
        return ApiErrors[JSConsumerOfflineErr]
6✔
1352
}
1353

1354
// NewJSConsumerOnMappedError creates a new JSConsumerOnMappedErr error: "consumer direct on a mapped consumer"
1355
func NewJSConsumerOnMappedError(opts ...ErrorOption) *ApiError {
×
1356
        eopts := parseOpts(opts)
×
1357
        if ae, ok := eopts.err.(*ApiError); ok {
×
1358
                return ae
×
1359
        }
×
1360

1361
        return ApiErrors[JSConsumerOnMappedErr]
×
1362
}
1363

1364
// NewJSConsumerOverlappingSubjectFiltersError creates a new JSConsumerOverlappingSubjectFilters error: "consumer subject filters cannot overlap"
1365
func NewJSConsumerOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
1✔
1366
        eopts := parseOpts(opts)
1✔
1367
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1368
                return ae
×
1369
        }
×
1370

1371
        return ApiErrors[JSConsumerOverlappingSubjectFilters]
1✔
1372
}
1373

1374
// NewJSConsumerPriorityPolicyWithoutGroupError creates a new JSConsumerPriorityPolicyWithoutGroup error: "Setting PriorityPolicy requires at least one PriorityGroup to be set"
1375
func NewJSConsumerPriorityPolicyWithoutGroupError(opts ...ErrorOption) *ApiError {
4✔
1376
        eopts := parseOpts(opts)
4✔
1377
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1378
                return ae
×
1379
        }
×
1380

1381
        return ApiErrors[JSConsumerPriorityPolicyWithoutGroup]
4✔
1382
}
1383

1384
// NewJSConsumerPullNotDurableError creates a new JSConsumerPullNotDurableErr error: "consumer in pull mode requires a durable name"
1385
func NewJSConsumerPullNotDurableError(opts ...ErrorOption) *ApiError {
×
1386
        eopts := parseOpts(opts)
×
1387
        if ae, ok := eopts.err.(*ApiError); ok {
×
1388
                return ae
×
1389
        }
×
1390

1391
        return ApiErrors[JSConsumerPullNotDurableErr]
×
1392
}
1393

1394
// NewJSConsumerPullRequiresAckError creates a new JSConsumerPullRequiresAckErr error: "consumer in pull mode requires explicit ack policy on workqueue stream"
1395
func NewJSConsumerPullRequiresAckError(opts ...ErrorOption) *ApiError {
6✔
1396
        eopts := parseOpts(opts)
6✔
1397
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1398
                return ae
×
1399
        }
×
1400

1401
        return ApiErrors[JSConsumerPullRequiresAckErr]
6✔
1402
}
1403

1404
// NewJSConsumerPullWithRateLimitError creates a new JSConsumerPullWithRateLimitErr error: "consumer in pull mode can not have rate limit set"
1405
func NewJSConsumerPullWithRateLimitError(opts ...ErrorOption) *ApiError {
1✔
1406
        eopts := parseOpts(opts)
1✔
1407
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1408
                return ae
×
1409
        }
×
1410

1411
        return ApiErrors[JSConsumerPullWithRateLimitErr]
1✔
1412
}
1413

1414
// NewJSConsumerPushMaxWaitingError creates a new JSConsumerPushMaxWaitingErr error: "consumer in push mode can not set max waiting"
1415
func NewJSConsumerPushMaxWaitingError(opts ...ErrorOption) *ApiError {
3✔
1416
        eopts := parseOpts(opts)
3✔
1417
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1418
                return ae
×
1419
        }
×
1420

1421
        return ApiErrors[JSConsumerPushMaxWaitingErr]
3✔
1422
}
1423

1424
// NewJSConsumerReplacementWithDifferentNameError creates a new JSConsumerReplacementWithDifferentNameErr error: "consumer replacement durable config not the same"
1425
func NewJSConsumerReplacementWithDifferentNameError(opts ...ErrorOption) *ApiError {
×
1426
        eopts := parseOpts(opts)
×
1427
        if ae, ok := eopts.err.(*ApiError); ok {
×
1428
                return ae
×
1429
        }
×
1430

1431
        return ApiErrors[JSConsumerReplacementWithDifferentNameErr]
×
1432
}
1433

1434
// NewJSConsumerReplicasExceedsStreamError creates a new JSConsumerReplicasExceedsStream error: "consumer config replica count exceeds parent stream"
1435
func NewJSConsumerReplicasExceedsStreamError(opts ...ErrorOption) *ApiError {
1✔
1436
        eopts := parseOpts(opts)
1✔
1437
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1438
                return ae
×
1439
        }
×
1440

1441
        return ApiErrors[JSConsumerReplicasExceedsStream]
1✔
1442
}
1443

1444
// NewJSConsumerReplicasShouldMatchStreamError creates a new JSConsumerReplicasShouldMatchStream error: "consumer config replicas must match interest retention stream's replicas"
1445
func NewJSConsumerReplicasShouldMatchStreamError(opts ...ErrorOption) *ApiError {
2✔
1446
        eopts := parseOpts(opts)
2✔
1447
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1448
                return ae
×
1449
        }
×
1450

1451
        return ApiErrors[JSConsumerReplicasShouldMatchStream]
2✔
1452
}
1453

1454
// NewJSConsumerSmallHeartbeatError creates a new JSConsumerSmallHeartbeatErr error: "consumer idle heartbeat needs to be >= 100ms"
1455
func NewJSConsumerSmallHeartbeatError(opts ...ErrorOption) *ApiError {
1✔
1456
        eopts := parseOpts(opts)
1✔
1457
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1458
                return ae
×
1459
        }
×
1460

1461
        return ApiErrors[JSConsumerSmallHeartbeatErr]
1✔
1462
}
1463

1464
// NewJSConsumerStoreFailedError creates a new JSConsumerStoreFailedErrF error: "error creating store for consumer: {err}"
1465
func NewJSConsumerStoreFailedError(err error, opts ...ErrorOption) *ApiError {
10✔
1466
        eopts := parseOpts(opts)
10✔
1467
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1468
                return ae
×
1469
        }
×
1470

1471
        e := ApiErrors[JSConsumerStoreFailedErrF]
10✔
1472
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1473
        return &ApiError{
10✔
1474
                Code:        e.Code,
10✔
1475
                ErrCode:     e.ErrCode,
10✔
1476
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1477
        }
10✔
1478
}
1479

1480
// NewJSConsumerWQConsumerNotDeliverAllError creates a new JSConsumerWQConsumerNotDeliverAllErr error: "consumer must be deliver all on workqueue stream"
1481
func NewJSConsumerWQConsumerNotDeliverAllError(opts ...ErrorOption) *ApiError {
×
1482
        eopts := parseOpts(opts)
×
1483
        if ae, ok := eopts.err.(*ApiError); ok {
×
1484
                return ae
×
1485
        }
×
1486

1487
        return ApiErrors[JSConsumerWQConsumerNotDeliverAllErr]
×
1488
}
1489

1490
// NewJSConsumerWQConsumerNotUniqueError creates a new JSConsumerWQConsumerNotUniqueErr error: "filtered consumer not unique on workqueue stream"
1491
func NewJSConsumerWQConsumerNotUniqueError(opts ...ErrorOption) *ApiError {
11✔
1492
        eopts := parseOpts(opts)
11✔
1493
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
1494
                return ae
×
1495
        }
×
1496

1497
        return ApiErrors[JSConsumerWQConsumerNotUniqueErr]
11✔
1498
}
1499

1500
// NewJSConsumerWQMultipleUnfilteredError creates a new JSConsumerWQMultipleUnfilteredErr error: "multiple non-filtered consumers not allowed on workqueue stream"
1501
func NewJSConsumerWQMultipleUnfilteredError(opts ...ErrorOption) *ApiError {
2✔
1502
        eopts := parseOpts(opts)
2✔
1503
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1504
                return ae
×
1505
        }
×
1506

1507
        return ApiErrors[JSConsumerWQMultipleUnfilteredErr]
2✔
1508
}
1509

1510
// NewJSConsumerWQRequiresExplicitAckError creates a new JSConsumerWQRequiresExplicitAckErr error: "workqueue stream requires explicit ack"
1511
func NewJSConsumerWQRequiresExplicitAckError(opts ...ErrorOption) *ApiError {
×
1512
        eopts := parseOpts(opts)
×
1513
        if ae, ok := eopts.err.(*ApiError); ok {
×
1514
                return ae
×
1515
        }
×
1516

1517
        return ApiErrors[JSConsumerWQRequiresExplicitAckErr]
×
1518
}
1519

1520
// NewJSConsumerWithFlowControlNeedsHeartbeatsError creates a new JSConsumerWithFlowControlNeedsHeartbeats error: "consumer with flow control also needs heartbeats"
1521
func NewJSConsumerWithFlowControlNeedsHeartbeatsError(opts ...ErrorOption) *ApiError {
4✔
1522
        eopts := parseOpts(opts)
4✔
1523
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1524
                return ae
×
1525
        }
×
1526

1527
        return ApiErrors[JSConsumerWithFlowControlNeedsHeartbeats]
4✔
1528
}
1529

1530
// NewJSInsufficientResourcesError creates a new JSInsufficientResourcesErr error: "insufficient resources"
1531
func NewJSInsufficientResourcesError(opts ...ErrorOption) *ApiError {
10✔
1532
        eopts := parseOpts(opts)
10✔
1533
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1534
                return ae
×
1535
        }
×
1536

1537
        return ApiErrors[JSInsufficientResourcesErr]
10✔
1538
}
1539

1540
// NewJSInvalidJSONError creates a new JSInvalidJSONErr error: "invalid JSON: {err}"
1541
func NewJSInvalidJSONError(err error, opts ...ErrorOption) *ApiError {
10✔
1542
        eopts := parseOpts(opts)
10✔
1543
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1544
                return ae
×
1545
        }
×
1546

1547
        e := ApiErrors[JSInvalidJSONErr]
10✔
1548
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1549
        return &ApiError{
10✔
1550
                Code:        e.Code,
10✔
1551
                ErrCode:     e.ErrCode,
10✔
1552
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1553
        }
10✔
1554
}
1555

1556
// NewJSMaximumConsumersLimitError creates a new JSMaximumConsumersLimitErr error: "maximum consumers limit reached"
1557
func NewJSMaximumConsumersLimitError(opts ...ErrorOption) *ApiError {
29✔
1558
        eopts := parseOpts(opts)
29✔
1559
        if ae, ok := eopts.err.(*ApiError); ok {
29✔
1560
                return ae
×
1561
        }
×
1562

1563
        return ApiErrors[JSMaximumConsumersLimitErr]
29✔
1564
}
1565

1566
// NewJSMaximumStreamsLimitError creates a new JSMaximumStreamsLimitErr error: "maximum number of streams reached"
1567
func NewJSMaximumStreamsLimitError(opts ...ErrorOption) *ApiError {
16✔
1568
        eopts := parseOpts(opts)
16✔
1569
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
1570
                return ae
×
1571
        }
×
1572

1573
        return ApiErrors[JSMaximumStreamsLimitErr]
16✔
1574
}
1575

1576
// NewJSMemoryResourcesExceededError creates a new JSMemoryResourcesExceededErr error: "insufficient memory resources available"
1577
func NewJSMemoryResourcesExceededError(opts ...ErrorOption) *ApiError {
4✔
1578
        eopts := parseOpts(opts)
4✔
1579
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1580
                return ae
×
1581
        }
×
1582

1583
        return ApiErrors[JSMemoryResourcesExceededErr]
4✔
1584
}
1585

1586
// NewJSMessageCounterBrokenError creates a new JSMessageCounterBrokenErr error: "message counter is broken"
1587
func NewJSMessageCounterBrokenError(opts ...ErrorOption) *ApiError {
4✔
1588
        eopts := parseOpts(opts)
4✔
1589
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1590
                return ae
×
1591
        }
×
1592

1593
        return ApiErrors[JSMessageCounterBrokenErr]
4✔
1594
}
1595

1596
// NewJSMessageIncrDisabledError creates a new JSMessageIncrDisabledErr error: "message counters is disabled"
1597
func NewJSMessageIncrDisabledError(opts ...ErrorOption) *ApiError {
4✔
1598
        eopts := parseOpts(opts)
4✔
1599
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1600
                return ae
×
1601
        }
×
1602

1603
        return ApiErrors[JSMessageIncrDisabledErr]
4✔
1604
}
1605

1606
// NewJSMessageIncrInvalidError creates a new JSMessageIncrInvalidErr error: "message counter increment is invalid"
1607
func NewJSMessageIncrInvalidError(opts ...ErrorOption) *ApiError {
24✔
1608
        eopts := parseOpts(opts)
24✔
1609
        if ae, ok := eopts.err.(*ApiError); ok {
24✔
1610
                return ae
×
1611
        }
×
1612

1613
        return ApiErrors[JSMessageIncrInvalidErr]
24✔
1614
}
1615

1616
// NewJSMessageIncrMissingError creates a new JSMessageIncrMissingErr error: "message counter increment is missing"
1617
func NewJSMessageIncrMissingError(opts ...ErrorOption) *ApiError {
8✔
1618
        eopts := parseOpts(opts)
8✔
1619
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1620
                return ae
×
1621
        }
×
1622

1623
        return ApiErrors[JSMessageIncrMissingErr]
8✔
1624
}
1625

1626
// NewJSMessageIncrPayloadError creates a new JSMessageIncrPayloadErr error: "message counter has payload"
1627
func NewJSMessageIncrPayloadError(opts ...ErrorOption) *ApiError {
4✔
1628
        eopts := parseOpts(opts)
4✔
1629
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1630
                return ae
×
1631
        }
×
1632

1633
        return ApiErrors[JSMessageIncrPayloadErr]
4✔
1634
}
1635

1636
// NewJSMessageTTLDisabledError creates a new JSMessageTTLDisabledErr error: "per-message TTL is disabled"
1637
func NewJSMessageTTLDisabledError(opts ...ErrorOption) *ApiError {
7✔
1638
        eopts := parseOpts(opts)
7✔
1639
        if ae, ok := eopts.err.(*ApiError); ok {
7✔
1640
                return ae
×
1641
        }
×
1642

1643
        return ApiErrors[JSMessageTTLDisabledErr]
7✔
1644
}
1645

1646
// NewJSMessageTTLInvalidError creates a new JSMessageTTLInvalidErr error: "invalid per-message TTL"
1647
func NewJSMessageTTLInvalidError(opts ...ErrorOption) *ApiError {
18✔
1648
        eopts := parseOpts(opts)
18✔
1649
        if ae, ok := eopts.err.(*ApiError); ok {
18✔
1650
                return ae
×
1651
        }
×
1652

1653
        return ApiErrors[JSMessageTTLInvalidErr]
18✔
1654
}
1655

1656
// NewJSMirrorConsumerSetupFailedError creates a new JSMirrorConsumerSetupFailedErrF error: "{err}"
1657
func NewJSMirrorConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
1658
        eopts := parseOpts(opts)
×
1659
        if ae, ok := eopts.err.(*ApiError); ok {
×
1660
                return ae
×
1661
        }
×
1662

1663
        e := ApiErrors[JSMirrorConsumerSetupFailedErrF]
×
1664
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1665
        return &ApiError{
×
1666
                Code:        e.Code,
×
1667
                ErrCode:     e.ErrCode,
×
1668
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1669
        }
×
1670
}
1671

1672
// NewJSMirrorInvalidStreamNameError creates a new JSMirrorInvalidStreamName error: "mirrored stream name is invalid"
1673
func NewJSMirrorInvalidStreamNameError(opts ...ErrorOption) *ApiError {
×
1674
        eopts := parseOpts(opts)
×
1675
        if ae, ok := eopts.err.(*ApiError); ok {
×
1676
                return ae
×
1677
        }
×
1678

1679
        return ApiErrors[JSMirrorInvalidStreamName]
×
1680
}
1681

1682
// NewJSMirrorInvalidSubjectFilterError creates a new JSMirrorInvalidSubjectFilter error: "mirror transform source: {err}"
1683
func NewJSMirrorInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
2✔
1684
        eopts := parseOpts(opts)
2✔
1685
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1686
                return ae
×
1687
        }
×
1688

1689
        e := ApiErrors[JSMirrorInvalidSubjectFilter]
2✔
1690
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2✔
1691
        return &ApiError{
2✔
1692
                Code:        e.Code,
2✔
1693
                ErrCode:     e.ErrCode,
2✔
1694
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1695
        }
2✔
1696
}
1697

1698
// NewJSMirrorInvalidTransformDestinationError creates a new JSMirrorInvalidTransformDestination error: "mirror transform: {err}"
1699
func NewJSMirrorInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
2✔
1700
        eopts := parseOpts(opts)
2✔
1701
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1702
                return ae
×
1703
        }
×
1704

1705
        e := ApiErrors[JSMirrorInvalidTransformDestination]
2✔
1706
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2✔
1707
        return &ApiError{
2✔
1708
                Code:        e.Code,
2✔
1709
                ErrCode:     e.ErrCode,
2✔
1710
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1711
        }
2✔
1712
}
1713

1714
// NewJSMirrorMaxMessageSizeTooBigError creates a new JSMirrorMaxMessageSizeTooBigErr error: "stream mirror must have max message size >= source"
1715
func NewJSMirrorMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
1716
        eopts := parseOpts(opts)
×
1717
        if ae, ok := eopts.err.(*ApiError); ok {
×
1718
                return ae
×
1719
        }
×
1720

1721
        return ApiErrors[JSMirrorMaxMessageSizeTooBigErr]
×
1722
}
1723

1724
// NewJSMirrorMultipleFiltersNotAllowedError creates a new JSMirrorMultipleFiltersNotAllowed error: "mirror with multiple subject transforms cannot also have a single subject filter"
1725
func NewJSMirrorMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
1726
        eopts := parseOpts(opts)
1✔
1727
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1728
                return ae
×
1729
        }
×
1730

1731
        return ApiErrors[JSMirrorMultipleFiltersNotAllowed]
1✔
1732
}
1733

1734
// NewJSMirrorOverlappingSubjectFiltersError creates a new JSMirrorOverlappingSubjectFilters error: "mirror subject filters can not overlap"
1735
func NewJSMirrorOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
2✔
1736
        eopts := parseOpts(opts)
2✔
1737
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1738
                return ae
×
1739
        }
×
1740

1741
        return ApiErrors[JSMirrorOverlappingSubjectFilters]
2✔
1742
}
1743

1744
// NewJSMirrorWithCountersError creates a new JSMirrorWithCountersErr error: "stream mirrors can not also calculate counters"
1745
func NewJSMirrorWithCountersError(opts ...ErrorOption) *ApiError {
4✔
1746
        eopts := parseOpts(opts)
4✔
1747
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1748
                return ae
×
1749
        }
×
1750

1751
        return ApiErrors[JSMirrorWithCountersErr]
4✔
1752
}
1753

1754
// NewJSMirrorWithFirstSeqError creates a new JSMirrorWithFirstSeqErr error: "stream mirrors can not have first sequence configured"
1755
func NewJSMirrorWithFirstSeqError(opts ...ErrorOption) *ApiError {
2✔
1756
        eopts := parseOpts(opts)
2✔
1757
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1758
                return ae
×
1759
        }
×
1760

1761
        return ApiErrors[JSMirrorWithFirstSeqErr]
2✔
1762
}
1763

1764
// NewJSMirrorWithSourcesError creates a new JSMirrorWithSourcesErr error: "stream mirrors can not also contain other sources"
1765
func NewJSMirrorWithSourcesError(opts ...ErrorOption) *ApiError {
×
1766
        eopts := parseOpts(opts)
×
1767
        if ae, ok := eopts.err.(*ApiError); ok {
×
1768
                return ae
×
1769
        }
×
1770

1771
        return ApiErrors[JSMirrorWithSourcesErr]
×
1772
}
1773

1774
// NewJSMirrorWithStartSeqAndTimeError creates a new JSMirrorWithStartSeqAndTimeErr error: "stream mirrors can not have both start seq and start time configured"
1775
func NewJSMirrorWithStartSeqAndTimeError(opts ...ErrorOption) *ApiError {
×
1776
        eopts := parseOpts(opts)
×
1777
        if ae, ok := eopts.err.(*ApiError); ok {
×
1778
                return ae
×
1779
        }
×
1780

1781
        return ApiErrors[JSMirrorWithStartSeqAndTimeErr]
×
1782
}
1783

1784
// NewJSMirrorWithSubjectFiltersError creates a new JSMirrorWithSubjectFiltersErr error: "stream mirrors can not contain filtered subjects"
1785
func NewJSMirrorWithSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
1786
        eopts := parseOpts(opts)
×
1787
        if ae, ok := eopts.err.(*ApiError); ok {
×
1788
                return ae
×
1789
        }
×
1790

1791
        return ApiErrors[JSMirrorWithSubjectFiltersErr]
×
1792
}
1793

1794
// NewJSMirrorWithSubjectsError creates a new JSMirrorWithSubjectsErr error: "stream mirrors can not contain subjects"
1795
func NewJSMirrorWithSubjectsError(opts ...ErrorOption) *ApiError {
2✔
1796
        eopts := parseOpts(opts)
2✔
1797
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1798
                return ae
×
1799
        }
×
1800

1801
        return ApiErrors[JSMirrorWithSubjectsErr]
2✔
1802
}
1803

1804
// NewJSNoAccountError creates a new JSNoAccountErr error: "account not found"
1805
func NewJSNoAccountError(opts ...ErrorOption) *ApiError {
1✔
1806
        eopts := parseOpts(opts)
1✔
1807
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1808
                return ae
×
1809
        }
×
1810

1811
        return ApiErrors[JSNoAccountErr]
1✔
1812
}
1813

1814
// NewJSNoLimitsError creates a new JSNoLimitsErr error: "no JetStream default or applicable tiered limit present"
1815
func NewJSNoLimitsError(opts ...ErrorOption) *ApiError {
4✔
1816
        eopts := parseOpts(opts)
4✔
1817
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1818
                return ae
×
1819
        }
×
1820

1821
        return ApiErrors[JSNoLimitsErr]
4✔
1822
}
1823

1824
// NewJSNoMessageFoundError creates a new JSNoMessageFoundErr error: "no message found"
1825
func NewJSNoMessageFoundError(opts ...ErrorOption) *ApiError {
460✔
1826
        eopts := parseOpts(opts)
460✔
1827
        if ae, ok := eopts.err.(*ApiError); ok {
460✔
1828
                return ae
×
1829
        }
×
1830

1831
        return ApiErrors[JSNoMessageFoundErr]
460✔
1832
}
1833

1834
// NewJSNotEmptyRequestError creates a new JSNotEmptyRequestErr error: "expected an empty request payload"
1835
func NewJSNotEmptyRequestError(opts ...ErrorOption) *ApiError {
3✔
1836
        eopts := parseOpts(opts)
3✔
1837
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1838
                return ae
×
1839
        }
×
1840

1841
        return ApiErrors[JSNotEmptyRequestErr]
3✔
1842
}
1843

1844
// NewJSNotEnabledError creates a new JSNotEnabledErr error: "JetStream not enabled"
1845
func NewJSNotEnabledError(opts ...ErrorOption) *ApiError {
10✔
1846
        eopts := parseOpts(opts)
10✔
1847
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1848
                return ae
×
1849
        }
×
1850

1851
        return ApiErrors[JSNotEnabledErr]
10✔
1852
}
1853

1854
// NewJSNotEnabledForAccountError creates a new JSNotEnabledForAccountErr error: "JetStream not enabled for account"
1855
func NewJSNotEnabledForAccountError(opts ...ErrorOption) *ApiError {
367✔
1856
        eopts := parseOpts(opts)
367✔
1857
        if ae, ok := eopts.err.(*ApiError); ok {
367✔
1858
                return ae
×
1859
        }
×
1860

1861
        return ApiErrors[JSNotEnabledForAccountErr]
367✔
1862
}
1863

1864
// NewJSPedanticError creates a new JSPedanticErrF error: "pedantic mode: {err}"
1865
func NewJSPedanticError(err error, opts ...ErrorOption) *ApiError {
8✔
1866
        eopts := parseOpts(opts)
8✔
1867
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1868
                return ae
×
1869
        }
×
1870

1871
        e := ApiErrors[JSPedanticErrF]
8✔
1872
        args := e.toReplacerArgs([]interface{}{"{err}", err})
8✔
1873
        return &ApiError{
8✔
1874
                Code:        e.Code,
8✔
1875
                ErrCode:     e.ErrCode,
8✔
1876
                Description: strings.NewReplacer(args...).Replace(e.Description),
8✔
1877
        }
8✔
1878
}
1879

1880
// NewJSPeerRemapError creates a new JSPeerRemapErr error: "peer remap failed"
1881
func NewJSPeerRemapError(opts ...ErrorOption) *ApiError {
5✔
1882
        eopts := parseOpts(opts)
5✔
1883
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1884
                return ae
1✔
1885
        }
1✔
1886

1887
        return ApiErrors[JSPeerRemapErr]
4✔
1888
}
1889

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

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

1906
// NewJSReplicasCountCannotBeNegativeError creates a new JSReplicasCountCannotBeNegative error: "replicas count cannot be negative"
1907
func NewJSReplicasCountCannotBeNegativeError(opts ...ErrorOption) *ApiError {
16✔
1908
        eopts := parseOpts(opts)
16✔
1909
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
1910
                return ae
×
1911
        }
×
1912

1913
        return ApiErrors[JSReplicasCountCannotBeNegative]
16✔
1914
}
1915

1916
// NewJSRestoreSubscribeFailedError creates a new JSRestoreSubscribeFailedErrF error: "JetStream unable to subscribe to restore snapshot {subject}: {err}"
1917
func NewJSRestoreSubscribeFailedError(err error, subject interface{}, opts ...ErrorOption) *ApiError {
1✔
1918
        eopts := parseOpts(opts)
1✔
1919
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1920
                return ae
×
1921
        }
×
1922

1923
        e := ApiErrors[JSRestoreSubscribeFailedErrF]
1✔
1924
        args := e.toReplacerArgs([]interface{}{"{err}", err, "{subject}", subject})
1✔
1925
        return &ApiError{
1✔
1926
                Code:        e.Code,
1✔
1927
                ErrCode:     e.ErrCode,
1✔
1928
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1929
        }
1✔
1930
}
1931

1932
// NewJSSequenceNotFoundError creates a new JSSequenceNotFoundErrF error: "sequence {seq} not found"
1933
func NewJSSequenceNotFoundError(seq uint64, opts ...ErrorOption) *ApiError {
×
1934
        eopts := parseOpts(opts)
×
1935
        if ae, ok := eopts.err.(*ApiError); ok {
×
1936
                return ae
×
1937
        }
×
1938

1939
        e := ApiErrors[JSSequenceNotFoundErrF]
×
1940
        args := e.toReplacerArgs([]interface{}{"{seq}", seq})
×
1941
        return &ApiError{
×
1942
                Code:        e.Code,
×
1943
                ErrCode:     e.ErrCode,
×
1944
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1945
        }
×
1946
}
1947

1948
// NewJSSnapshotDeliverSubjectInvalidError creates a new JSSnapshotDeliverSubjectInvalidErr error: "deliver subject not valid"
1949
func NewJSSnapshotDeliverSubjectInvalidError(opts ...ErrorOption) *ApiError {
1✔
1950
        eopts := parseOpts(opts)
1✔
1951
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1952
                return ae
×
1953
        }
×
1954

1955
        return ApiErrors[JSSnapshotDeliverSubjectInvalidErr]
1✔
1956
}
1957

1958
// NewJSSourceConsumerSetupFailedError creates a new JSSourceConsumerSetupFailedErrF error: "{err}"
1959
func NewJSSourceConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
1960
        eopts := parseOpts(opts)
×
1961
        if ae, ok := eopts.err.(*ApiError); ok {
×
1962
                return ae
×
1963
        }
×
1964

1965
        e := ApiErrors[JSSourceConsumerSetupFailedErrF]
×
1966
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1967
        return &ApiError{
×
1968
                Code:        e.Code,
×
1969
                ErrCode:     e.ErrCode,
×
1970
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1971
        }
×
1972
}
1973

1974
// NewJSSourceDuplicateDetectedError creates a new JSSourceDuplicateDetected error: "duplicate source configuration detected"
1975
func NewJSSourceDuplicateDetectedError(opts ...ErrorOption) *ApiError {
×
1976
        eopts := parseOpts(opts)
×
1977
        if ae, ok := eopts.err.(*ApiError); ok {
×
1978
                return ae
×
1979
        }
×
1980

1981
        return ApiErrors[JSSourceDuplicateDetected]
×
1982
}
1983

1984
// NewJSSourceInvalidStreamNameError creates a new JSSourceInvalidStreamName error: "sourced stream name is invalid"
1985
func NewJSSourceInvalidStreamNameError(opts ...ErrorOption) *ApiError {
1✔
1986
        eopts := parseOpts(opts)
1✔
1987
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1988
                return ae
×
1989
        }
×
1990

1991
        return ApiErrors[JSSourceInvalidStreamName]
1✔
1992
}
1993

1994
// NewJSSourceInvalidSubjectFilterError creates a new JSSourceInvalidSubjectFilter error: "source transform source: {err}"
1995
func NewJSSourceInvalidSubjectFilterError(err error, opts ...ErrorOption) *ApiError {
1✔
1996
        eopts := parseOpts(opts)
1✔
1997
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1998
                return ae
×
1999
        }
×
2000

2001
        e := ApiErrors[JSSourceInvalidSubjectFilter]
1✔
2002
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2003
        return &ApiError{
1✔
2004
                Code:        e.Code,
1✔
2005
                ErrCode:     e.ErrCode,
1✔
2006
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2007
        }
1✔
2008
}
2009

2010
// NewJSSourceInvalidTransformDestinationError creates a new JSSourceInvalidTransformDestination error: "source transform: {err}"
2011
func NewJSSourceInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
2012
        eopts := parseOpts(opts)
1✔
2013
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2014
                return ae
×
2015
        }
×
2016

2017
        e := ApiErrors[JSSourceInvalidTransformDestination]
1✔
2018
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2019
        return &ApiError{
1✔
2020
                Code:        e.Code,
1✔
2021
                ErrCode:     e.ErrCode,
1✔
2022
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2023
        }
1✔
2024
}
2025

2026
// NewJSSourceMaxMessageSizeTooBigError creates a new JSSourceMaxMessageSizeTooBigErr error: "stream source must have max message size >= target"
2027
func NewJSSourceMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
2028
        eopts := parseOpts(opts)
×
2029
        if ae, ok := eopts.err.(*ApiError); ok {
×
2030
                return ae
×
2031
        }
×
2032

2033
        return ApiErrors[JSSourceMaxMessageSizeTooBigErr]
×
2034
}
2035

2036
// NewJSSourceMultipleFiltersNotAllowedError creates a new JSSourceMultipleFiltersNotAllowed error: "source with multiple subject transforms cannot also have a single subject filter"
2037
func NewJSSourceMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
×
2038
        eopts := parseOpts(opts)
×
2039
        if ae, ok := eopts.err.(*ApiError); ok {
×
2040
                return ae
×
2041
        }
×
2042

2043
        return ApiErrors[JSSourceMultipleFiltersNotAllowed]
×
2044
}
2045

2046
// NewJSSourceOverlappingSubjectFiltersError creates a new JSSourceOverlappingSubjectFilters error: "source filters can not overlap"
2047
func NewJSSourceOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
2048
        eopts := parseOpts(opts)
×
2049
        if ae, ok := eopts.err.(*ApiError); ok {
×
2050
                return ae
×
2051
        }
×
2052

2053
        return ApiErrors[JSSourceOverlappingSubjectFilters]
×
2054
}
2055

2056
// NewJSStorageResourcesExceededError creates a new JSStorageResourcesExceededErr error: "insufficient storage resources available"
2057
func NewJSStorageResourcesExceededError(opts ...ErrorOption) *ApiError {
28✔
2058
        eopts := parseOpts(opts)
28✔
2059
        if ae, ok := eopts.err.(*ApiError); ok {
28✔
2060
                return ae
×
2061
        }
×
2062

2063
        return ApiErrors[JSStorageResourcesExceededErr]
28✔
2064
}
2065

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

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

2082
// NewJSStreamCreateError creates a new JSStreamCreateErrF error: "{err}"
2083
func NewJSStreamCreateError(err error, opts ...ErrorOption) *ApiError {
86✔
2084
        eopts := parseOpts(opts)
86✔
2085
        if ae, ok := eopts.err.(*ApiError); ok {
168✔
2086
                return ae
82✔
2087
        }
82✔
2088

2089
        e := ApiErrors[JSStreamCreateErrF]
4✔
2090
        args := e.toReplacerArgs([]interface{}{"{err}", err})
4✔
2091
        return &ApiError{
4✔
2092
                Code:        e.Code,
4✔
2093
                ErrCode:     e.ErrCode,
4✔
2094
                Description: strings.NewReplacer(args...).Replace(e.Description),
4✔
2095
        }
4✔
2096
}
2097

2098
// NewJSStreamDeleteError creates a new JSStreamDeleteErrF error: "{err}"
2099
func NewJSStreamDeleteError(err error, opts ...ErrorOption) *ApiError {
×
2100
        eopts := parseOpts(opts)
×
2101
        if ae, ok := eopts.err.(*ApiError); ok {
×
2102
                return ae
×
2103
        }
×
2104

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

2114
// NewJSStreamDuplicateMessageConflictError creates a new JSStreamDuplicateMessageConflict error: "duplicate message id is in process"
2115
func NewJSStreamDuplicateMessageConflictError(opts ...ErrorOption) *ApiError {
1✔
2116
        eopts := parseOpts(opts)
1✔
2117
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2118
                return ae
×
2119
        }
×
2120

2121
        return ApiErrors[JSStreamDuplicateMessageConflict]
1✔
2122
}
2123

2124
// NewJSStreamExpectedLastSeqPerSubjectNotReadyError creates a new JSStreamExpectedLastSeqPerSubjectNotReady error: "expected last sequence per subject temporarily unavailable"
2125
func NewJSStreamExpectedLastSeqPerSubjectNotReadyError(opts ...ErrorOption) *ApiError {
×
2126
        eopts := parseOpts(opts)
×
2127
        if ae, ok := eopts.err.(*ApiError); ok {
×
2128
                return ae
×
2129
        }
×
2130

2131
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectNotReady]
×
2132
}
2133

2134
// NewJSStreamExternalApiOverlapError creates a new JSStreamExternalApiOverlapErrF error: "stream external api prefix {prefix} must not overlap with {subject}"
2135
func NewJSStreamExternalApiOverlapError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
2✔
2136
        eopts := parseOpts(opts)
2✔
2137
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2138
                return ae
×
2139
        }
×
2140

2141
        e := ApiErrors[JSStreamExternalApiOverlapErrF]
2✔
2142
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
2✔
2143
        return &ApiError{
2✔
2144
                Code:        e.Code,
2✔
2145
                ErrCode:     e.ErrCode,
2✔
2146
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2147
        }
2✔
2148
}
2149

2150
// NewJSStreamExternalDelPrefixOverlapsError creates a new JSStreamExternalDelPrefixOverlapsErrF error: "stream external delivery prefix {prefix} overlaps with stream subject {subject}"
2151
func NewJSStreamExternalDelPrefixOverlapsError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
×
2152
        eopts := parseOpts(opts)
×
2153
        if ae, ok := eopts.err.(*ApiError); ok {
×
2154
                return ae
×
2155
        }
×
2156

2157
        e := ApiErrors[JSStreamExternalDelPrefixOverlapsErrF]
×
2158
        args := e.toReplacerArgs([]interface{}{"{prefix}", prefix, "{subject}", subject})
×
2159
        return &ApiError{
×
2160
                Code:        e.Code,
×
2161
                ErrCode:     e.ErrCode,
×
2162
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2163
        }
×
2164
}
2165

2166
// NewJSStreamGeneralError creates a new JSStreamGeneralErrorF error: "{err}"
2167
func NewJSStreamGeneralError(err error, opts ...ErrorOption) *ApiError {
3✔
2168
        eopts := parseOpts(opts)
3✔
2169
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2170
                return ae
×
2171
        }
×
2172

2173
        e := ApiErrors[JSStreamGeneralErrorF]
3✔
2174
        args := e.toReplacerArgs([]interface{}{"{err}", err})
3✔
2175
        return &ApiError{
3✔
2176
                Code:        e.Code,
3✔
2177
                ErrCode:     e.ErrCode,
3✔
2178
                Description: strings.NewReplacer(args...).Replace(e.Description),
3✔
2179
        }
3✔
2180
}
2181

2182
// NewJSStreamHeaderExceedsMaximumError creates a new JSStreamHeaderExceedsMaximumErr error: "header size exceeds maximum allowed of 64k"
2183
func NewJSStreamHeaderExceedsMaximumError(opts ...ErrorOption) *ApiError {
1✔
2184
        eopts := parseOpts(opts)
1✔
2185
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2186
                return ae
×
2187
        }
×
2188

2189
        return ApiErrors[JSStreamHeaderExceedsMaximumErr]
1✔
2190
}
2191

2192
// NewJSStreamInfoMaxSubjectsError creates a new JSStreamInfoMaxSubjectsErr error: "subject details would exceed maximum allowed"
2193
func NewJSStreamInfoMaxSubjectsError(opts ...ErrorOption) *ApiError {
×
2194
        eopts := parseOpts(opts)
×
2195
        if ae, ok := eopts.err.(*ApiError); ok {
×
2196
                return ae
×
2197
        }
×
2198

2199
        return ApiErrors[JSStreamInfoMaxSubjectsErr]
×
2200
}
2201

2202
// NewJSStreamInvalidConfigError creates a new JSStreamInvalidConfigF error: "{err}"
2203
func NewJSStreamInvalidConfigError(err error, opts ...ErrorOption) *ApiError {
139✔
2204
        eopts := parseOpts(opts)
139✔
2205
        if ae, ok := eopts.err.(*ApiError); ok {
162✔
2206
                return ae
23✔
2207
        }
23✔
2208

2209
        e := ApiErrors[JSStreamInvalidConfigF]
116✔
2210
        args := e.toReplacerArgs([]interface{}{"{err}", err})
116✔
2211
        return &ApiError{
116✔
2212
                Code:        e.Code,
116✔
2213
                ErrCode:     e.ErrCode,
116✔
2214
                Description: strings.NewReplacer(args...).Replace(e.Description),
116✔
2215
        }
116✔
2216
}
2217

2218
// NewJSStreamInvalidError creates a new JSStreamInvalidErr error: "stream not valid"
2219
func NewJSStreamInvalidError(opts ...ErrorOption) *ApiError {
×
2220
        eopts := parseOpts(opts)
×
2221
        if ae, ok := eopts.err.(*ApiError); ok {
×
2222
                return ae
×
2223
        }
×
2224

2225
        return ApiErrors[JSStreamInvalidErr]
×
2226
}
2227

2228
// NewJSStreamInvalidExternalDeliverySubjError creates a new JSStreamInvalidExternalDeliverySubjErrF error: "stream external delivery prefix {prefix} must not contain wildcards"
2229
func NewJSStreamInvalidExternalDeliverySubjError(prefix interface{}, opts ...ErrorOption) *ApiError {
×
2230
        eopts := parseOpts(opts)
×
2231
        if ae, ok := eopts.err.(*ApiError); ok {
×
2232
                return ae
×
2233
        }
×
2234

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

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

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

2260
// NewJSStreamMaxBytesRequiredError creates a new JSStreamMaxBytesRequired error: "account requires a stream config to have max bytes set"
2261
func NewJSStreamMaxBytesRequiredError(opts ...ErrorOption) *ApiError {
3✔
2262
        eopts := parseOpts(opts)
3✔
2263
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2264
                return ae
×
2265
        }
×
2266

2267
        return ApiErrors[JSStreamMaxBytesRequired]
3✔
2268
}
2269

2270
// NewJSStreamMaxStreamBytesExceededError creates a new JSStreamMaxStreamBytesExceeded error: "stream max bytes exceeds account limit max stream bytes"
2271
func NewJSStreamMaxStreamBytesExceededError(opts ...ErrorOption) *ApiError {
2✔
2272
        eopts := parseOpts(opts)
2✔
2273
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2274
                return ae
×
2275
        }
×
2276

2277
        return ApiErrors[JSStreamMaxStreamBytesExceeded]
2✔
2278
}
2279

2280
// NewJSStreamMessageExceedsMaximumError creates a new JSStreamMessageExceedsMaximumErr error: "message size exceeds maximum allowed"
2281
func NewJSStreamMessageExceedsMaximumError(opts ...ErrorOption) *ApiError {
15✔
2282
        eopts := parseOpts(opts)
15✔
2283
        if ae, ok := eopts.err.(*ApiError); ok {
15✔
2284
                return ae
×
2285
        }
×
2286

2287
        return ApiErrors[JSStreamMessageExceedsMaximumErr]
15✔
2288
}
2289

2290
// NewJSStreamMirrorNotUpdatableError creates a new JSStreamMirrorNotUpdatableErr error: "stream mirror configuration can not be updated"
2291
func NewJSStreamMirrorNotUpdatableError(opts ...ErrorOption) *ApiError {
4✔
2292
        eopts := parseOpts(opts)
4✔
2293
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2294
                return ae
×
2295
        }
×
2296

2297
        return ApiErrors[JSStreamMirrorNotUpdatableErr]
4✔
2298
}
2299

2300
// NewJSStreamMismatchError creates a new JSStreamMismatchErr error: "stream name in subject does not match request"
2301
func NewJSStreamMismatchError(opts ...ErrorOption) *ApiError {
3✔
2302
        eopts := parseOpts(opts)
3✔
2303
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2304
                return ae
×
2305
        }
×
2306

2307
        return ApiErrors[JSStreamMismatchErr]
3✔
2308
}
2309

2310
// NewJSStreamMoveAndScaleError creates a new JSStreamMoveAndScaleErr error: "can not move and scale a stream in a single update"
2311
func NewJSStreamMoveAndScaleError(opts ...ErrorOption) *ApiError {
4✔
2312
        eopts := parseOpts(opts)
4✔
2313
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2314
                return ae
×
2315
        }
×
2316

2317
        return ApiErrors[JSStreamMoveAndScaleErr]
4✔
2318
}
2319

2320
// NewJSStreamMoveInProgressError creates a new JSStreamMoveInProgressF error: "stream move already in progress: {msg}"
2321
func NewJSStreamMoveInProgressError(msg interface{}, opts ...ErrorOption) *ApiError {
2✔
2322
        eopts := parseOpts(opts)
2✔
2323
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2324
                return ae
×
2325
        }
×
2326

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

2336
// NewJSStreamMoveNotInProgressError creates a new JSStreamMoveNotInProgress error: "stream move not in progress"
2337
func NewJSStreamMoveNotInProgressError(opts ...ErrorOption) *ApiError {
×
2338
        eopts := parseOpts(opts)
×
2339
        if ae, ok := eopts.err.(*ApiError); ok {
×
2340
                return ae
×
2341
        }
×
2342

2343
        return ApiErrors[JSStreamMoveNotInProgress]
×
2344
}
2345

2346
// NewJSStreamMsgDeleteFailedError creates a new JSStreamMsgDeleteFailedF error: "{err}"
2347
func NewJSStreamMsgDeleteFailedError(err error, opts ...ErrorOption) *ApiError {
1✔
2348
        eopts := parseOpts(opts)
1✔
2349
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2350
                return ae
×
2351
        }
×
2352

2353
        e := ApiErrors[JSStreamMsgDeleteFailedF]
1✔
2354
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2355
        return &ApiError{
1✔
2356
                Code:        e.Code,
1✔
2357
                ErrCode:     e.ErrCode,
1✔
2358
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2359
        }
1✔
2360
}
2361

2362
// NewJSStreamNameContainsPathSeparatorsError creates a new JSStreamNameContainsPathSeparatorsErr error: "Stream name can not contain path separators"
2363
func NewJSStreamNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
6✔
2364
        eopts := parseOpts(opts)
6✔
2365
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2366
                return ae
×
2367
        }
×
2368

2369
        return ApiErrors[JSStreamNameContainsPathSeparatorsErr]
6✔
2370
}
2371

2372
// NewJSStreamNameExistError creates a new JSStreamNameExistErr error: "stream name already in use with a different configuration"
2373
func NewJSStreamNameExistError(opts ...ErrorOption) *ApiError {
×
2374
        eopts := parseOpts(opts)
×
2375
        if ae, ok := eopts.err.(*ApiError); ok {
×
2376
                return ae
×
2377
        }
×
2378

2379
        return ApiErrors[JSStreamNameExistErr]
×
2380
}
2381

2382
// NewJSStreamNameExistRestoreFailedError creates a new JSStreamNameExistRestoreFailedErr error: "stream name already in use, cannot restore"
2383
func NewJSStreamNameExistRestoreFailedError(opts ...ErrorOption) *ApiError {
3✔
2384
        eopts := parseOpts(opts)
3✔
2385
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2386
                return ae
×
2387
        }
×
2388

2389
        return ApiErrors[JSStreamNameExistRestoreFailedErr]
3✔
2390
}
2391

2392
// NewJSStreamNotFoundError creates a new JSStreamNotFoundErr error: "stream not found"
2393
func NewJSStreamNotFoundError(opts ...ErrorOption) *ApiError {
23,954✔
2394
        eopts := parseOpts(opts)
23,954✔
2395
        if ae, ok := eopts.err.(*ApiError); ok {
24,626✔
2396
                return ae
672✔
2397
        }
672✔
2398

2399
        return ApiErrors[JSStreamNotFoundErr]
23,282✔
2400
}
2401

2402
// NewJSStreamNotMatchError creates a new JSStreamNotMatchErr error: "expected stream does not match"
2403
func NewJSStreamNotMatchError(opts ...ErrorOption) *ApiError {
5✔
2404
        eopts := parseOpts(opts)
5✔
2405
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2406
                return ae
×
2407
        }
×
2408

2409
        return ApiErrors[JSStreamNotMatchErr]
5✔
2410
}
2411

2412
// NewJSStreamOfflineError creates a new JSStreamOfflineErr error: "stream is offline"
2413
func NewJSStreamOfflineError(opts ...ErrorOption) *ApiError {
6✔
2414
        eopts := parseOpts(opts)
6✔
2415
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2416
                return ae
×
2417
        }
×
2418

2419
        return ApiErrors[JSStreamOfflineErr]
6✔
2420
}
2421

2422
// NewJSStreamPurgeFailedError creates a new JSStreamPurgeFailedF error: "{err}"
2423
func NewJSStreamPurgeFailedError(err error, opts ...ErrorOption) *ApiError {
1✔
2424
        eopts := parseOpts(opts)
1✔
2425
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2426
                return ae
×
2427
        }
×
2428

2429
        e := ApiErrors[JSStreamPurgeFailedF]
1✔
2430
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2431
        return &ApiError{
1✔
2432
                Code:        e.Code,
1✔
2433
                ErrCode:     e.ErrCode,
1✔
2434
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2435
        }
1✔
2436
}
2437

2438
// NewJSStreamReplicasNotSupportedError creates a new JSStreamReplicasNotSupportedErr error: "replicas > 1 not supported in non-clustered mode"
2439
func NewJSStreamReplicasNotSupportedError(opts ...ErrorOption) *ApiError {
1✔
2440
        eopts := parseOpts(opts)
1✔
2441
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2442
                return ae
×
2443
        }
×
2444

2445
        return ApiErrors[JSStreamReplicasNotSupportedErr]
1✔
2446
}
2447

2448
// NewJSStreamReplicasNotUpdatableError creates a new JSStreamReplicasNotUpdatableErr error: "Replicas configuration can not be updated"
2449
func NewJSStreamReplicasNotUpdatableError(opts ...ErrorOption) *ApiError {
×
2450
        eopts := parseOpts(opts)
×
2451
        if ae, ok := eopts.err.(*ApiError); ok {
×
2452
                return ae
×
2453
        }
×
2454

2455
        return ApiErrors[JSStreamReplicasNotUpdatableErr]
×
2456
}
2457

2458
// NewJSStreamRestoreError creates a new JSStreamRestoreErrF error: "restore failed: {err}"
2459
func NewJSStreamRestoreError(err error, opts ...ErrorOption) *ApiError {
7✔
2460
        eopts := parseOpts(opts)
7✔
2461
        if ae, ok := eopts.err.(*ApiError); ok {
9✔
2462
                return ae
2✔
2463
        }
2✔
2464

2465
        e := ApiErrors[JSStreamRestoreErrF]
5✔
2466
        args := e.toReplacerArgs([]interface{}{"{err}", err})
5✔
2467
        return &ApiError{
5✔
2468
                Code:        e.Code,
5✔
2469
                ErrCode:     e.ErrCode,
5✔
2470
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
2471
        }
5✔
2472
}
2473

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

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

2490
// NewJSStreamSealedError creates a new JSStreamSealedErr error: "invalid operation on sealed stream"
2491
func NewJSStreamSealedError(opts ...ErrorOption) *ApiError {
10✔
2492
        eopts := parseOpts(opts)
10✔
2493
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2494
                return ae
×
2495
        }
×
2496

2497
        return ApiErrors[JSStreamSealedErr]
10✔
2498
}
2499

2500
// NewJSStreamSequenceNotMatchError creates a new JSStreamSequenceNotMatchErr error: "expected stream sequence does not match"
2501
func NewJSStreamSequenceNotMatchError(opts ...ErrorOption) *ApiError {
×
2502
        eopts := parseOpts(opts)
×
2503
        if ae, ok := eopts.err.(*ApiError); ok {
×
2504
                return ae
×
2505
        }
×
2506

2507
        return ApiErrors[JSStreamSequenceNotMatchErr]
×
2508
}
2509

2510
// NewJSStreamSnapshotError creates a new JSStreamSnapshotErrF error: "snapshot failed: {err}"
2511
func NewJSStreamSnapshotError(err error, opts ...ErrorOption) *ApiError {
×
2512
        eopts := parseOpts(opts)
×
2513
        if ae, ok := eopts.err.(*ApiError); ok {
×
2514
                return ae
×
2515
        }
×
2516

2517
        e := ApiErrors[JSStreamSnapshotErrF]
×
2518
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2519
        return &ApiError{
×
2520
                Code:        e.Code,
×
2521
                ErrCode:     e.ErrCode,
×
2522
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2523
        }
×
2524
}
2525

2526
// NewJSStreamStoreFailedError creates a new JSStreamStoreFailedF error: "{err}"
2527
func NewJSStreamStoreFailedError(err error, opts ...ErrorOption) *ApiError {
1,990✔
2528
        eopts := parseOpts(opts)
1,990✔
2529
        if ae, ok := eopts.err.(*ApiError); ok {
1,990✔
2530
                return ae
×
2531
        }
×
2532

2533
        e := ApiErrors[JSStreamStoreFailedF]
1,990✔
2534
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1,990✔
2535
        return &ApiError{
1,990✔
2536
                Code:        e.Code,
1,990✔
2537
                ErrCode:     e.ErrCode,
1,990✔
2538
                Description: strings.NewReplacer(args...).Replace(e.Description),
1,990✔
2539
        }
1,990✔
2540
}
2541

2542
// NewJSStreamSubjectOverlapError creates a new JSStreamSubjectOverlapErr error: "subjects overlap with an existing stream"
2543
func NewJSStreamSubjectOverlapError(opts ...ErrorOption) *ApiError {
39✔
2544
        eopts := parseOpts(opts)
39✔
2545
        if ae, ok := eopts.err.(*ApiError); ok {
39✔
2546
                return ae
×
2547
        }
×
2548

2549
        return ApiErrors[JSStreamSubjectOverlapErr]
39✔
2550
}
2551

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

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

2568
// NewJSStreamTemplateDeleteError creates a new JSStreamTemplateDeleteErrF error: "{err}"
2569
func NewJSStreamTemplateDeleteError(err error, opts ...ErrorOption) *ApiError {
1✔
2570
        eopts := parseOpts(opts)
1✔
2571
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2572
                return ae
1✔
2573
        }
1✔
2574

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

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

2591
        return ApiErrors[JSStreamTemplateNotFoundErr]
4✔
2592
}
2593

2594
// NewJSStreamTooManyRequestsError creates a new JSStreamTooManyRequests error: "too many requests"
2595
func NewJSStreamTooManyRequestsError(opts ...ErrorOption) *ApiError {
194✔
2596
        eopts := parseOpts(opts)
194✔
2597
        if ae, ok := eopts.err.(*ApiError); ok {
194✔
2598
                return ae
×
2599
        }
×
2600

2601
        return ApiErrors[JSStreamTooManyRequests]
194✔
2602
}
2603

2604
// NewJSStreamTransformInvalidDestinationError creates a new JSStreamTransformInvalidDestination error: "stream transform: {err}"
2605
func NewJSStreamTransformInvalidDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
2606
        eopts := parseOpts(opts)
1✔
2607
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2608
                return ae
×
2609
        }
×
2610

2611
        e := ApiErrors[JSStreamTransformInvalidDestination]
1✔
2612
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2613
        return &ApiError{
1✔
2614
                Code:        e.Code,
1✔
2615
                ErrCode:     e.ErrCode,
1✔
2616
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2617
        }
1✔
2618
}
2619

2620
// NewJSStreamTransformInvalidSourceError creates a new JSStreamTransformInvalidSource error: "stream transform source: {err}"
2621
func NewJSStreamTransformInvalidSourceError(err error, opts ...ErrorOption) *ApiError {
1✔
2622
        eopts := parseOpts(opts)
1✔
2623
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2624
                return ae
×
2625
        }
×
2626

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

2636
// NewJSStreamUpdateError creates a new JSStreamUpdateErrF error: "{err}"
2637
func NewJSStreamUpdateError(err error, opts ...ErrorOption) *ApiError {
23✔
2638
        eopts := parseOpts(opts)
23✔
2639
        if ae, ok := eopts.err.(*ApiError); ok {
40✔
2640
                return ae
17✔
2641
        }
17✔
2642

2643
        e := ApiErrors[JSStreamUpdateErrF]
6✔
2644
        args := e.toReplacerArgs([]interface{}{"{err}", err})
6✔
2645
        return &ApiError{
6✔
2646
                Code:        e.Code,
6✔
2647
                ErrCode:     e.ErrCode,
6✔
2648
                Description: strings.NewReplacer(args...).Replace(e.Description),
6✔
2649
        }
6✔
2650
}
2651

2652
// NewJSStreamWrongLastMsgIDError creates a new JSStreamWrongLastMsgIDErrF error: "wrong last msg ID: {id}"
2653
func NewJSStreamWrongLastMsgIDError(id interface{}, opts ...ErrorOption) *ApiError {
5✔
2654
        eopts := parseOpts(opts)
5✔
2655
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2656
                return ae
×
2657
        }
×
2658

2659
        e := ApiErrors[JSStreamWrongLastMsgIDErrF]
5✔
2660
        args := e.toReplacerArgs([]interface{}{"{id}", id})
5✔
2661
        return &ApiError{
5✔
2662
                Code:        e.Code,
5✔
2663
                ErrCode:     e.ErrCode,
5✔
2664
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
2665
        }
5✔
2666
}
2667

2668
// NewJSStreamWrongLastSequenceConstantError creates a new JSStreamWrongLastSequenceConstantErr error: "wrong last sequence"
2669
func NewJSStreamWrongLastSequenceConstantError(opts ...ErrorOption) *ApiError {
11✔
2670
        eopts := parseOpts(opts)
11✔
2671
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
2672
                return ae
×
2673
        }
×
2674

2675
        return ApiErrors[JSStreamWrongLastSequenceConstantErr]
11✔
2676
}
2677

2678
// NewJSStreamWrongLastSequenceError creates a new JSStreamWrongLastSequenceErrF error: "wrong last sequence: {seq}"
2679
func NewJSStreamWrongLastSequenceError(seq uint64, opts ...ErrorOption) *ApiError {
57✔
2680
        eopts := parseOpts(opts)
57✔
2681
        if ae, ok := eopts.err.(*ApiError); ok {
57✔
2682
                return ae
×
2683
        }
×
2684

2685
        e := ApiErrors[JSStreamWrongLastSequenceErrF]
57✔
2686
        args := e.toReplacerArgs([]interface{}{"{seq}", seq})
57✔
2687
        return &ApiError{
57✔
2688
                Code:        e.Code,
57✔
2689
                ErrCode:     e.ErrCode,
57✔
2690
                Description: strings.NewReplacer(args...).Replace(e.Description),
57✔
2691
        }
57✔
2692
}
2693

2694
// NewJSTempStorageFailedError creates a new JSTempStorageFailedErr error: "JetStream unable to open temp storage for restore"
2695
func NewJSTempStorageFailedError(opts ...ErrorOption) *ApiError {
×
2696
        eopts := parseOpts(opts)
×
2697
        if ae, ok := eopts.err.(*ApiError); ok {
×
2698
                return ae
×
2699
        }
×
2700

2701
        return ApiErrors[JSTempStorageFailedErr]
×
2702
}
2703

2704
// NewJSTemplateNameNotMatchSubjectError creates a new JSTemplateNameNotMatchSubjectErr error: "template name in subject does not match request"
2705
func NewJSTemplateNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
1✔
2706
        eopts := parseOpts(opts)
1✔
2707
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2708
                return ae
×
2709
        }
×
2710

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