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

nats-io / nats-server / 13212408133

07 Feb 2025 08:20PM UTC coverage: 85.476% (-0.05%) from 85.529%
13212408133

push

github

web-flow
Purge requests with no subject delete markers (#6470)

As per [the
ADR](https://github.com/nats-io/nats-architecture-and-design/blob/main/adr/ADR-43.md#purge-api-call-marker),
this adds the `no_markers` flag to the JS API stream purge request, such
that a stream can be purged without leaving behind any subject delete
markers, if they are enabled.

This helps to avoid the "poison pill" problem if there are subjects for
example that are causing problems with a consuming application.

Individual message deletes are less of a concern here because a single
message delete will leave behind at most one marker, which can be
deleted too (and would not be replaced in that case), but a purge can
potentially leave behind lots of markers for lots of subjects, which
could be difficult to sort through by hand otherwise.

Signed-off-by: Neil Twigg <neil@nats.io>

69073 of 80810 relevant lines covered (85.48%)

716990.21 hits per line

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

52.69
/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
        // JSMessageTTLDisabledErr per-message TTL is disabled
246
        JSMessageTTLDisabledErr ErrorIdentifier = 10166
247

248
        // JSMessageTTLInvalidErr invalid per-message TTL
249
        JSMessageTTLInvalidErr ErrorIdentifier = 10165
250

251
        // JSMirrorConsumerSetupFailedErrF generic mirror consumer setup failure string ({err})
252
        JSMirrorConsumerSetupFailedErrF ErrorIdentifier = 10029
253

254
        // JSMirrorInvalidStreamName mirrored stream name is invalid
255
        JSMirrorInvalidStreamName ErrorIdentifier = 10142
256

257
        // JSMirrorInvalidSubjectFilter mirror transform source: {err}
258
        JSMirrorInvalidSubjectFilter ErrorIdentifier = 10151
259

260
        // JSMirrorInvalidTransformDestination mirror transform: {err}
261
        JSMirrorInvalidTransformDestination ErrorIdentifier = 10154
262

263
        // JSMirrorMaxMessageSizeTooBigErr stream mirror must have max message size >= source
264
        JSMirrorMaxMessageSizeTooBigErr ErrorIdentifier = 10030
265

266
        // JSMirrorMultipleFiltersNotAllowed mirror with multiple subject transforms cannot also have a single subject filter
267
        JSMirrorMultipleFiltersNotAllowed ErrorIdentifier = 10150
268

269
        // JSMirrorOverlappingSubjectFilters mirror subject filters can not overlap
270
        JSMirrorOverlappingSubjectFilters ErrorIdentifier = 10152
271

272
        // JSMirrorWithFirstSeqErr stream mirrors can not have first sequence configured
273
        JSMirrorWithFirstSeqErr ErrorIdentifier = 10143
274

275
        // JSMirrorWithSourcesErr stream mirrors can not also contain other sources
276
        JSMirrorWithSourcesErr ErrorIdentifier = 10031
277

278
        // JSMirrorWithStartSeqAndTimeErr stream mirrors can not have both start seq and start time configured
279
        JSMirrorWithStartSeqAndTimeErr ErrorIdentifier = 10032
280

281
        // JSMirrorWithSubjectFiltersErr stream mirrors can not contain filtered subjects
282
        JSMirrorWithSubjectFiltersErr ErrorIdentifier = 10033
283

284
        // JSMirrorWithSubjectsErr stream mirrors can not contain subjects
285
        JSMirrorWithSubjectsErr ErrorIdentifier = 10034
286

287
        // JSNoAccountErr account not found
288
        JSNoAccountErr ErrorIdentifier = 10035
289

290
        // JSNoLimitsErr no JetStream default or applicable tiered limit present
291
        JSNoLimitsErr ErrorIdentifier = 10120
292

293
        // JSNoMessageFoundErr no message found
294
        JSNoMessageFoundErr ErrorIdentifier = 10037
295

296
        // JSNotEmptyRequestErr expected an empty request payload
297
        JSNotEmptyRequestErr ErrorIdentifier = 10038
298

299
        // JSNotEnabledErr JetStream not enabled
300
        JSNotEnabledErr ErrorIdentifier = 10076
301

302
        // JSNotEnabledForAccountErr JetStream not enabled for account
303
        JSNotEnabledForAccountErr ErrorIdentifier = 10039
304

305
        // JSPedanticErrF pedantic mode: {err}
306
        JSPedanticErrF ErrorIdentifier = 10157
307

308
        // JSPeerRemapErr peer remap failed
309
        JSPeerRemapErr ErrorIdentifier = 10075
310

311
        // JSRaftGeneralErrF General RAFT error string ({err})
312
        JSRaftGeneralErrF ErrorIdentifier = 10041
313

314
        // JSReplicasCountCannotBeNegative replicas count cannot be negative
315
        JSReplicasCountCannotBeNegative ErrorIdentifier = 10133
316

317
        // JSRestoreSubscribeFailedErrF JetStream unable to subscribe to restore snapshot {subject}: {err}
318
        JSRestoreSubscribeFailedErrF ErrorIdentifier = 10042
319

320
        // JSSequenceNotFoundErrF sequence {seq} not found
321
        JSSequenceNotFoundErrF ErrorIdentifier = 10043
322

323
        // JSSnapshotDeliverSubjectInvalidErr deliver subject not valid
324
        JSSnapshotDeliverSubjectInvalidErr ErrorIdentifier = 10015
325

326
        // JSSourceConsumerSetupFailedErrF General source consumer setup failure string ({err})
327
        JSSourceConsumerSetupFailedErrF ErrorIdentifier = 10045
328

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

332
        // JSSourceInvalidStreamName sourced stream name is invalid
333
        JSSourceInvalidStreamName ErrorIdentifier = 10141
334

335
        // JSSourceInvalidSubjectFilter source transform source: {err}
336
        JSSourceInvalidSubjectFilter ErrorIdentifier = 10145
337

338
        // JSSourceInvalidTransformDestination source transform: {err}
339
        JSSourceInvalidTransformDestination ErrorIdentifier = 10146
340

341
        // JSSourceMaxMessageSizeTooBigErr stream source must have max message size >= target
342
        JSSourceMaxMessageSizeTooBigErr ErrorIdentifier = 10046
343

344
        // JSSourceMultipleFiltersNotAllowed source with multiple subject transforms cannot also have a single subject filter
345
        JSSourceMultipleFiltersNotAllowed ErrorIdentifier = 10144
346

347
        // JSSourceOverlappingSubjectFilters source filters can not overlap
348
        JSSourceOverlappingSubjectFilters ErrorIdentifier = 10147
349

350
        // JSStorageResourcesExceededErr insufficient storage resources available
351
        JSStorageResourcesExceededErr ErrorIdentifier = 10047
352

353
        // JSStreamAssignmentErrF Generic stream assignment error string ({err})
354
        JSStreamAssignmentErrF ErrorIdentifier = 10048
355

356
        // JSStreamCreateErrF Generic stream creation error string ({err})
357
        JSStreamCreateErrF ErrorIdentifier = 10049
358

359
        // JSStreamDeleteErrF General stream deletion error string ({err})
360
        JSStreamDeleteErrF ErrorIdentifier = 10050
361

362
        // JSStreamDuplicateMessageConflict duplicate message id is in process
363
        JSStreamDuplicateMessageConflict ErrorIdentifier = 10158
364

365
        // JSStreamExpectedLastSeqPerSubjectNotReady expected last sequence per subject temporarily unavailable
366
        JSStreamExpectedLastSeqPerSubjectNotReady ErrorIdentifier = 10163
367

368
        // JSStreamExternalApiOverlapErrF stream external api prefix {prefix} must not overlap with {subject}
369
        JSStreamExternalApiOverlapErrF ErrorIdentifier = 10021
370

371
        // JSStreamExternalDelPrefixOverlapsErrF stream external delivery prefix {prefix} overlaps with stream subject {subject}
372
        JSStreamExternalDelPrefixOverlapsErrF ErrorIdentifier = 10022
373

374
        // JSStreamGeneralErrorF General stream failure string ({err})
375
        JSStreamGeneralErrorF ErrorIdentifier = 10051
376

377
        // JSStreamHeaderExceedsMaximumErr header size exceeds maximum allowed of 64k
378
        JSStreamHeaderExceedsMaximumErr ErrorIdentifier = 10097
379

380
        // JSStreamInfoMaxSubjectsErr subject details would exceed maximum allowed
381
        JSStreamInfoMaxSubjectsErr ErrorIdentifier = 10117
382

383
        // JSStreamInvalidConfigF Stream configuration validation error string ({err})
384
        JSStreamInvalidConfigF ErrorIdentifier = 10052
385

386
        // JSStreamInvalidErr stream not valid
387
        JSStreamInvalidErr ErrorIdentifier = 10096
388

389
        // JSStreamInvalidExternalDeliverySubjErrF stream external delivery prefix {prefix} must not contain wildcards
390
        JSStreamInvalidExternalDeliverySubjErrF ErrorIdentifier = 10024
391

392
        // JSStreamLimitsErrF General stream limits exceeded error string ({err})
393
        JSStreamLimitsErrF ErrorIdentifier = 10053
394

395
        // JSStreamMaxBytesRequired account requires a stream config to have max bytes set
396
        JSStreamMaxBytesRequired ErrorIdentifier = 10113
397

398
        // JSStreamMaxStreamBytesExceeded stream max bytes exceeds account limit max stream bytes
399
        JSStreamMaxStreamBytesExceeded ErrorIdentifier = 10122
400

401
        // JSStreamMessageExceedsMaximumErr message size exceeds maximum allowed
402
        JSStreamMessageExceedsMaximumErr ErrorIdentifier = 10054
403

404
        // JSStreamMirrorNotUpdatableErr stream mirror configuration can not be updated
405
        JSStreamMirrorNotUpdatableErr ErrorIdentifier = 10055
406

407
        // JSStreamMismatchErr stream name in subject does not match request
408
        JSStreamMismatchErr ErrorIdentifier = 10056
409

410
        // JSStreamMoveAndScaleErr can not move and scale a stream in a single update
411
        JSStreamMoveAndScaleErr ErrorIdentifier = 10123
412

413
        // JSStreamMoveInProgressF stream move already in progress: {msg}
414
        JSStreamMoveInProgressF ErrorIdentifier = 10124
415

416
        // JSStreamMoveNotInProgress stream move not in progress
417
        JSStreamMoveNotInProgress ErrorIdentifier = 10129
418

419
        // JSStreamMsgDeleteFailedF Generic message deletion failure error string ({err})
420
        JSStreamMsgDeleteFailedF ErrorIdentifier = 10057
421

422
        // JSStreamNameContainsPathSeparatorsErr Stream name can not contain path separators
423
        JSStreamNameContainsPathSeparatorsErr ErrorIdentifier = 10128
424

425
        // JSStreamNameExistErr stream name already in use with a different configuration
426
        JSStreamNameExistErr ErrorIdentifier = 10058
427

428
        // JSStreamNameExistRestoreFailedErr stream name already in use, cannot restore
429
        JSStreamNameExistRestoreFailedErr ErrorIdentifier = 10130
430

431
        // JSStreamNotFoundErr stream not found
432
        JSStreamNotFoundErr ErrorIdentifier = 10059
433

434
        // JSStreamNotMatchErr expected stream does not match
435
        JSStreamNotMatchErr ErrorIdentifier = 10060
436

437
        // JSStreamOfflineErr stream is offline
438
        JSStreamOfflineErr ErrorIdentifier = 10118
439

440
        // JSStreamPurgeFailedF Generic stream purge failure error string ({err})
441
        JSStreamPurgeFailedF ErrorIdentifier = 10110
442

443
        // JSStreamReplicasNotSupportedErr replicas > 1 not supported in non-clustered mode
444
        JSStreamReplicasNotSupportedErr ErrorIdentifier = 10074
445

446
        // JSStreamReplicasNotUpdatableErr Replicas configuration can not be updated
447
        JSStreamReplicasNotUpdatableErr ErrorIdentifier = 10061
448

449
        // JSStreamRestoreErrF restore failed: {err}
450
        JSStreamRestoreErrF ErrorIdentifier = 10062
451

452
        // JSStreamRollupFailedF Generic stream rollup failure error string ({err})
453
        JSStreamRollupFailedF ErrorIdentifier = 10111
454

455
        // JSStreamSealedErr invalid operation on sealed stream
456
        JSStreamSealedErr ErrorIdentifier = 10109
457

458
        // JSStreamSequenceNotMatchErr expected stream sequence does not match
459
        JSStreamSequenceNotMatchErr ErrorIdentifier = 10063
460

461
        // JSStreamSnapshotErrF snapshot failed: {err}
462
        JSStreamSnapshotErrF ErrorIdentifier = 10064
463

464
        // JSStreamStoreFailedF Generic error when storing a message failed ({err})
465
        JSStreamStoreFailedF ErrorIdentifier = 10077
466

467
        // JSStreamSubjectOverlapErr subjects overlap with an existing stream
468
        JSStreamSubjectOverlapErr ErrorIdentifier = 10065
469

470
        // JSStreamTemplateCreateErrF Generic template creation failed string ({err})
471
        JSStreamTemplateCreateErrF ErrorIdentifier = 10066
472

473
        // JSStreamTemplateDeleteErrF Generic stream template deletion failed error string ({err})
474
        JSStreamTemplateDeleteErrF ErrorIdentifier = 10067
475

476
        // JSStreamTemplateNotFoundErr template not found
477
        JSStreamTemplateNotFoundErr ErrorIdentifier = 10068
478

479
        // JSStreamTooManyRequests too many requests
480
        JSStreamTooManyRequests ErrorIdentifier = 10167
481

482
        // JSStreamTransformInvalidDestination stream transform: {err}
483
        JSStreamTransformInvalidDestination ErrorIdentifier = 10156
484

485
        // JSStreamTransformInvalidSource stream transform source: {err}
486
        JSStreamTransformInvalidSource ErrorIdentifier = 10155
487

488
        // JSStreamUpdateErrF Generic stream update error string ({err})
489
        JSStreamUpdateErrF ErrorIdentifier = 10069
490

491
        // JSStreamWrongLastMsgIDErrF wrong last msg ID: {id}
492
        JSStreamWrongLastMsgIDErrF ErrorIdentifier = 10070
493

494
        // JSStreamWrongLastSequenceConstantErr wrong last sequence
495
        JSStreamWrongLastSequenceConstantErr ErrorIdentifier = 10164
496

497
        // JSStreamWrongLastSequenceErrF wrong last sequence: {seq}
498
        JSStreamWrongLastSequenceErrF ErrorIdentifier = 10071
499

500
        // JSTempStorageFailedErr JetStream unable to open temp storage for restore
501
        JSTempStorageFailedErr ErrorIdentifier = 10072
502

503
        // JSTemplateNameNotMatchSubjectErr template name in subject does not match request
504
        JSTemplateNameNotMatchSubjectErr ErrorIdentifier = 10073
505
)
506

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

700
// NewJSAccountResourcesExceededError creates a new JSAccountResourcesExceededErr error: "resource limits exceeded for account"
701
func NewJSAccountResourcesExceededError(opts ...ErrorOption) *ApiError {
20,060✔
702
        eopts := parseOpts(opts)
20,060✔
703
        if ae, ok := eopts.err.(*ApiError); ok {
20,060✔
704
                return ae
×
705
        }
×
706

707
        return ApiErrors[JSAccountResourcesExceededErr]
20,060✔
708
}
709

710
// NewJSBadRequestError creates a new JSBadRequestErr error: "bad request"
711
func NewJSBadRequestError(opts ...ErrorOption) *ApiError {
10✔
712
        eopts := parseOpts(opts)
10✔
713
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
714
                return ae
×
715
        }
×
716

717
        return ApiErrors[JSBadRequestErr]
10✔
718
}
719

720
// NewJSClusterIncompleteError creates a new JSClusterIncompleteErr error: "incomplete results"
721
func NewJSClusterIncompleteError(opts ...ErrorOption) *ApiError {
×
722
        eopts := parseOpts(opts)
×
723
        if ae, ok := eopts.err.(*ApiError); ok {
×
724
                return ae
×
725
        }
×
726

727
        return ApiErrors[JSClusterIncompleteErr]
×
728
}
729

730
// NewJSClusterNoPeersError creates a new JSClusterNoPeersErrF error: "{err}"
731
func NewJSClusterNoPeersError(err error, opts ...ErrorOption) *ApiError {
55✔
732
        eopts := parseOpts(opts)
55✔
733
        if ae, ok := eopts.err.(*ApiError); ok {
55✔
734
                return ae
×
735
        }
×
736

737
        e := ApiErrors[JSClusterNoPeersErrF]
55✔
738
        args := e.toReplacerArgs([]interface{}{"{err}", err})
55✔
739
        return &ApiError{
55✔
740
                Code:        e.Code,
55✔
741
                ErrCode:     e.ErrCode,
55✔
742
                Description: strings.NewReplacer(args...).Replace(e.Description),
55✔
743
        }
55✔
744
}
745

746
// NewJSClusterNotActiveError creates a new JSClusterNotActiveErr error: "JetStream not in clustered mode"
747
func NewJSClusterNotActiveError(opts ...ErrorOption) *ApiError {
1✔
748
        eopts := parseOpts(opts)
1✔
749
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
750
                return ae
×
751
        }
×
752

753
        return ApiErrors[JSClusterNotActiveErr]
1✔
754
}
755

756
// NewJSClusterNotAssignedError creates a new JSClusterNotAssignedErr error: "JetStream cluster not assigned to this server"
757
func NewJSClusterNotAssignedError(opts ...ErrorOption) *ApiError {
27✔
758
        eopts := parseOpts(opts)
27✔
759
        if ae, ok := eopts.err.(*ApiError); ok {
27✔
760
                return ae
×
761
        }
×
762

763
        return ApiErrors[JSClusterNotAssignedErr]
27✔
764
}
765

766
// NewJSClusterNotAvailError creates a new JSClusterNotAvailErr error: "JetStream system temporarily unavailable"
767
func NewJSClusterNotAvailError(opts ...ErrorOption) *ApiError {
13✔
768
        eopts := parseOpts(opts)
13✔
769
        if ae, ok := eopts.err.(*ApiError); ok {
13✔
770
                return ae
×
771
        }
×
772

773
        return ApiErrors[JSClusterNotAvailErr]
13✔
774
}
775

776
// NewJSClusterNotLeaderError creates a new JSClusterNotLeaderErr error: "JetStream cluster can not handle request"
777
func NewJSClusterNotLeaderError(opts ...ErrorOption) *ApiError {
151✔
778
        eopts := parseOpts(opts)
151✔
779
        if ae, ok := eopts.err.(*ApiError); ok {
151✔
780
                return ae
×
781
        }
×
782

783
        return ApiErrors[JSClusterNotLeaderErr]
151✔
784
}
785

786
// NewJSClusterPeerNotMemberError creates a new JSClusterPeerNotMemberErr error: "peer not a member"
787
func NewJSClusterPeerNotMemberError(opts ...ErrorOption) *ApiError {
1✔
788
        eopts := parseOpts(opts)
1✔
789
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
790
                return ae
×
791
        }
×
792

793
        return ApiErrors[JSClusterPeerNotMemberErr]
1✔
794
}
795

796
// NewJSClusterRequiredError creates a new JSClusterRequiredErr error: "JetStream clustering support required"
797
func NewJSClusterRequiredError(opts ...ErrorOption) *ApiError {
×
798
        eopts := parseOpts(opts)
×
799
        if ae, ok := eopts.err.(*ApiError); ok {
×
800
                return ae
×
801
        }
×
802

803
        return ApiErrors[JSClusterRequiredErr]
×
804
}
805

806
// NewJSClusterServerNotMemberError creates a new JSClusterServerNotMemberErr error: "server is not a member of the cluster"
807
func NewJSClusterServerNotMemberError(opts ...ErrorOption) *ApiError {
3✔
808
        eopts := parseOpts(opts)
3✔
809
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
810
                return ae
×
811
        }
×
812

813
        return ApiErrors[JSClusterServerNotMemberErr]
3✔
814
}
815

816
// NewJSClusterTagsError creates a new JSClusterTagsErr error: "tags placement not supported for operation"
817
func NewJSClusterTagsError(opts ...ErrorOption) *ApiError {
×
818
        eopts := parseOpts(opts)
×
819
        if ae, ok := eopts.err.(*ApiError); ok {
×
820
                return ae
×
821
        }
×
822

823
        return ApiErrors[JSClusterTagsErr]
×
824
}
825

826
// NewJSClusterUnSupportFeatureError creates a new JSClusterUnSupportFeatureErr error: "not currently supported in clustered mode"
827
func NewJSClusterUnSupportFeatureError(opts ...ErrorOption) *ApiError {
6✔
828
        eopts := parseOpts(opts)
6✔
829
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
830
                return ae
×
831
        }
×
832

833
        return ApiErrors[JSClusterUnSupportFeatureErr]
6✔
834
}
835

836
// NewJSConsumerAlreadyExistsError creates a new JSConsumerAlreadyExists error: "consumer already exists"
837
func NewJSConsumerAlreadyExistsError(opts ...ErrorOption) *ApiError {
5✔
838
        eopts := parseOpts(opts)
5✔
839
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
840
                return ae
×
841
        }
×
842

843
        return ApiErrors[JSConsumerAlreadyExists]
5✔
844
}
845

846
// NewJSConsumerBadDurableNameError creates a new JSConsumerBadDurableNameErr error: "durable name can not contain '.', '*', '>'"
847
func NewJSConsumerBadDurableNameError(opts ...ErrorOption) *ApiError {
×
848
        eopts := parseOpts(opts)
×
849
        if ae, ok := eopts.err.(*ApiError); ok {
×
850
                return ae
×
851
        }
×
852

853
        return ApiErrors[JSConsumerBadDurableNameErr]
×
854
}
855

856
// NewJSConsumerConfigRequiredError creates a new JSConsumerConfigRequiredErr error: "consumer config required"
857
func NewJSConsumerConfigRequiredError(opts ...ErrorOption) *ApiError {
2✔
858
        eopts := parseOpts(opts)
2✔
859
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
860
                return ae
×
861
        }
×
862

863
        return ApiErrors[JSConsumerConfigRequiredErr]
2✔
864
}
865

866
// NewJSConsumerCreateDurableAndNameMismatchError creates a new JSConsumerCreateDurableAndNameMismatch error: "Consumer Durable and Name have to be equal if both are provided"
867
func NewJSConsumerCreateDurableAndNameMismatchError(opts ...ErrorOption) *ApiError {
1✔
868
        eopts := parseOpts(opts)
1✔
869
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
870
                return ae
×
871
        }
×
872

873
        return ApiErrors[JSConsumerCreateDurableAndNameMismatch]
1✔
874
}
875

876
// NewJSConsumerCreateError creates a new JSConsumerCreateErrF error: "{err}"
877
func NewJSConsumerCreateError(err error, opts ...ErrorOption) *ApiError {
68✔
878
        eopts := parseOpts(opts)
68✔
879
        if ae, ok := eopts.err.(*ApiError); ok {
118✔
880
                return ae
50✔
881
        }
50✔
882

883
        e := ApiErrors[JSConsumerCreateErrF]
18✔
884
        args := e.toReplacerArgs([]interface{}{"{err}", err})
18✔
885
        return &ApiError{
18✔
886
                Code:        e.Code,
18✔
887
                ErrCode:     e.ErrCode,
18✔
888
                Description: strings.NewReplacer(args...).Replace(e.Description),
18✔
889
        }
18✔
890
}
891

892
// NewJSConsumerCreateFilterSubjectMismatchError creates a new JSConsumerCreateFilterSubjectMismatchErr error: "Consumer create request did not match filtered subject from create subject"
893
func NewJSConsumerCreateFilterSubjectMismatchError(opts ...ErrorOption) *ApiError {
2✔
894
        eopts := parseOpts(opts)
2✔
895
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
896
                return ae
×
897
        }
×
898

899
        return ApiErrors[JSConsumerCreateFilterSubjectMismatchErr]
2✔
900
}
901

902
// NewJSConsumerDeliverCycleError creates a new JSConsumerDeliverCycleErr error: "consumer deliver subject forms a cycle"
903
func NewJSConsumerDeliverCycleError(opts ...ErrorOption) *ApiError {
4✔
904
        eopts := parseOpts(opts)
4✔
905
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
906
                return ae
×
907
        }
×
908

909
        return ApiErrors[JSConsumerDeliverCycleErr]
4✔
910
}
911

912
// NewJSConsumerDeliverToWildcardsError creates a new JSConsumerDeliverToWildcardsErr error: "consumer deliver subject has wildcards"
913
func NewJSConsumerDeliverToWildcardsError(opts ...ErrorOption) *ApiError {
4✔
914
        eopts := parseOpts(opts)
4✔
915
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
916
                return ae
×
917
        }
×
918

919
        return ApiErrors[JSConsumerDeliverToWildcardsErr]
4✔
920
}
921

922
// NewJSConsumerDescriptionTooLongError creates a new JSConsumerDescriptionTooLongErrF error: "consumer description is too long, maximum allowed is {max}"
923
func NewJSConsumerDescriptionTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
1✔
924
        eopts := parseOpts(opts)
1✔
925
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
926
                return ae
×
927
        }
×
928

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

938
// NewJSConsumerDirectRequiresEphemeralError creates a new JSConsumerDirectRequiresEphemeralErr error: "consumer direct requires an ephemeral consumer"
939
func NewJSConsumerDirectRequiresEphemeralError(opts ...ErrorOption) *ApiError {
×
940
        eopts := parseOpts(opts)
×
941
        if ae, ok := eopts.err.(*ApiError); ok {
×
942
                return ae
×
943
        }
×
944

945
        return ApiErrors[JSConsumerDirectRequiresEphemeralErr]
×
946
}
947

948
// NewJSConsumerDirectRequiresPushError creates a new JSConsumerDirectRequiresPushErr error: "consumer direct requires a push based consumer"
949
func NewJSConsumerDirectRequiresPushError(opts ...ErrorOption) *ApiError {
×
950
        eopts := parseOpts(opts)
×
951
        if ae, ok := eopts.err.(*ApiError); ok {
×
952
                return ae
×
953
        }
×
954

955
        return ApiErrors[JSConsumerDirectRequiresPushErr]
×
956
}
957

958
// NewJSConsumerDoesNotExistError creates a new JSConsumerDoesNotExist error: "consumer does not exist"
959
func NewJSConsumerDoesNotExistError(opts ...ErrorOption) *ApiError {
3✔
960
        eopts := parseOpts(opts)
3✔
961
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
962
                return ae
×
963
        }
×
964

965
        return ApiErrors[JSConsumerDoesNotExist]
3✔
966
}
967

968
// NewJSConsumerDuplicateFilterSubjectsError creates a new JSConsumerDuplicateFilterSubjects error: "consumer cannot have both FilterSubject and FilterSubjects specified"
969
func NewJSConsumerDuplicateFilterSubjectsError(opts ...ErrorOption) *ApiError {
1✔
970
        eopts := parseOpts(opts)
1✔
971
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
972
                return ae
×
973
        }
×
974

975
        return ApiErrors[JSConsumerDuplicateFilterSubjects]
1✔
976
}
977

978
// NewJSConsumerDurableNameNotInSubjectError creates a new JSConsumerDurableNameNotInSubjectErr error: "consumer expected to be durable but no durable name set in subject"
979
func NewJSConsumerDurableNameNotInSubjectError(opts ...ErrorOption) *ApiError {
×
980
        eopts := parseOpts(opts)
×
981
        if ae, ok := eopts.err.(*ApiError); ok {
×
982
                return ae
×
983
        }
×
984

985
        return ApiErrors[JSConsumerDurableNameNotInSubjectErr]
×
986
}
987

988
// NewJSConsumerDurableNameNotMatchSubjectError creates a new JSConsumerDurableNameNotMatchSubjectErr error: "consumer name in subject does not match durable name in request"
989
func NewJSConsumerDurableNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
×
990
        eopts := parseOpts(opts)
×
991
        if ae, ok := eopts.err.(*ApiError); ok {
×
992
                return ae
×
993
        }
×
994

995
        return ApiErrors[JSConsumerDurableNameNotMatchSubjectErr]
×
996
}
997

998
// NewJSConsumerDurableNameNotSetError creates a new JSConsumerDurableNameNotSetErr error: "consumer expected to be durable but a durable name was not set"
999
func NewJSConsumerDurableNameNotSetError(opts ...ErrorOption) *ApiError {
1✔
1000
        eopts := parseOpts(opts)
1✔
1001
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1002
                return ae
×
1003
        }
×
1004

1005
        return ApiErrors[JSConsumerDurableNameNotSetErr]
1✔
1006
}
1007

1008
// NewJSConsumerEmptyFilterError creates a new JSConsumerEmptyFilter error: "consumer filter in FilterSubjects cannot be empty"
1009
func NewJSConsumerEmptyFilterError(opts ...ErrorOption) *ApiError {
1✔
1010
        eopts := parseOpts(opts)
1✔
1011
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1012
                return ae
×
1013
        }
×
1014

1015
        return ApiErrors[JSConsumerEmptyFilter]
1✔
1016
}
1017

1018
// NewJSConsumerEmptyGroupNameError creates a new JSConsumerEmptyGroupName error: "Group name cannot be an empty string"
1019
func NewJSConsumerEmptyGroupNameError(opts ...ErrorOption) *ApiError {
4✔
1020
        eopts := parseOpts(opts)
4✔
1021
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1022
                return ae
×
1023
        }
×
1024

1025
        return ApiErrors[JSConsumerEmptyGroupName]
4✔
1026
}
1027

1028
// NewJSConsumerEphemeralWithDurableInSubjectError creates a new JSConsumerEphemeralWithDurableInSubjectErr error: "consumer expected to be ephemeral but detected a durable name set in subject"
1029
func NewJSConsumerEphemeralWithDurableInSubjectError(opts ...ErrorOption) *ApiError {
×
1030
        eopts := parseOpts(opts)
×
1031
        if ae, ok := eopts.err.(*ApiError); ok {
×
1032
                return ae
×
1033
        }
×
1034

1035
        return ApiErrors[JSConsumerEphemeralWithDurableInSubjectErr]
×
1036
}
1037

1038
// NewJSConsumerEphemeralWithDurableNameError creates a new JSConsumerEphemeralWithDurableNameErr error: "consumer expected to be ephemeral but a durable name was set in request"
1039
func NewJSConsumerEphemeralWithDurableNameError(opts ...ErrorOption) *ApiError {
3✔
1040
        eopts := parseOpts(opts)
3✔
1041
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1042
                return ae
×
1043
        }
×
1044

1045
        return ApiErrors[JSConsumerEphemeralWithDurableNameErr]
3✔
1046
}
1047

1048
// NewJSConsumerExistingActiveError creates a new JSConsumerExistingActiveErr error: "consumer already exists and is still active"
1049
func NewJSConsumerExistingActiveError(opts ...ErrorOption) *ApiError {
×
1050
        eopts := parseOpts(opts)
×
1051
        if ae, ok := eopts.err.(*ApiError); ok {
×
1052
                return ae
×
1053
        }
×
1054

1055
        return ApiErrors[JSConsumerExistingActiveErr]
×
1056
}
1057

1058
// NewJSConsumerFCRequiresPushError creates a new JSConsumerFCRequiresPushErr error: "consumer flow control requires a push based consumer"
1059
func NewJSConsumerFCRequiresPushError(opts ...ErrorOption) *ApiError {
×
1060
        eopts := parseOpts(opts)
×
1061
        if ae, ok := eopts.err.(*ApiError); ok {
×
1062
                return ae
×
1063
        }
×
1064

1065
        return ApiErrors[JSConsumerFCRequiresPushErr]
×
1066
}
1067

1068
// NewJSConsumerFilterNotSubsetError creates a new JSConsumerFilterNotSubsetErr error: "consumer filter subject is not a valid subset of the interest subjects"
1069
func NewJSConsumerFilterNotSubsetError(opts ...ErrorOption) *ApiError {
×
1070
        eopts := parseOpts(opts)
×
1071
        if ae, ok := eopts.err.(*ApiError); ok {
×
1072
                return ae
×
1073
        }
×
1074

1075
        return ApiErrors[JSConsumerFilterNotSubsetErr]
×
1076
}
1077

1078
// NewJSConsumerHBRequiresPushError creates a new JSConsumerHBRequiresPushErr error: "consumer idle heartbeat requires a push based consumer"
1079
func NewJSConsumerHBRequiresPushError(opts ...ErrorOption) *ApiError {
×
1080
        eopts := parseOpts(opts)
×
1081
        if ae, ok := eopts.err.(*ApiError); ok {
×
1082
                return ae
×
1083
        }
×
1084

1085
        return ApiErrors[JSConsumerHBRequiresPushErr]
×
1086
}
1087

1088
// NewJSConsumerInactiveThresholdExcessError creates a new JSConsumerInactiveThresholdExcess error: "consumer inactive threshold exceeds system limit of {limit}"
1089
func NewJSConsumerInactiveThresholdExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
2✔
1090
        eopts := parseOpts(opts)
2✔
1091
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1092
                return ae
×
1093
        }
×
1094

1095
        e := ApiErrors[JSConsumerInactiveThresholdExcess]
2✔
1096
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
2✔
1097
        return &ApiError{
2✔
1098
                Code:        e.Code,
2✔
1099
                ErrCode:     e.ErrCode,
2✔
1100
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1101
        }
2✔
1102
}
1103

1104
// NewJSConsumerInvalidDeliverSubjectError creates a new JSConsumerInvalidDeliverSubject error: "invalid push consumer deliver subject"
1105
func NewJSConsumerInvalidDeliverSubjectError(opts ...ErrorOption) *ApiError {
2✔
1106
        eopts := parseOpts(opts)
2✔
1107
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1108
                return ae
×
1109
        }
×
1110

1111
        return ApiErrors[JSConsumerInvalidDeliverSubject]
2✔
1112
}
1113

1114
// NewJSConsumerInvalidGroupNameError creates a new JSConsumerInvalidGroupNameErr error: "Valid priority group name must match A-Z, a-z, 0-9, -_/=)+ and may not exceed 16 characters"
1115
func NewJSConsumerInvalidGroupNameError(opts ...ErrorOption) *ApiError {
4✔
1116
        eopts := parseOpts(opts)
4✔
1117
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1118
                return ae
×
1119
        }
×
1120

1121
        return ApiErrors[JSConsumerInvalidGroupNameErr]
4✔
1122
}
1123

1124
// NewJSConsumerInvalidPolicyError creates a new JSConsumerInvalidPolicyErrF error: "{err}"
1125
func NewJSConsumerInvalidPolicyError(err error, opts ...ErrorOption) *ApiError {
10✔
1126
        eopts := parseOpts(opts)
10✔
1127
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1128
                return ae
×
1129
        }
×
1130

1131
        e := ApiErrors[JSConsumerInvalidPolicyErrF]
10✔
1132
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1133
        return &ApiError{
10✔
1134
                Code:        e.Code,
10✔
1135
                ErrCode:     e.ErrCode,
10✔
1136
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1137
        }
10✔
1138
}
1139

1140
// NewJSConsumerInvalidPriorityGroupError creates a new JSConsumerInvalidPriorityGroupErr error: "Provided priority group does not exist for this consumer"
1141
func NewJSConsumerInvalidPriorityGroupError(opts ...ErrorOption) *ApiError {
2✔
1142
        eopts := parseOpts(opts)
2✔
1143
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1144
                return ae
×
1145
        }
×
1146

1147
        return ApiErrors[JSConsumerInvalidPriorityGroupErr]
2✔
1148
}
1149

1150
// NewJSConsumerInvalidSamplingError creates a new JSConsumerInvalidSamplingErrF error: "failed to parse consumer sampling configuration: {err}"
1151
func NewJSConsumerInvalidSamplingError(err error, opts ...ErrorOption) *ApiError {
×
1152
        eopts := parseOpts(opts)
×
1153
        if ae, ok := eopts.err.(*ApiError); ok {
×
1154
                return ae
×
1155
        }
×
1156

1157
        e := ApiErrors[JSConsumerInvalidSamplingErrF]
×
1158
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1159
        return &ApiError{
×
1160
                Code:        e.Code,
×
1161
                ErrCode:     e.ErrCode,
×
1162
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1163
        }
×
1164
}
1165

1166
// NewJSConsumerMaxDeliverBackoffError creates a new JSConsumerMaxDeliverBackoffErr error: "max deliver is required to be > length of backoff values"
1167
func NewJSConsumerMaxDeliverBackoffError(opts ...ErrorOption) *ApiError {
3✔
1168
        eopts := parseOpts(opts)
3✔
1169
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1170
                return ae
×
1171
        }
×
1172

1173
        return ApiErrors[JSConsumerMaxDeliverBackoffErr]
3✔
1174
}
1175

1176
// NewJSConsumerMaxPendingAckExcessError creates a new JSConsumerMaxPendingAckExcessErrF error: "consumer max ack pending exceeds system limit of {limit}"
1177
func NewJSConsumerMaxPendingAckExcessError(limit interface{}, opts ...ErrorOption) *ApiError {
12✔
1178
        eopts := parseOpts(opts)
12✔
1179
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
1180
                return ae
×
1181
        }
×
1182

1183
        e := ApiErrors[JSConsumerMaxPendingAckExcessErrF]
12✔
1184
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
12✔
1185
        return &ApiError{
12✔
1186
                Code:        e.Code,
12✔
1187
                ErrCode:     e.ErrCode,
12✔
1188
                Description: strings.NewReplacer(args...).Replace(e.Description),
12✔
1189
        }
12✔
1190
}
1191

1192
// NewJSConsumerMaxPendingAckPolicyRequiredError creates a new JSConsumerMaxPendingAckPolicyRequiredErr error: "consumer requires ack policy for max ack pending"
1193
func NewJSConsumerMaxPendingAckPolicyRequiredError(opts ...ErrorOption) *ApiError {
2✔
1194
        eopts := parseOpts(opts)
2✔
1195
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1196
                return ae
×
1197
        }
×
1198

1199
        return ApiErrors[JSConsumerMaxPendingAckPolicyRequiredErr]
2✔
1200
}
1201

1202
// NewJSConsumerMaxRequestBatchExceededError creates a new JSConsumerMaxRequestBatchExceededF error: "consumer max request batch exceeds server limit of {limit}"
1203
func NewJSConsumerMaxRequestBatchExceededError(limit interface{}, opts ...ErrorOption) *ApiError {
4✔
1204
        eopts := parseOpts(opts)
4✔
1205
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1206
                return ae
×
1207
        }
×
1208

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

1218
// NewJSConsumerMaxRequestBatchNegativeError creates a new JSConsumerMaxRequestBatchNegativeErr error: "consumer max request batch needs to be > 0"
1219
func NewJSConsumerMaxRequestBatchNegativeError(opts ...ErrorOption) *ApiError {
×
1220
        eopts := parseOpts(opts)
×
1221
        if ae, ok := eopts.err.(*ApiError); ok {
×
1222
                return ae
×
1223
        }
×
1224

1225
        return ApiErrors[JSConsumerMaxRequestBatchNegativeErr]
×
1226
}
1227

1228
// NewJSConsumerMaxRequestExpiresToSmallError creates a new JSConsumerMaxRequestExpiresToSmall error: "consumer max request expires needs to be >= 1ms"
1229
func NewJSConsumerMaxRequestExpiresToSmallError(opts ...ErrorOption) *ApiError {
×
1230
        eopts := parseOpts(opts)
×
1231
        if ae, ok := eopts.err.(*ApiError); ok {
×
1232
                return ae
×
1233
        }
×
1234

1235
        return ApiErrors[JSConsumerMaxRequestExpiresToSmall]
×
1236
}
1237

1238
// NewJSConsumerMaxWaitingNegativeError creates a new JSConsumerMaxWaitingNegativeErr error: "consumer max waiting needs to be positive"
1239
func NewJSConsumerMaxWaitingNegativeError(opts ...ErrorOption) *ApiError {
2✔
1240
        eopts := parseOpts(opts)
2✔
1241
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1242
                return ae
×
1243
        }
×
1244

1245
        return ApiErrors[JSConsumerMaxWaitingNegativeErr]
2✔
1246
}
1247

1248
// NewJSConsumerMetadataLengthError creates a new JSConsumerMetadataLengthErrF error: "consumer metadata exceeds maximum size of {limit}"
1249
func NewJSConsumerMetadataLengthError(limit interface{}, opts ...ErrorOption) *ApiError {
1✔
1250
        eopts := parseOpts(opts)
1✔
1251
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1252
                return ae
×
1253
        }
×
1254

1255
        e := ApiErrors[JSConsumerMetadataLengthErrF]
1✔
1256
        args := e.toReplacerArgs([]interface{}{"{limit}", limit})
1✔
1257
        return &ApiError{
1✔
1258
                Code:        e.Code,
1✔
1259
                ErrCode:     e.ErrCode,
1✔
1260
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1261
        }
1✔
1262
}
1263

1264
// NewJSConsumerMultipleFiltersNotAllowedError creates a new JSConsumerMultipleFiltersNotAllowed error: "consumer with multiple subject filters cannot use subject based API"
1265
func NewJSConsumerMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
1266
        eopts := parseOpts(opts)
1✔
1267
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1268
                return ae
×
1269
        }
×
1270

1271
        return ApiErrors[JSConsumerMultipleFiltersNotAllowed]
1✔
1272
}
1273

1274
// NewJSConsumerNameContainsPathSeparatorsError creates a new JSConsumerNameContainsPathSeparatorsErr error: "Consumer name can not contain path separators"
1275
func NewJSConsumerNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
8✔
1276
        eopts := parseOpts(opts)
8✔
1277
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1278
                return ae
×
1279
        }
×
1280

1281
        return ApiErrors[JSConsumerNameContainsPathSeparatorsErr]
8✔
1282
}
1283

1284
// NewJSConsumerNameExistError creates a new JSConsumerNameExistErr error: "consumer name already in use"
1285
func NewJSConsumerNameExistError(opts ...ErrorOption) *ApiError {
2✔
1286
        eopts := parseOpts(opts)
2✔
1287
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1288
                return ae
×
1289
        }
×
1290

1291
        return ApiErrors[JSConsumerNameExistErr]
2✔
1292
}
1293

1294
// NewJSConsumerNameTooLongError creates a new JSConsumerNameTooLongErrF error: "consumer name is too long, maximum allowed is {max}"
1295
func NewJSConsumerNameTooLongError(max interface{}, opts ...ErrorOption) *ApiError {
×
1296
        eopts := parseOpts(opts)
×
1297
        if ae, ok := eopts.err.(*ApiError); ok {
×
1298
                return ae
×
1299
        }
×
1300

1301
        e := ApiErrors[JSConsumerNameTooLongErrF]
×
1302
        args := e.toReplacerArgs([]interface{}{"{max}", max})
×
1303
        return &ApiError{
×
1304
                Code:        e.Code,
×
1305
                ErrCode:     e.ErrCode,
×
1306
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1307
        }
×
1308
}
1309

1310
// NewJSConsumerNotFoundError creates a new JSConsumerNotFoundErr error: "consumer not found"
1311
func NewJSConsumerNotFoundError(opts ...ErrorOption) *ApiError {
2,789✔
1312
        eopts := parseOpts(opts)
2,789✔
1313
        if ae, ok := eopts.err.(*ApiError); ok {
2,789✔
1314
                return ae
×
1315
        }
×
1316

1317
        return ApiErrors[JSConsumerNotFoundErr]
2,789✔
1318
}
1319

1320
// NewJSConsumerOfflineError creates a new JSConsumerOfflineErr error: "consumer is offline"
1321
func NewJSConsumerOfflineError(opts ...ErrorOption) *ApiError {
2✔
1322
        eopts := parseOpts(opts)
2✔
1323
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1324
                return ae
×
1325
        }
×
1326

1327
        return ApiErrors[JSConsumerOfflineErr]
2✔
1328
}
1329

1330
// NewJSConsumerOnMappedError creates a new JSConsumerOnMappedErr error: "consumer direct on a mapped consumer"
1331
func NewJSConsumerOnMappedError(opts ...ErrorOption) *ApiError {
×
1332
        eopts := parseOpts(opts)
×
1333
        if ae, ok := eopts.err.(*ApiError); ok {
×
1334
                return ae
×
1335
        }
×
1336

1337
        return ApiErrors[JSConsumerOnMappedErr]
×
1338
}
1339

1340
// NewJSConsumerOverlappingSubjectFiltersError creates a new JSConsumerOverlappingSubjectFilters error: "consumer subject filters cannot overlap"
1341
func NewJSConsumerOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
1✔
1342
        eopts := parseOpts(opts)
1✔
1343
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1344
                return ae
×
1345
        }
×
1346

1347
        return ApiErrors[JSConsumerOverlappingSubjectFilters]
1✔
1348
}
1349

1350
// NewJSConsumerPriorityPolicyWithoutGroupError creates a new JSConsumerPriorityPolicyWithoutGroup error: "Setting PriorityPolicy requires at least one PriorityGroup to be set"
1351
func NewJSConsumerPriorityPolicyWithoutGroupError(opts ...ErrorOption) *ApiError {
4✔
1352
        eopts := parseOpts(opts)
4✔
1353
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1354
                return ae
×
1355
        }
×
1356

1357
        return ApiErrors[JSConsumerPriorityPolicyWithoutGroup]
4✔
1358
}
1359

1360
// NewJSConsumerPullNotDurableError creates a new JSConsumerPullNotDurableErr error: "consumer in pull mode requires a durable name"
1361
func NewJSConsumerPullNotDurableError(opts ...ErrorOption) *ApiError {
×
1362
        eopts := parseOpts(opts)
×
1363
        if ae, ok := eopts.err.(*ApiError); ok {
×
1364
                return ae
×
1365
        }
×
1366

1367
        return ApiErrors[JSConsumerPullNotDurableErr]
×
1368
}
1369

1370
// NewJSConsumerPullRequiresAckError creates a new JSConsumerPullRequiresAckErr error: "consumer in pull mode requires explicit ack policy on workqueue stream"
1371
func NewJSConsumerPullRequiresAckError(opts ...ErrorOption) *ApiError {
6✔
1372
        eopts := parseOpts(opts)
6✔
1373
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1374
                return ae
×
1375
        }
×
1376

1377
        return ApiErrors[JSConsumerPullRequiresAckErr]
6✔
1378
}
1379

1380
// NewJSConsumerPullWithRateLimitError creates a new JSConsumerPullWithRateLimitErr error: "consumer in pull mode can not have rate limit set"
1381
func NewJSConsumerPullWithRateLimitError(opts ...ErrorOption) *ApiError {
1✔
1382
        eopts := parseOpts(opts)
1✔
1383
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1384
                return ae
×
1385
        }
×
1386

1387
        return ApiErrors[JSConsumerPullWithRateLimitErr]
1✔
1388
}
1389

1390
// NewJSConsumerPushMaxWaitingError creates a new JSConsumerPushMaxWaitingErr error: "consumer in push mode can not set max waiting"
1391
func NewJSConsumerPushMaxWaitingError(opts ...ErrorOption) *ApiError {
3✔
1392
        eopts := parseOpts(opts)
3✔
1393
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1394
                return ae
×
1395
        }
×
1396

1397
        return ApiErrors[JSConsumerPushMaxWaitingErr]
3✔
1398
}
1399

1400
// NewJSConsumerReplacementWithDifferentNameError creates a new JSConsumerReplacementWithDifferentNameErr error: "consumer replacement durable config not the same"
1401
func NewJSConsumerReplacementWithDifferentNameError(opts ...ErrorOption) *ApiError {
×
1402
        eopts := parseOpts(opts)
×
1403
        if ae, ok := eopts.err.(*ApiError); ok {
×
1404
                return ae
×
1405
        }
×
1406

1407
        return ApiErrors[JSConsumerReplacementWithDifferentNameErr]
×
1408
}
1409

1410
// NewJSConsumerReplicasExceedsStreamError creates a new JSConsumerReplicasExceedsStream error: "consumer config replica count exceeds parent stream"
1411
func NewJSConsumerReplicasExceedsStreamError(opts ...ErrorOption) *ApiError {
1✔
1412
        eopts := parseOpts(opts)
1✔
1413
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1414
                return ae
×
1415
        }
×
1416

1417
        return ApiErrors[JSConsumerReplicasExceedsStream]
1✔
1418
}
1419

1420
// NewJSConsumerReplicasShouldMatchStreamError creates a new JSConsumerReplicasShouldMatchStream error: "consumer config replicas must match interest retention stream's replicas"
1421
func NewJSConsumerReplicasShouldMatchStreamError(opts ...ErrorOption) *ApiError {
2✔
1422
        eopts := parseOpts(opts)
2✔
1423
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1424
                return ae
×
1425
        }
×
1426

1427
        return ApiErrors[JSConsumerReplicasShouldMatchStream]
2✔
1428
}
1429

1430
// NewJSConsumerSmallHeartbeatError creates a new JSConsumerSmallHeartbeatErr error: "consumer idle heartbeat needs to be >= 100ms"
1431
func NewJSConsumerSmallHeartbeatError(opts ...ErrorOption) *ApiError {
1✔
1432
        eopts := parseOpts(opts)
1✔
1433
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1434
                return ae
×
1435
        }
×
1436

1437
        return ApiErrors[JSConsumerSmallHeartbeatErr]
1✔
1438
}
1439

1440
// NewJSConsumerStoreFailedError creates a new JSConsumerStoreFailedErrF error: "error creating store for consumer: {err}"
1441
func NewJSConsumerStoreFailedError(err error, opts ...ErrorOption) *ApiError {
10✔
1442
        eopts := parseOpts(opts)
10✔
1443
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1444
                return ae
×
1445
        }
×
1446

1447
        e := ApiErrors[JSConsumerStoreFailedErrF]
10✔
1448
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1449
        return &ApiError{
10✔
1450
                Code:        e.Code,
10✔
1451
                ErrCode:     e.ErrCode,
10✔
1452
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1453
        }
10✔
1454
}
1455

1456
// NewJSConsumerWQConsumerNotDeliverAllError creates a new JSConsumerWQConsumerNotDeliverAllErr error: "consumer must be deliver all on workqueue stream"
1457
func NewJSConsumerWQConsumerNotDeliverAllError(opts ...ErrorOption) *ApiError {
×
1458
        eopts := parseOpts(opts)
×
1459
        if ae, ok := eopts.err.(*ApiError); ok {
×
1460
                return ae
×
1461
        }
×
1462

1463
        return ApiErrors[JSConsumerWQConsumerNotDeliverAllErr]
×
1464
}
1465

1466
// NewJSConsumerWQConsumerNotUniqueError creates a new JSConsumerWQConsumerNotUniqueErr error: "filtered consumer not unique on workqueue stream"
1467
func NewJSConsumerWQConsumerNotUniqueError(opts ...ErrorOption) *ApiError {
11✔
1468
        eopts := parseOpts(opts)
11✔
1469
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
1470
                return ae
×
1471
        }
×
1472

1473
        return ApiErrors[JSConsumerWQConsumerNotUniqueErr]
11✔
1474
}
1475

1476
// NewJSConsumerWQMultipleUnfilteredError creates a new JSConsumerWQMultipleUnfilteredErr error: "multiple non-filtered consumers not allowed on workqueue stream"
1477
func NewJSConsumerWQMultipleUnfilteredError(opts ...ErrorOption) *ApiError {
2✔
1478
        eopts := parseOpts(opts)
2✔
1479
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1480
                return ae
×
1481
        }
×
1482

1483
        return ApiErrors[JSConsumerWQMultipleUnfilteredErr]
2✔
1484
}
1485

1486
// NewJSConsumerWQRequiresExplicitAckError creates a new JSConsumerWQRequiresExplicitAckErr error: "workqueue stream requires explicit ack"
1487
func NewJSConsumerWQRequiresExplicitAckError(opts ...ErrorOption) *ApiError {
×
1488
        eopts := parseOpts(opts)
×
1489
        if ae, ok := eopts.err.(*ApiError); ok {
×
1490
                return ae
×
1491
        }
×
1492

1493
        return ApiErrors[JSConsumerWQRequiresExplicitAckErr]
×
1494
}
1495

1496
// NewJSConsumerWithFlowControlNeedsHeartbeatsError creates a new JSConsumerWithFlowControlNeedsHeartbeats error: "consumer with flow control also needs heartbeats"
1497
func NewJSConsumerWithFlowControlNeedsHeartbeatsError(opts ...ErrorOption) *ApiError {
4✔
1498
        eopts := parseOpts(opts)
4✔
1499
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1500
                return ae
×
1501
        }
×
1502

1503
        return ApiErrors[JSConsumerWithFlowControlNeedsHeartbeats]
4✔
1504
}
1505

1506
// NewJSInsufficientResourcesError creates a new JSInsufficientResourcesErr error: "insufficient resources"
1507
func NewJSInsufficientResourcesError(opts ...ErrorOption) *ApiError {
10✔
1508
        eopts := parseOpts(opts)
10✔
1509
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1510
                return ae
×
1511
        }
×
1512

1513
        return ApiErrors[JSInsufficientResourcesErr]
10✔
1514
}
1515

1516
// NewJSInvalidJSONError creates a new JSInvalidJSONErr error: "invalid JSON: {err}"
1517
func NewJSInvalidJSONError(err error, opts ...ErrorOption) *ApiError {
10✔
1518
        eopts := parseOpts(opts)
10✔
1519
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1520
                return ae
×
1521
        }
×
1522

1523
        e := ApiErrors[JSInvalidJSONErr]
10✔
1524
        args := e.toReplacerArgs([]interface{}{"{err}", err})
10✔
1525
        return &ApiError{
10✔
1526
                Code:        e.Code,
10✔
1527
                ErrCode:     e.ErrCode,
10✔
1528
                Description: strings.NewReplacer(args...).Replace(e.Description),
10✔
1529
        }
10✔
1530
}
1531

1532
// NewJSMaximumConsumersLimitError creates a new JSMaximumConsumersLimitErr error: "maximum consumers limit reached"
1533
func NewJSMaximumConsumersLimitError(opts ...ErrorOption) *ApiError {
29✔
1534
        eopts := parseOpts(opts)
29✔
1535
        if ae, ok := eopts.err.(*ApiError); ok {
29✔
1536
                return ae
×
1537
        }
×
1538

1539
        return ApiErrors[JSMaximumConsumersLimitErr]
29✔
1540
}
1541

1542
// NewJSMaximumStreamsLimitError creates a new JSMaximumStreamsLimitErr error: "maximum number of streams reached"
1543
func NewJSMaximumStreamsLimitError(opts ...ErrorOption) *ApiError {
16✔
1544
        eopts := parseOpts(opts)
16✔
1545
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
1546
                return ae
×
1547
        }
×
1548

1549
        return ApiErrors[JSMaximumStreamsLimitErr]
16✔
1550
}
1551

1552
// NewJSMemoryResourcesExceededError creates a new JSMemoryResourcesExceededErr error: "insufficient memory resources available"
1553
func NewJSMemoryResourcesExceededError(opts ...ErrorOption) *ApiError {
4✔
1554
        eopts := parseOpts(opts)
4✔
1555
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1556
                return ae
×
1557
        }
×
1558

1559
        return ApiErrors[JSMemoryResourcesExceededErr]
4✔
1560
}
1561

1562
// NewJSMessageTTLDisabledError creates a new JSMessageTTLDisabledErr error: "per-message TTL is disabled"
1563
func NewJSMessageTTLDisabledError(opts ...ErrorOption) *ApiError {
3✔
1564
        eopts := parseOpts(opts)
3✔
1565
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1566
                return ae
×
1567
        }
×
1568

1569
        return ApiErrors[JSMessageTTLDisabledErr]
3✔
1570
}
1571

1572
// NewJSMessageTTLInvalidError creates a new JSMessageTTLInvalidErr error: "invalid per-message TTL"
1573
func NewJSMessageTTLInvalidError(opts ...ErrorOption) *ApiError {
12✔
1574
        eopts := parseOpts(opts)
12✔
1575
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
1576
                return ae
×
1577
        }
×
1578

1579
        return ApiErrors[JSMessageTTLInvalidErr]
12✔
1580
}
1581

1582
// NewJSMirrorConsumerSetupFailedError creates a new JSMirrorConsumerSetupFailedErrF error: "{err}"
1583
func NewJSMirrorConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
1584
        eopts := parseOpts(opts)
×
1585
        if ae, ok := eopts.err.(*ApiError); ok {
×
1586
                return ae
×
1587
        }
×
1588

1589
        e := ApiErrors[JSMirrorConsumerSetupFailedErrF]
×
1590
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1591
        return &ApiError{
×
1592
                Code:        e.Code,
×
1593
                ErrCode:     e.ErrCode,
×
1594
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1595
        }
×
1596
}
1597

1598
// NewJSMirrorInvalidStreamNameError creates a new JSMirrorInvalidStreamName error: "mirrored stream name is invalid"
1599
func NewJSMirrorInvalidStreamNameError(opts ...ErrorOption) *ApiError {
×
1600
        eopts := parseOpts(opts)
×
1601
        if ae, ok := eopts.err.(*ApiError); ok {
×
1602
                return ae
×
1603
        }
×
1604

1605
        return ApiErrors[JSMirrorInvalidStreamName]
×
1606
}
1607

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

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

1624
// NewJSMirrorInvalidTransformDestinationError creates a new JSMirrorInvalidTransformDestination error: "mirror transform: {err}"
1625
func NewJSMirrorInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
2✔
1626
        eopts := parseOpts(opts)
2✔
1627
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1628
                return ae
×
1629
        }
×
1630

1631
        e := ApiErrors[JSMirrorInvalidTransformDestination]
2✔
1632
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2✔
1633
        return &ApiError{
2✔
1634
                Code:        e.Code,
2✔
1635
                ErrCode:     e.ErrCode,
2✔
1636
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
1637
        }
2✔
1638
}
1639

1640
// NewJSMirrorMaxMessageSizeTooBigError creates a new JSMirrorMaxMessageSizeTooBigErr error: "stream mirror must have max message size >= source"
1641
func NewJSMirrorMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
1642
        eopts := parseOpts(opts)
×
1643
        if ae, ok := eopts.err.(*ApiError); ok {
×
1644
                return ae
×
1645
        }
×
1646

1647
        return ApiErrors[JSMirrorMaxMessageSizeTooBigErr]
×
1648
}
1649

1650
// NewJSMirrorMultipleFiltersNotAllowedError creates a new JSMirrorMultipleFiltersNotAllowed error: "mirror with multiple subject transforms cannot also have a single subject filter"
1651
func NewJSMirrorMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
1✔
1652
        eopts := parseOpts(opts)
1✔
1653
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1654
                return ae
×
1655
        }
×
1656

1657
        return ApiErrors[JSMirrorMultipleFiltersNotAllowed]
1✔
1658
}
1659

1660
// NewJSMirrorOverlappingSubjectFiltersError creates a new JSMirrorOverlappingSubjectFilters error: "mirror subject filters can not overlap"
1661
func NewJSMirrorOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
2✔
1662
        eopts := parseOpts(opts)
2✔
1663
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1664
                return ae
×
1665
        }
×
1666

1667
        return ApiErrors[JSMirrorOverlappingSubjectFilters]
2✔
1668
}
1669

1670
// NewJSMirrorWithFirstSeqError creates a new JSMirrorWithFirstSeqErr error: "stream mirrors can not have first sequence configured"
1671
func NewJSMirrorWithFirstSeqError(opts ...ErrorOption) *ApiError {
2✔
1672
        eopts := parseOpts(opts)
2✔
1673
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1674
                return ae
×
1675
        }
×
1676

1677
        return ApiErrors[JSMirrorWithFirstSeqErr]
2✔
1678
}
1679

1680
// NewJSMirrorWithSourcesError creates a new JSMirrorWithSourcesErr error: "stream mirrors can not also contain other sources"
1681
func NewJSMirrorWithSourcesError(opts ...ErrorOption) *ApiError {
×
1682
        eopts := parseOpts(opts)
×
1683
        if ae, ok := eopts.err.(*ApiError); ok {
×
1684
                return ae
×
1685
        }
×
1686

1687
        return ApiErrors[JSMirrorWithSourcesErr]
×
1688
}
1689

1690
// NewJSMirrorWithStartSeqAndTimeError creates a new JSMirrorWithStartSeqAndTimeErr error: "stream mirrors can not have both start seq and start time configured"
1691
func NewJSMirrorWithStartSeqAndTimeError(opts ...ErrorOption) *ApiError {
×
1692
        eopts := parseOpts(opts)
×
1693
        if ae, ok := eopts.err.(*ApiError); ok {
×
1694
                return ae
×
1695
        }
×
1696

1697
        return ApiErrors[JSMirrorWithStartSeqAndTimeErr]
×
1698
}
1699

1700
// NewJSMirrorWithSubjectFiltersError creates a new JSMirrorWithSubjectFiltersErr error: "stream mirrors can not contain filtered subjects"
1701
func NewJSMirrorWithSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
1702
        eopts := parseOpts(opts)
×
1703
        if ae, ok := eopts.err.(*ApiError); ok {
×
1704
                return ae
×
1705
        }
×
1706

1707
        return ApiErrors[JSMirrorWithSubjectFiltersErr]
×
1708
}
1709

1710
// NewJSMirrorWithSubjectsError creates a new JSMirrorWithSubjectsErr error: "stream mirrors can not contain subjects"
1711
func NewJSMirrorWithSubjectsError(opts ...ErrorOption) *ApiError {
2✔
1712
        eopts := parseOpts(opts)
2✔
1713
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
1714
                return ae
×
1715
        }
×
1716

1717
        return ApiErrors[JSMirrorWithSubjectsErr]
2✔
1718
}
1719

1720
// NewJSNoAccountError creates a new JSNoAccountErr error: "account not found"
1721
func NewJSNoAccountError(opts ...ErrorOption) *ApiError {
1✔
1722
        eopts := parseOpts(opts)
1✔
1723
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1724
                return ae
×
1725
        }
×
1726

1727
        return ApiErrors[JSNoAccountErr]
1✔
1728
}
1729

1730
// NewJSNoLimitsError creates a new JSNoLimitsErr error: "no JetStream default or applicable tiered limit present"
1731
func NewJSNoLimitsError(opts ...ErrorOption) *ApiError {
4✔
1732
        eopts := parseOpts(opts)
4✔
1733
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
1734
                return ae
×
1735
        }
×
1736

1737
        return ApiErrors[JSNoLimitsErr]
4✔
1738
}
1739

1740
// NewJSNoMessageFoundError creates a new JSNoMessageFoundErr error: "no message found"
1741
func NewJSNoMessageFoundError(opts ...ErrorOption) *ApiError {
392✔
1742
        eopts := parseOpts(opts)
392✔
1743
        if ae, ok := eopts.err.(*ApiError); ok {
392✔
1744
                return ae
×
1745
        }
×
1746

1747
        return ApiErrors[JSNoMessageFoundErr]
392✔
1748
}
1749

1750
// NewJSNotEmptyRequestError creates a new JSNotEmptyRequestErr error: "expected an empty request payload"
1751
func NewJSNotEmptyRequestError(opts ...ErrorOption) *ApiError {
3✔
1752
        eopts := parseOpts(opts)
3✔
1753
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1754
                return ae
×
1755
        }
×
1756

1757
        return ApiErrors[JSNotEmptyRequestErr]
3✔
1758
}
1759

1760
// NewJSNotEnabledError creates a new JSNotEnabledErr error: "JetStream not enabled"
1761
func NewJSNotEnabledError(opts ...ErrorOption) *ApiError {
10✔
1762
        eopts := parseOpts(opts)
10✔
1763
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
1764
                return ae
×
1765
        }
×
1766

1767
        return ApiErrors[JSNotEnabledErr]
10✔
1768
}
1769

1770
// NewJSNotEnabledForAccountError creates a new JSNotEnabledForAccountErr error: "JetStream not enabled for account"
1771
func NewJSNotEnabledForAccountError(opts ...ErrorOption) *ApiError {
357✔
1772
        eopts := parseOpts(opts)
357✔
1773
        if ae, ok := eopts.err.(*ApiError); ok {
357✔
1774
                return ae
×
1775
        }
×
1776

1777
        return ApiErrors[JSNotEnabledForAccountErr]
357✔
1778
}
1779

1780
// NewJSPedanticError creates a new JSPedanticErrF error: "pedantic mode: {err}"
1781
func NewJSPedanticError(err error, opts ...ErrorOption) *ApiError {
8✔
1782
        eopts := parseOpts(opts)
8✔
1783
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
1784
                return ae
×
1785
        }
×
1786

1787
        e := ApiErrors[JSPedanticErrF]
8✔
1788
        args := e.toReplacerArgs([]interface{}{"{err}", err})
8✔
1789
        return &ApiError{
8✔
1790
                Code:        e.Code,
8✔
1791
                ErrCode:     e.ErrCode,
8✔
1792
                Description: strings.NewReplacer(args...).Replace(e.Description),
8✔
1793
        }
8✔
1794
}
1795

1796
// NewJSPeerRemapError creates a new JSPeerRemapErr error: "peer remap failed"
1797
func NewJSPeerRemapError(opts ...ErrorOption) *ApiError {
5✔
1798
        eopts := parseOpts(opts)
5✔
1799
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1800
                return ae
1✔
1801
        }
1✔
1802

1803
        return ApiErrors[JSPeerRemapErr]
4✔
1804
}
1805

1806
// NewJSRaftGeneralError creates a new JSRaftGeneralErrF error: "{err}"
1807
func NewJSRaftGeneralError(err error, opts ...ErrorOption) *ApiError {
×
1808
        eopts := parseOpts(opts)
×
1809
        if ae, ok := eopts.err.(*ApiError); ok {
×
1810
                return ae
×
1811
        }
×
1812

1813
        e := ApiErrors[JSRaftGeneralErrF]
×
1814
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1815
        return &ApiError{
×
1816
                Code:        e.Code,
×
1817
                ErrCode:     e.ErrCode,
×
1818
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1819
        }
×
1820
}
1821

1822
// NewJSReplicasCountCannotBeNegativeError creates a new JSReplicasCountCannotBeNegative error: "replicas count cannot be negative"
1823
func NewJSReplicasCountCannotBeNegativeError(opts ...ErrorOption) *ApiError {
16✔
1824
        eopts := parseOpts(opts)
16✔
1825
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
1826
                return ae
×
1827
        }
×
1828

1829
        return ApiErrors[JSReplicasCountCannotBeNegative]
16✔
1830
}
1831

1832
// NewJSRestoreSubscribeFailedError creates a new JSRestoreSubscribeFailedErrF error: "JetStream unable to subscribe to restore snapshot {subject}: {err}"
1833
func NewJSRestoreSubscribeFailedError(err error, subject interface{}, opts ...ErrorOption) *ApiError {
1✔
1834
        eopts := parseOpts(opts)
1✔
1835
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1836
                return ae
×
1837
        }
×
1838

1839
        e := ApiErrors[JSRestoreSubscribeFailedErrF]
1✔
1840
        args := e.toReplacerArgs([]interface{}{"{err}", err, "{subject}", subject})
1✔
1841
        return &ApiError{
1✔
1842
                Code:        e.Code,
1✔
1843
                ErrCode:     e.ErrCode,
1✔
1844
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1845
        }
1✔
1846
}
1847

1848
// NewJSSequenceNotFoundError creates a new JSSequenceNotFoundErrF error: "sequence {seq} not found"
1849
func NewJSSequenceNotFoundError(seq uint64, opts ...ErrorOption) *ApiError {
×
1850
        eopts := parseOpts(opts)
×
1851
        if ae, ok := eopts.err.(*ApiError); ok {
×
1852
                return ae
×
1853
        }
×
1854

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

1864
// NewJSSnapshotDeliverSubjectInvalidError creates a new JSSnapshotDeliverSubjectInvalidErr error: "deliver subject not valid"
1865
func NewJSSnapshotDeliverSubjectInvalidError(opts ...ErrorOption) *ApiError {
1✔
1866
        eopts := parseOpts(opts)
1✔
1867
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1868
                return ae
×
1869
        }
×
1870

1871
        return ApiErrors[JSSnapshotDeliverSubjectInvalidErr]
1✔
1872
}
1873

1874
// NewJSSourceConsumerSetupFailedError creates a new JSSourceConsumerSetupFailedErrF error: "{err}"
1875
func NewJSSourceConsumerSetupFailedError(err error, opts ...ErrorOption) *ApiError {
×
1876
        eopts := parseOpts(opts)
×
1877
        if ae, ok := eopts.err.(*ApiError); ok {
×
1878
                return ae
×
1879
        }
×
1880

1881
        e := ApiErrors[JSSourceConsumerSetupFailedErrF]
×
1882
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
1883
        return &ApiError{
×
1884
                Code:        e.Code,
×
1885
                ErrCode:     e.ErrCode,
×
1886
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
1887
        }
×
1888
}
1889

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

1897
        return ApiErrors[JSSourceDuplicateDetected]
×
1898
}
1899

1900
// NewJSSourceInvalidStreamNameError creates a new JSSourceInvalidStreamName error: "sourced stream name is invalid"
1901
func NewJSSourceInvalidStreamNameError(opts ...ErrorOption) *ApiError {
1✔
1902
        eopts := parseOpts(opts)
1✔
1903
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1904
                return ae
×
1905
        }
×
1906

1907
        return ApiErrors[JSSourceInvalidStreamName]
1✔
1908
}
1909

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

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

1926
// NewJSSourceInvalidTransformDestinationError creates a new JSSourceInvalidTransformDestination error: "source transform: {err}"
1927
func NewJSSourceInvalidTransformDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
1928
        eopts := parseOpts(opts)
1✔
1929
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
1930
                return ae
×
1931
        }
×
1932

1933
        e := ApiErrors[JSSourceInvalidTransformDestination]
1✔
1934
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
1935
        return &ApiError{
1✔
1936
                Code:        e.Code,
1✔
1937
                ErrCode:     e.ErrCode,
1✔
1938
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
1939
        }
1✔
1940
}
1941

1942
// NewJSSourceMaxMessageSizeTooBigError creates a new JSSourceMaxMessageSizeTooBigErr error: "stream source must have max message size >= target"
1943
func NewJSSourceMaxMessageSizeTooBigError(opts ...ErrorOption) *ApiError {
×
1944
        eopts := parseOpts(opts)
×
1945
        if ae, ok := eopts.err.(*ApiError); ok {
×
1946
                return ae
×
1947
        }
×
1948

1949
        return ApiErrors[JSSourceMaxMessageSizeTooBigErr]
×
1950
}
1951

1952
// NewJSSourceMultipleFiltersNotAllowedError creates a new JSSourceMultipleFiltersNotAllowed error: "source with multiple subject transforms cannot also have a single subject filter"
1953
func NewJSSourceMultipleFiltersNotAllowedError(opts ...ErrorOption) *ApiError {
×
1954
        eopts := parseOpts(opts)
×
1955
        if ae, ok := eopts.err.(*ApiError); ok {
×
1956
                return ae
×
1957
        }
×
1958

1959
        return ApiErrors[JSSourceMultipleFiltersNotAllowed]
×
1960
}
1961

1962
// NewJSSourceOverlappingSubjectFiltersError creates a new JSSourceOverlappingSubjectFilters error: "source filters can not overlap"
1963
func NewJSSourceOverlappingSubjectFiltersError(opts ...ErrorOption) *ApiError {
×
1964
        eopts := parseOpts(opts)
×
1965
        if ae, ok := eopts.err.(*ApiError); ok {
×
1966
                return ae
×
1967
        }
×
1968

1969
        return ApiErrors[JSSourceOverlappingSubjectFilters]
×
1970
}
1971

1972
// NewJSStorageResourcesExceededError creates a new JSStorageResourcesExceededErr error: "insufficient storage resources available"
1973
func NewJSStorageResourcesExceededError(opts ...ErrorOption) *ApiError {
25✔
1974
        eopts := parseOpts(opts)
25✔
1975
        if ae, ok := eopts.err.(*ApiError); ok {
25✔
1976
                return ae
×
1977
        }
×
1978

1979
        return ApiErrors[JSStorageResourcesExceededErr]
25✔
1980
}
1981

1982
// NewJSStreamAssignmentError creates a new JSStreamAssignmentErrF error: "{err}"
1983
func NewJSStreamAssignmentError(err error, opts ...ErrorOption) *ApiError {
×
1984
        eopts := parseOpts(opts)
×
1985
        if ae, ok := eopts.err.(*ApiError); ok {
×
1986
                return ae
×
1987
        }
×
1988

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

1998
// NewJSStreamCreateError creates a new JSStreamCreateErrF error: "{err}"
1999
func NewJSStreamCreateError(err error, opts ...ErrorOption) *ApiError {
65✔
2000
        eopts := parseOpts(opts)
65✔
2001
        if ae, ok := eopts.err.(*ApiError); ok {
130✔
2002
                return ae
65✔
2003
        }
65✔
2004

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

2014
// NewJSStreamDeleteError creates a new JSStreamDeleteErrF error: "{err}"
2015
func NewJSStreamDeleteError(err error, opts ...ErrorOption) *ApiError {
×
2016
        eopts := parseOpts(opts)
×
2017
        if ae, ok := eopts.err.(*ApiError); ok {
×
2018
                return ae
×
2019
        }
×
2020

2021
        e := ApiErrors[JSStreamDeleteErrF]
×
2022
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2023
        return &ApiError{
×
2024
                Code:        e.Code,
×
2025
                ErrCode:     e.ErrCode,
×
2026
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2027
        }
×
2028
}
2029

2030
// NewJSStreamDuplicateMessageConflictError creates a new JSStreamDuplicateMessageConflict error: "duplicate message id is in process"
2031
func NewJSStreamDuplicateMessageConflictError(opts ...ErrorOption) *ApiError {
×
2032
        eopts := parseOpts(opts)
×
2033
        if ae, ok := eopts.err.(*ApiError); ok {
×
2034
                return ae
×
2035
        }
×
2036

2037
        return ApiErrors[JSStreamDuplicateMessageConflict]
×
2038
}
2039

2040
// NewJSStreamExpectedLastSeqPerSubjectNotReadyError creates a new JSStreamExpectedLastSeqPerSubjectNotReady error: "expected last sequence per subject temporarily unavailable"
2041
func NewJSStreamExpectedLastSeqPerSubjectNotReadyError(opts ...ErrorOption) *ApiError {
2✔
2042
        eopts := parseOpts(opts)
2✔
2043
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2044
                return ae
×
2045
        }
×
2046

2047
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectNotReady]
2✔
2048
}
2049

2050
// NewJSStreamExternalApiOverlapError creates a new JSStreamExternalApiOverlapErrF error: "stream external api prefix {prefix} must not overlap with {subject}"
2051
func NewJSStreamExternalApiOverlapError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
2✔
2052
        eopts := parseOpts(opts)
2✔
2053
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2054
                return ae
×
2055
        }
×
2056

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

2066
// NewJSStreamExternalDelPrefixOverlapsError creates a new JSStreamExternalDelPrefixOverlapsErrF error: "stream external delivery prefix {prefix} overlaps with stream subject {subject}"
2067
func NewJSStreamExternalDelPrefixOverlapsError(prefix interface{}, subject interface{}, opts ...ErrorOption) *ApiError {
×
2068
        eopts := parseOpts(opts)
×
2069
        if ae, ok := eopts.err.(*ApiError); ok {
×
2070
                return ae
×
2071
        }
×
2072

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

2082
// NewJSStreamGeneralError creates a new JSStreamGeneralErrorF error: "{err}"
2083
func NewJSStreamGeneralError(err error, opts ...ErrorOption) *ApiError {
3✔
2084
        eopts := parseOpts(opts)
3✔
2085
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2086
                return ae
×
2087
        }
×
2088

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

2098
// NewJSStreamHeaderExceedsMaximumError creates a new JSStreamHeaderExceedsMaximumErr error: "header size exceeds maximum allowed of 64k"
2099
func NewJSStreamHeaderExceedsMaximumError(opts ...ErrorOption) *ApiError {
1✔
2100
        eopts := parseOpts(opts)
1✔
2101
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2102
                return ae
×
2103
        }
×
2104

2105
        return ApiErrors[JSStreamHeaderExceedsMaximumErr]
1✔
2106
}
2107

2108
// NewJSStreamInfoMaxSubjectsError creates a new JSStreamInfoMaxSubjectsErr error: "subject details would exceed maximum allowed"
2109
func NewJSStreamInfoMaxSubjectsError(opts ...ErrorOption) *ApiError {
×
2110
        eopts := parseOpts(opts)
×
2111
        if ae, ok := eopts.err.(*ApiError); ok {
×
2112
                return ae
×
2113
        }
×
2114

2115
        return ApiErrors[JSStreamInfoMaxSubjectsErr]
×
2116
}
2117

2118
// NewJSStreamInvalidConfigError creates a new JSStreamInvalidConfigF error: "{err}"
2119
func NewJSStreamInvalidConfigError(err error, opts ...ErrorOption) *ApiError {
115✔
2120
        eopts := parseOpts(opts)
115✔
2121
        if ae, ok := eopts.err.(*ApiError); ok {
136✔
2122
                return ae
21✔
2123
        }
21✔
2124

2125
        e := ApiErrors[JSStreamInvalidConfigF]
94✔
2126
        args := e.toReplacerArgs([]interface{}{"{err}", err})
94✔
2127
        return &ApiError{
94✔
2128
                Code:        e.Code,
94✔
2129
                ErrCode:     e.ErrCode,
94✔
2130
                Description: strings.NewReplacer(args...).Replace(e.Description),
94✔
2131
        }
94✔
2132
}
2133

2134
// NewJSStreamInvalidError creates a new JSStreamInvalidErr error: "stream not valid"
2135
func NewJSStreamInvalidError(opts ...ErrorOption) *ApiError {
1✔
2136
        eopts := parseOpts(opts)
1✔
2137
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2138
                return ae
×
2139
        }
×
2140

2141
        return ApiErrors[JSStreamInvalidErr]
1✔
2142
}
2143

2144
// NewJSStreamInvalidExternalDeliverySubjError creates a new JSStreamInvalidExternalDeliverySubjErrF error: "stream external delivery prefix {prefix} must not contain wildcards"
2145
func NewJSStreamInvalidExternalDeliverySubjError(prefix interface{}, opts ...ErrorOption) *ApiError {
×
2146
        eopts := parseOpts(opts)
×
2147
        if ae, ok := eopts.err.(*ApiError); ok {
×
2148
                return ae
×
2149
        }
×
2150

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

2160
// NewJSStreamLimitsError creates a new JSStreamLimitsErrF error: "{err}"
2161
func NewJSStreamLimitsError(err error, opts ...ErrorOption) *ApiError {
8✔
2162
        eopts := parseOpts(opts)
8✔
2163
        if ae, ok := eopts.err.(*ApiError); ok {
16✔
2164
                return ae
8✔
2165
        }
8✔
2166

2167
        e := ApiErrors[JSStreamLimitsErrF]
×
2168
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2169
        return &ApiError{
×
2170
                Code:        e.Code,
×
2171
                ErrCode:     e.ErrCode,
×
2172
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2173
        }
×
2174
}
2175

2176
// NewJSStreamMaxBytesRequiredError creates a new JSStreamMaxBytesRequired error: "account requires a stream config to have max bytes set"
2177
func NewJSStreamMaxBytesRequiredError(opts ...ErrorOption) *ApiError {
3✔
2178
        eopts := parseOpts(opts)
3✔
2179
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2180
                return ae
×
2181
        }
×
2182

2183
        return ApiErrors[JSStreamMaxBytesRequired]
3✔
2184
}
2185

2186
// NewJSStreamMaxStreamBytesExceededError creates a new JSStreamMaxStreamBytesExceeded error: "stream max bytes exceeds account limit max stream bytes"
2187
func NewJSStreamMaxStreamBytesExceededError(opts ...ErrorOption) *ApiError {
2✔
2188
        eopts := parseOpts(opts)
2✔
2189
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2190
                return ae
×
2191
        }
×
2192

2193
        return ApiErrors[JSStreamMaxStreamBytesExceeded]
2✔
2194
}
2195

2196
// NewJSStreamMessageExceedsMaximumError creates a new JSStreamMessageExceedsMaximumErr error: "message size exceeds maximum allowed"
2197
func NewJSStreamMessageExceedsMaximumError(opts ...ErrorOption) *ApiError {
7✔
2198
        eopts := parseOpts(opts)
7✔
2199
        if ae, ok := eopts.err.(*ApiError); ok {
7✔
2200
                return ae
×
2201
        }
×
2202

2203
        return ApiErrors[JSStreamMessageExceedsMaximumErr]
7✔
2204
}
2205

2206
// NewJSStreamMirrorNotUpdatableError creates a new JSStreamMirrorNotUpdatableErr error: "stream mirror configuration can not be updated"
2207
func NewJSStreamMirrorNotUpdatableError(opts ...ErrorOption) *ApiError {
4✔
2208
        eopts := parseOpts(opts)
4✔
2209
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2210
                return ae
×
2211
        }
×
2212

2213
        return ApiErrors[JSStreamMirrorNotUpdatableErr]
4✔
2214
}
2215

2216
// NewJSStreamMismatchError creates a new JSStreamMismatchErr error: "stream name in subject does not match request"
2217
func NewJSStreamMismatchError(opts ...ErrorOption) *ApiError {
3✔
2218
        eopts := parseOpts(opts)
3✔
2219
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2220
                return ae
×
2221
        }
×
2222

2223
        return ApiErrors[JSStreamMismatchErr]
3✔
2224
}
2225

2226
// NewJSStreamMoveAndScaleError creates a new JSStreamMoveAndScaleErr error: "can not move and scale a stream in a single update"
2227
func NewJSStreamMoveAndScaleError(opts ...ErrorOption) *ApiError {
4✔
2228
        eopts := parseOpts(opts)
4✔
2229
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2230
                return ae
×
2231
        }
×
2232

2233
        return ApiErrors[JSStreamMoveAndScaleErr]
4✔
2234
}
2235

2236
// NewJSStreamMoveInProgressError creates a new JSStreamMoveInProgressF error: "stream move already in progress: {msg}"
2237
func NewJSStreamMoveInProgressError(msg interface{}, opts ...ErrorOption) *ApiError {
2✔
2238
        eopts := parseOpts(opts)
2✔
2239
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2240
                return ae
×
2241
        }
×
2242

2243
        e := ApiErrors[JSStreamMoveInProgressF]
2✔
2244
        args := e.toReplacerArgs([]interface{}{"{msg}", msg})
2✔
2245
        return &ApiError{
2✔
2246
                Code:        e.Code,
2✔
2247
                ErrCode:     e.ErrCode,
2✔
2248
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2249
        }
2✔
2250
}
2251

2252
// NewJSStreamMoveNotInProgressError creates a new JSStreamMoveNotInProgress error: "stream move not in progress"
2253
func NewJSStreamMoveNotInProgressError(opts ...ErrorOption) *ApiError {
×
2254
        eopts := parseOpts(opts)
×
2255
        if ae, ok := eopts.err.(*ApiError); ok {
×
2256
                return ae
×
2257
        }
×
2258

2259
        return ApiErrors[JSStreamMoveNotInProgress]
×
2260
}
2261

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

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

2278
// NewJSStreamNameContainsPathSeparatorsError creates a new JSStreamNameContainsPathSeparatorsErr error: "Stream name can not contain path separators"
2279
func NewJSStreamNameContainsPathSeparatorsError(opts ...ErrorOption) *ApiError {
6✔
2280
        eopts := parseOpts(opts)
6✔
2281
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
2282
                return ae
×
2283
        }
×
2284

2285
        return ApiErrors[JSStreamNameContainsPathSeparatorsErr]
6✔
2286
}
2287

2288
// NewJSStreamNameExistError creates a new JSStreamNameExistErr error: "stream name already in use with a different configuration"
2289
func NewJSStreamNameExistError(opts ...ErrorOption) *ApiError {
×
2290
        eopts := parseOpts(opts)
×
2291
        if ae, ok := eopts.err.(*ApiError); ok {
×
2292
                return ae
×
2293
        }
×
2294

2295
        return ApiErrors[JSStreamNameExistErr]
×
2296
}
2297

2298
// NewJSStreamNameExistRestoreFailedError creates a new JSStreamNameExistRestoreFailedErr error: "stream name already in use, cannot restore"
2299
func NewJSStreamNameExistRestoreFailedError(opts ...ErrorOption) *ApiError {
3✔
2300
        eopts := parseOpts(opts)
3✔
2301
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
2302
                return ae
×
2303
        }
×
2304

2305
        return ApiErrors[JSStreamNameExistRestoreFailedErr]
3✔
2306
}
2307

2308
// NewJSStreamNotFoundError creates a new JSStreamNotFoundErr error: "stream not found"
2309
func NewJSStreamNotFoundError(opts ...ErrorOption) *ApiError {
23,145✔
2310
        eopts := parseOpts(opts)
23,145✔
2311
        if ae, ok := eopts.err.(*ApiError); ok {
23,810✔
2312
                return ae
665✔
2313
        }
665✔
2314

2315
        return ApiErrors[JSStreamNotFoundErr]
22,480✔
2316
}
2317

2318
// NewJSStreamNotMatchError creates a new JSStreamNotMatchErr error: "expected stream does not match"
2319
func NewJSStreamNotMatchError(opts ...ErrorOption) *ApiError {
5✔
2320
        eopts := parseOpts(opts)
5✔
2321
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2322
                return ae
×
2323
        }
×
2324

2325
        return ApiErrors[JSStreamNotMatchErr]
5✔
2326
}
2327

2328
// NewJSStreamOfflineError creates a new JSStreamOfflineErr error: "stream is offline"
2329
func NewJSStreamOfflineError(opts ...ErrorOption) *ApiError {
2✔
2330
        eopts := parseOpts(opts)
2✔
2331
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2332
                return ae
×
2333
        }
×
2334

2335
        return ApiErrors[JSStreamOfflineErr]
2✔
2336
}
2337

2338
// NewJSStreamPurgeFailedError creates a new JSStreamPurgeFailedF error: "{err}"
2339
func NewJSStreamPurgeFailedError(err error, opts ...ErrorOption) *ApiError {
1✔
2340
        eopts := parseOpts(opts)
1✔
2341
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2342
                return ae
×
2343
        }
×
2344

2345
        e := ApiErrors[JSStreamPurgeFailedF]
1✔
2346
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2347
        return &ApiError{
1✔
2348
                Code:        e.Code,
1✔
2349
                ErrCode:     e.ErrCode,
1✔
2350
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2351
        }
1✔
2352
}
2353

2354
// NewJSStreamReplicasNotSupportedError creates a new JSStreamReplicasNotSupportedErr error: "replicas > 1 not supported in non-clustered mode"
2355
func NewJSStreamReplicasNotSupportedError(opts ...ErrorOption) *ApiError {
1✔
2356
        eopts := parseOpts(opts)
1✔
2357
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2358
                return ae
×
2359
        }
×
2360

2361
        return ApiErrors[JSStreamReplicasNotSupportedErr]
1✔
2362
}
2363

2364
// NewJSStreamReplicasNotUpdatableError creates a new JSStreamReplicasNotUpdatableErr error: "Replicas configuration can not be updated"
2365
func NewJSStreamReplicasNotUpdatableError(opts ...ErrorOption) *ApiError {
×
2366
        eopts := parseOpts(opts)
×
2367
        if ae, ok := eopts.err.(*ApiError); ok {
×
2368
                return ae
×
2369
        }
×
2370

2371
        return ApiErrors[JSStreamReplicasNotUpdatableErr]
×
2372
}
2373

2374
// NewJSStreamRestoreError creates a new JSStreamRestoreErrF error: "restore failed: {err}"
2375
func NewJSStreamRestoreError(err error, opts ...ErrorOption) *ApiError {
7✔
2376
        eopts := parseOpts(opts)
7✔
2377
        if ae, ok := eopts.err.(*ApiError); ok {
9✔
2378
                return ae
2✔
2379
        }
2✔
2380

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

2390
// NewJSStreamRollupFailedError creates a new JSStreamRollupFailedF error: "{err}"
2391
func NewJSStreamRollupFailedError(err error, opts ...ErrorOption) *ApiError {
8✔
2392
        eopts := parseOpts(opts)
8✔
2393
        if ae, ok := eopts.err.(*ApiError); ok {
8✔
2394
                return ae
×
2395
        }
×
2396

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

2406
// NewJSStreamSealedError creates a new JSStreamSealedErr error: "invalid operation on sealed stream"
2407
func NewJSStreamSealedError(opts ...ErrorOption) *ApiError {
10✔
2408
        eopts := parseOpts(opts)
10✔
2409
        if ae, ok := eopts.err.(*ApiError); ok {
10✔
2410
                return ae
×
2411
        }
×
2412

2413
        return ApiErrors[JSStreamSealedErr]
10✔
2414
}
2415

2416
// NewJSStreamSequenceNotMatchError creates a new JSStreamSequenceNotMatchErr error: "expected stream sequence does not match"
2417
func NewJSStreamSequenceNotMatchError(opts ...ErrorOption) *ApiError {
×
2418
        eopts := parseOpts(opts)
×
2419
        if ae, ok := eopts.err.(*ApiError); ok {
×
2420
                return ae
×
2421
        }
×
2422

2423
        return ApiErrors[JSStreamSequenceNotMatchErr]
×
2424
}
2425

2426
// NewJSStreamSnapshotError creates a new JSStreamSnapshotErrF error: "snapshot failed: {err}"
2427
func NewJSStreamSnapshotError(err error, opts ...ErrorOption) *ApiError {
×
2428
        eopts := parseOpts(opts)
×
2429
        if ae, ok := eopts.err.(*ApiError); ok {
×
2430
                return ae
×
2431
        }
×
2432

2433
        e := ApiErrors[JSStreamSnapshotErrF]
×
2434
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2435
        return &ApiError{
×
2436
                Code:        e.Code,
×
2437
                ErrCode:     e.ErrCode,
×
2438
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2439
        }
×
2440
}
2441

2442
// NewJSStreamStoreFailedError creates a new JSStreamStoreFailedF error: "{err}"
2443
func NewJSStreamStoreFailedError(err error, opts ...ErrorOption) *ApiError {
2,502✔
2444
        eopts := parseOpts(opts)
2,502✔
2445
        if ae, ok := eopts.err.(*ApiError); ok {
2,502✔
2446
                return ae
×
2447
        }
×
2448

2449
        e := ApiErrors[JSStreamStoreFailedF]
2,502✔
2450
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2,502✔
2451
        return &ApiError{
2,502✔
2452
                Code:        e.Code,
2,502✔
2453
                ErrCode:     e.ErrCode,
2,502✔
2454
                Description: strings.NewReplacer(args...).Replace(e.Description),
2,502✔
2455
        }
2,502✔
2456
}
2457

2458
// NewJSStreamSubjectOverlapError creates a new JSStreamSubjectOverlapErr error: "subjects overlap with an existing stream"
2459
func NewJSStreamSubjectOverlapError(opts ...ErrorOption) *ApiError {
39✔
2460
        eopts := parseOpts(opts)
39✔
2461
        if ae, ok := eopts.err.(*ApiError); ok {
39✔
2462
                return ae
×
2463
        }
×
2464

2465
        return ApiErrors[JSStreamSubjectOverlapErr]
39✔
2466
}
2467

2468
// NewJSStreamTemplateCreateError creates a new JSStreamTemplateCreateErrF error: "{err}"
2469
func NewJSStreamTemplateCreateError(err error, opts ...ErrorOption) *ApiError {
×
2470
        eopts := parseOpts(opts)
×
2471
        if ae, ok := eopts.err.(*ApiError); ok {
×
2472
                return ae
×
2473
        }
×
2474

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

2484
// NewJSStreamTemplateDeleteError creates a new JSStreamTemplateDeleteErrF error: "{err}"
2485
func NewJSStreamTemplateDeleteError(err error, opts ...ErrorOption) *ApiError {
1✔
2486
        eopts := parseOpts(opts)
1✔
2487
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2488
                return ae
1✔
2489
        }
1✔
2490

2491
        e := ApiErrors[JSStreamTemplateDeleteErrF]
×
2492
        args := e.toReplacerArgs([]interface{}{"{err}", err})
×
2493
        return &ApiError{
×
2494
                Code:        e.Code,
×
2495
                ErrCode:     e.ErrCode,
×
2496
                Description: strings.NewReplacer(args...).Replace(e.Description),
×
2497
        }
×
2498
}
2499

2500
// NewJSStreamTemplateNotFoundError creates a new JSStreamTemplateNotFoundErr error: "template not found"
2501
func NewJSStreamTemplateNotFoundError(opts ...ErrorOption) *ApiError {
4✔
2502
        eopts := parseOpts(opts)
4✔
2503
        if ae, ok := eopts.err.(*ApiError); ok {
4✔
2504
                return ae
×
2505
        }
×
2506

2507
        return ApiErrors[JSStreamTemplateNotFoundErr]
4✔
2508
}
2509

2510
// NewJSStreamTooManyRequestsError creates a new JSStreamTooManyRequests error: "too many requests"
2511
func NewJSStreamTooManyRequestsError(opts ...ErrorOption) *ApiError {
496✔
2512
        eopts := parseOpts(opts)
496✔
2513
        if ae, ok := eopts.err.(*ApiError); ok {
496✔
2514
                return ae
×
2515
        }
×
2516

2517
        return ApiErrors[JSStreamTooManyRequests]
496✔
2518
}
2519

2520
// NewJSStreamTransformInvalidDestinationError creates a new JSStreamTransformInvalidDestination error: "stream transform: {err}"
2521
func NewJSStreamTransformInvalidDestinationError(err error, opts ...ErrorOption) *ApiError {
1✔
2522
        eopts := parseOpts(opts)
1✔
2523
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2524
                return ae
×
2525
        }
×
2526

2527
        e := ApiErrors[JSStreamTransformInvalidDestination]
1✔
2528
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2529
        return &ApiError{
1✔
2530
                Code:        e.Code,
1✔
2531
                ErrCode:     e.ErrCode,
1✔
2532
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2533
        }
1✔
2534
}
2535

2536
// NewJSStreamTransformInvalidSourceError creates a new JSStreamTransformInvalidSource error: "stream transform source: {err}"
2537
func NewJSStreamTransformInvalidSourceError(err error, opts ...ErrorOption) *ApiError {
1✔
2538
        eopts := parseOpts(opts)
1✔
2539
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2540
                return ae
×
2541
        }
×
2542

2543
        e := ApiErrors[JSStreamTransformInvalidSource]
1✔
2544
        args := e.toReplacerArgs([]interface{}{"{err}", err})
1✔
2545
        return &ApiError{
1✔
2546
                Code:        e.Code,
1✔
2547
                ErrCode:     e.ErrCode,
1✔
2548
                Description: strings.NewReplacer(args...).Replace(e.Description),
1✔
2549
        }
1✔
2550
}
2551

2552
// NewJSStreamUpdateError creates a new JSStreamUpdateErrF error: "{err}"
2553
func NewJSStreamUpdateError(err error, opts ...ErrorOption) *ApiError {
20✔
2554
        eopts := parseOpts(opts)
20✔
2555
        if ae, ok := eopts.err.(*ApiError); ok {
34✔
2556
                return ae
14✔
2557
        }
14✔
2558

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

2568
// NewJSStreamWrongLastMsgIDError creates a new JSStreamWrongLastMsgIDErrF error: "wrong last msg ID: {id}"
2569
func NewJSStreamWrongLastMsgIDError(id interface{}, opts ...ErrorOption) *ApiError {
5✔
2570
        eopts := parseOpts(opts)
5✔
2571
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2572
                return ae
×
2573
        }
×
2574

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

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

2591
        return ApiErrors[JSStreamWrongLastSequenceConstantErr]
11✔
2592
}
2593

2594
// NewJSStreamWrongLastSequenceError creates a new JSStreamWrongLastSequenceErrF error: "wrong last sequence: {seq}"
2595
func NewJSStreamWrongLastSequenceError(seq uint64, opts ...ErrorOption) *ApiError {
57✔
2596
        eopts := parseOpts(opts)
57✔
2597
        if ae, ok := eopts.err.(*ApiError); ok {
57✔
2598
                return ae
×
2599
        }
×
2600

2601
        e := ApiErrors[JSStreamWrongLastSequenceErrF]
57✔
2602
        args := e.toReplacerArgs([]interface{}{"{seq}", seq})
57✔
2603
        return &ApiError{
57✔
2604
                Code:        e.Code,
57✔
2605
                ErrCode:     e.ErrCode,
57✔
2606
                Description: strings.NewReplacer(args...).Replace(e.Description),
57✔
2607
        }
57✔
2608
}
2609

2610
// NewJSTempStorageFailedError creates a new JSTempStorageFailedErr error: "JetStream unable to open temp storage for restore"
2611
func NewJSTempStorageFailedError(opts ...ErrorOption) *ApiError {
×
2612
        eopts := parseOpts(opts)
×
2613
        if ae, ok := eopts.err.(*ApiError); ok {
×
2614
                return ae
×
2615
        }
×
2616

2617
        return ApiErrors[JSTempStorageFailedErr]
×
2618
}
2619

2620
// NewJSTemplateNameNotMatchSubjectError creates a new JSTemplateNameNotMatchSubjectErr error: "template name in subject does not match request"
2621
func NewJSTemplateNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
1✔
2622
        eopts := parseOpts(opts)
1✔
2623
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2624
                return ae
×
2625
        }
×
2626

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