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

nats-io / nats-server / 12840970505

16 Jan 2025 11:17PM UTC coverage: 85.48% (-0.1%) from 85.602%
12840970505

push

github

web-flow
Update to Go 1.23.5/1.22.11 (#6379)

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

68595 of 80247 relevant lines covered (85.48%)

886670.64 hits per line

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

51.98
/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
        // JSStreamTransformInvalidDestination stream transform: {err}
480
        JSStreamTransformInvalidDestination ErrorIdentifier = 10156
481

482
        // JSStreamTransformInvalidSource stream transform source: {err}
483
        JSStreamTransformInvalidSource ErrorIdentifier = 10155
484

485
        // JSStreamUpdateErrF Generic stream update error string ({err})
486
        JSStreamUpdateErrF ErrorIdentifier = 10069
487

488
        // JSStreamWrongLastMsgIDErrF wrong last msg ID: {id}
489
        JSStreamWrongLastMsgIDErrF ErrorIdentifier = 10070
490

491
        // JSStreamWrongLastSequenceConstantErr wrong last sequence
492
        JSStreamWrongLastSequenceConstantErr ErrorIdentifier = 10164
493

494
        // JSStreamWrongLastSequenceErrF wrong last sequence: {seq}
495
        JSStreamWrongLastSequenceErrF ErrorIdentifier = 10071
496

497
        // JSTempStorageFailedErr JetStream unable to open temp storage for restore
498
        JSTempStorageFailedErr ErrorIdentifier = 10072
499

500
        // JSTemplateNameNotMatchSubjectErr template name in subject does not match request
501
        JSTemplateNameNotMatchSubjectErr ErrorIdentifier = 10073
502
)
503

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

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

703
        return ApiErrors[JSAccountResourcesExceededErr]
20,060✔
704
}
705

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

713
        return ApiErrors[JSBadRequestErr]
10✔
714
}
715

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

723
        return ApiErrors[JSClusterIncompleteErr]
×
724
}
725

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

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

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

749
        return ApiErrors[JSClusterNotActiveErr]
1✔
750
}
751

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

759
        return ApiErrors[JSClusterNotAssignedErr]
25✔
760
}
761

762
// NewJSClusterNotAvailError creates a new JSClusterNotAvailErr error: "JetStream system temporarily unavailable"
763
func NewJSClusterNotAvailError(opts ...ErrorOption) *ApiError {
12✔
764
        eopts := parseOpts(opts)
12✔
765
        if ae, ok := eopts.err.(*ApiError); ok {
12✔
766
                return ae
×
767
        }
×
768

769
        return ApiErrors[JSClusterNotAvailErr]
12✔
770
}
771

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

779
        return ApiErrors[JSClusterNotLeaderErr]
9✔
780
}
781

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

789
        return ApiErrors[JSClusterPeerNotMemberErr]
1✔
790
}
791

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

799
        return ApiErrors[JSClusterRequiredErr]
×
800
}
801

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

809
        return ApiErrors[JSClusterServerNotMemberErr]
3✔
810
}
811

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

819
        return ApiErrors[JSClusterTagsErr]
×
820
}
821

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

829
        return ApiErrors[JSClusterUnSupportFeatureErr]
6✔
830
}
831

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

839
        return ApiErrors[JSConsumerAlreadyExists]
5✔
840
}
841

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

849
        return ApiErrors[JSConsumerBadDurableNameErr]
×
850
}
851

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

859
        return ApiErrors[JSConsumerConfigRequiredErr]
2✔
860
}
861

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

869
        return ApiErrors[JSConsumerCreateDurableAndNameMismatch]
1✔
870
}
871

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

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

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

895
        return ApiErrors[JSConsumerCreateFilterSubjectMismatchErr]
2✔
896
}
897

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

905
        return ApiErrors[JSConsumerDeliverCycleErr]
4✔
906
}
907

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

915
        return ApiErrors[JSConsumerDeliverToWildcardsErr]
4✔
916
}
917

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

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

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

941
        return ApiErrors[JSConsumerDirectRequiresEphemeralErr]
×
942
}
943

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

951
        return ApiErrors[JSConsumerDirectRequiresPushErr]
×
952
}
953

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

961
        return ApiErrors[JSConsumerDoesNotExist]
3✔
962
}
963

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

971
        return ApiErrors[JSConsumerDuplicateFilterSubjects]
1✔
972
}
973

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

981
        return ApiErrors[JSConsumerDurableNameNotInSubjectErr]
×
982
}
983

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

991
        return ApiErrors[JSConsumerDurableNameNotMatchSubjectErr]
×
992
}
993

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

1001
        return ApiErrors[JSConsumerDurableNameNotSetErr]
1✔
1002
}
1003

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

1011
        return ApiErrors[JSConsumerEmptyFilter]
1✔
1012
}
1013

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

1021
        return ApiErrors[JSConsumerEmptyGroupName]
4✔
1022
}
1023

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

1031
        return ApiErrors[JSConsumerEphemeralWithDurableInSubjectErr]
×
1032
}
1033

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

1041
        return ApiErrors[JSConsumerEphemeralWithDurableNameErr]
3✔
1042
}
1043

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

1051
        return ApiErrors[JSConsumerExistingActiveErr]
×
1052
}
1053

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

1061
        return ApiErrors[JSConsumerFCRequiresPushErr]
×
1062
}
1063

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

1071
        return ApiErrors[JSConsumerFilterNotSubsetErr]
×
1072
}
1073

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

1081
        return ApiErrors[JSConsumerHBRequiresPushErr]
×
1082
}
1083

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

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

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

1107
        return ApiErrors[JSConsumerInvalidDeliverSubject]
2✔
1108
}
1109

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

1117
        return ApiErrors[JSConsumerInvalidGroupNameErr]
4✔
1118
}
1119

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

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

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

1143
        return ApiErrors[JSConsumerInvalidPriorityGroupErr]
2✔
1144
}
1145

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

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

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

1169
        return ApiErrors[JSConsumerMaxDeliverBackoffErr]
3✔
1170
}
1171

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

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

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

1195
        return ApiErrors[JSConsumerMaxPendingAckPolicyRequiredErr]
2✔
1196
}
1197

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

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

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

1221
        return ApiErrors[JSConsumerMaxRequestBatchNegativeErr]
×
1222
}
1223

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

1231
        return ApiErrors[JSConsumerMaxRequestExpiresToSmall]
×
1232
}
1233

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

1241
        return ApiErrors[JSConsumerMaxWaitingNegativeErr]
2✔
1242
}
1243

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

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

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

1267
        return ApiErrors[JSConsumerMultipleFiltersNotAllowed]
1✔
1268
}
1269

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

1277
        return ApiErrors[JSConsumerNameContainsPathSeparatorsErr]
8✔
1278
}
1279

1280
// NewJSConsumerNameExistError creates a new JSConsumerNameExistErr error: "consumer name already in use"
1281
func NewJSConsumerNameExistError(opts ...ErrorOption) *ApiError {
×
1282
        eopts := parseOpts(opts)
×
1283
        if ae, ok := eopts.err.(*ApiError); ok {
×
1284
                return ae
×
1285
        }
×
1286

1287
        return ApiErrors[JSConsumerNameExistErr]
×
1288
}
1289

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

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

1306
// NewJSConsumerNotFoundError creates a new JSConsumerNotFoundErr error: "consumer not found"
1307
func NewJSConsumerNotFoundError(opts ...ErrorOption) *ApiError {
2,770✔
1308
        eopts := parseOpts(opts)
2,770✔
1309
        if ae, ok := eopts.err.(*ApiError); ok {
2,770✔
1310
                return ae
×
1311
        }
×
1312

1313
        return ApiErrors[JSConsumerNotFoundErr]
2,770✔
1314
}
1315

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

1323
        return ApiErrors[JSConsumerOfflineErr]
2✔
1324
}
1325

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

1333
        return ApiErrors[JSConsumerOnMappedErr]
×
1334
}
1335

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

1343
        return ApiErrors[JSConsumerOverlappingSubjectFilters]
1✔
1344
}
1345

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

1353
        return ApiErrors[JSConsumerPriorityPolicyWithoutGroup]
4✔
1354
}
1355

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

1363
        return ApiErrors[JSConsumerPullNotDurableErr]
×
1364
}
1365

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

1373
        return ApiErrors[JSConsumerPullRequiresAckErr]
6✔
1374
}
1375

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

1383
        return ApiErrors[JSConsumerPullWithRateLimitErr]
1✔
1384
}
1385

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

1393
        return ApiErrors[JSConsumerPushMaxWaitingErr]
3✔
1394
}
1395

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

1403
        return ApiErrors[JSConsumerReplacementWithDifferentNameErr]
×
1404
}
1405

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

1413
        return ApiErrors[JSConsumerReplicasExceedsStream]
1✔
1414
}
1415

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

1423
        return ApiErrors[JSConsumerReplicasShouldMatchStream]
2✔
1424
}
1425

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

1433
        return ApiErrors[JSConsumerSmallHeartbeatErr]
1✔
1434
}
1435

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

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

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

1459
        return ApiErrors[JSConsumerWQConsumerNotDeliverAllErr]
×
1460
}
1461

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

1469
        return ApiErrors[JSConsumerWQConsumerNotUniqueErr]
11✔
1470
}
1471

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

1479
        return ApiErrors[JSConsumerWQMultipleUnfilteredErr]
2✔
1480
}
1481

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

1489
        return ApiErrors[JSConsumerWQRequiresExplicitAckErr]
×
1490
}
1491

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

1499
        return ApiErrors[JSConsumerWithFlowControlNeedsHeartbeats]
4✔
1500
}
1501

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

1509
        return ApiErrors[JSInsufficientResourcesErr]
10✔
1510
}
1511

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

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

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

1535
        return ApiErrors[JSMaximumConsumersLimitErr]
29✔
1536
}
1537

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

1545
        return ApiErrors[JSMaximumStreamsLimitErr]
16✔
1546
}
1547

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

1555
        return ApiErrors[JSMemoryResourcesExceededErr]
4✔
1556
}
1557

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

1565
        return ApiErrors[JSMessageTTLDisabledErr]
2✔
1566
}
1567

1568
// NewJSMessageTTLInvalidError creates a new JSMessageTTLInvalidErr error: "invalid per-message TTL"
1569
func NewJSMessageTTLInvalidError(opts ...ErrorOption) *ApiError {
6✔
1570
        eopts := parseOpts(opts)
6✔
1571
        if ae, ok := eopts.err.(*ApiError); ok {
6✔
1572
                return ae
×
1573
        }
×
1574

1575
        return ApiErrors[JSMessageTTLInvalidErr]
6✔
1576
}
1577

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

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

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

1601
        return ApiErrors[JSMirrorInvalidStreamName]
×
1602
}
1603

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

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

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

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

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

1643
        return ApiErrors[JSMirrorMaxMessageSizeTooBigErr]
×
1644
}
1645

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

1653
        return ApiErrors[JSMirrorMultipleFiltersNotAllowed]
1✔
1654
}
1655

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

1663
        return ApiErrors[JSMirrorOverlappingSubjectFilters]
2✔
1664
}
1665

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

1673
        return ApiErrors[JSMirrorWithFirstSeqErr]
2✔
1674
}
1675

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

1683
        return ApiErrors[JSMirrorWithSourcesErr]
×
1684
}
1685

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

1693
        return ApiErrors[JSMirrorWithStartSeqAndTimeErr]
×
1694
}
1695

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

1703
        return ApiErrors[JSMirrorWithSubjectFiltersErr]
×
1704
}
1705

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

1713
        return ApiErrors[JSMirrorWithSubjectsErr]
2✔
1714
}
1715

1716
// NewJSNoAccountError creates a new JSNoAccountErr error: "account not found"
1717
func NewJSNoAccountError(opts ...ErrorOption) *ApiError {
3✔
1718
        eopts := parseOpts(opts)
3✔
1719
        if ae, ok := eopts.err.(*ApiError); ok {
3✔
1720
                return ae
×
1721
        }
×
1722

1723
        return ApiErrors[JSNoAccountErr]
3✔
1724
}
1725

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

1733
        return ApiErrors[JSNoLimitsErr]
4✔
1734
}
1735

1736
// NewJSNoMessageFoundError creates a new JSNoMessageFoundErr error: "no message found"
1737
func NewJSNoMessageFoundError(opts ...ErrorOption) *ApiError {
391✔
1738
        eopts := parseOpts(opts)
391✔
1739
        if ae, ok := eopts.err.(*ApiError); ok {
391✔
1740
                return ae
×
1741
        }
×
1742

1743
        return ApiErrors[JSNoMessageFoundErr]
391✔
1744
}
1745

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

1753
        return ApiErrors[JSNotEmptyRequestErr]
3✔
1754
}
1755

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

1763
        return ApiErrors[JSNotEnabledErr]
10✔
1764
}
1765

1766
// NewJSNotEnabledForAccountError creates a new JSNotEnabledForAccountErr error: "JetStream not enabled for account"
1767
func NewJSNotEnabledForAccountError(opts ...ErrorOption) *ApiError {
363✔
1768
        eopts := parseOpts(opts)
363✔
1769
        if ae, ok := eopts.err.(*ApiError); ok {
363✔
1770
                return ae
×
1771
        }
×
1772

1773
        return ApiErrors[JSNotEnabledForAccountErr]
363✔
1774
}
1775

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

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

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

1799
        return ApiErrors[JSPeerRemapErr]
4✔
1800
}
1801

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

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

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

1825
        return ApiErrors[JSReplicasCountCannotBeNegative]
16✔
1826
}
1827

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

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

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

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

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

1867
        return ApiErrors[JSSnapshotDeliverSubjectInvalidErr]
1✔
1868
}
1869

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

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

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

1893
        return ApiErrors[JSSourceDuplicateDetected]
×
1894
}
1895

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

1903
        return ApiErrors[JSSourceInvalidStreamName]
1✔
1904
}
1905

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

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

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

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

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

1945
        return ApiErrors[JSSourceMaxMessageSizeTooBigErr]
×
1946
}
1947

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

1955
        return ApiErrors[JSSourceMultipleFiltersNotAllowed]
×
1956
}
1957

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

1965
        return ApiErrors[JSSourceOverlappingSubjectFilters]
×
1966
}
1967

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

1975
        return ApiErrors[JSStorageResourcesExceededErr]
25✔
1976
}
1977

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

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

1994
// NewJSStreamCreateError creates a new JSStreamCreateErrF error: "{err}"
1995
func NewJSStreamCreateError(err error, opts ...ErrorOption) *ApiError {
63✔
1996
        eopts := parseOpts(opts)
63✔
1997
        if ae, ok := eopts.err.(*ApiError); ok {
126✔
1998
                return ae
63✔
1999
        }
63✔
2000

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

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

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

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

2033
        return ApiErrors[JSStreamDuplicateMessageConflict]
×
2034
}
2035

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

2043
        return ApiErrors[JSStreamExpectedLastSeqPerSubjectNotReady]
2✔
2044
}
2045

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

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

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

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

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

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

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

2101
        return ApiErrors[JSStreamHeaderExceedsMaximumErr]
1✔
2102
}
2103

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

2111
        return ApiErrors[JSStreamInfoMaxSubjectsErr]
×
2112
}
2113

2114
// NewJSStreamInvalidConfigError creates a new JSStreamInvalidConfigF error: "{err}"
2115
func NewJSStreamInvalidConfigError(err error, opts ...ErrorOption) *ApiError {
114✔
2116
        eopts := parseOpts(opts)
114✔
2117
        if ae, ok := eopts.err.(*ApiError); ok {
135✔
2118
                return ae
21✔
2119
        }
21✔
2120

2121
        e := ApiErrors[JSStreamInvalidConfigF]
93✔
2122
        args := e.toReplacerArgs([]interface{}{"{err}", err})
93✔
2123
        return &ApiError{
93✔
2124
                Code:        e.Code,
93✔
2125
                ErrCode:     e.ErrCode,
93✔
2126
                Description: strings.NewReplacer(args...).Replace(e.Description),
93✔
2127
        }
93✔
2128
}
2129

2130
// NewJSStreamInvalidError creates a new JSStreamInvalidErr error: "stream not valid"
2131
func NewJSStreamInvalidError(opts ...ErrorOption) *ApiError {
×
2132
        eopts := parseOpts(opts)
×
2133
        if ae, ok := eopts.err.(*ApiError); ok {
×
2134
                return ae
×
2135
        }
×
2136

2137
        return ApiErrors[JSStreamInvalidErr]
×
2138
}
2139

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

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

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

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

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

2179
        return ApiErrors[JSStreamMaxBytesRequired]
3✔
2180
}
2181

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

2189
        return ApiErrors[JSStreamMaxStreamBytesExceeded]
2✔
2190
}
2191

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

2199
        return ApiErrors[JSStreamMessageExceedsMaximumErr]
7✔
2200
}
2201

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

2209
        return ApiErrors[JSStreamMirrorNotUpdatableErr]
4✔
2210
}
2211

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

2219
        return ApiErrors[JSStreamMismatchErr]
3✔
2220
}
2221

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

2229
        return ApiErrors[JSStreamMoveAndScaleErr]
4✔
2230
}
2231

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

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

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

2255
        return ApiErrors[JSStreamMoveNotInProgress]
×
2256
}
2257

2258
// NewJSStreamMsgDeleteFailedError creates a new JSStreamMsgDeleteFailedF error: "{err}"
2259
func NewJSStreamMsgDeleteFailedError(err error, opts ...ErrorOption) *ApiError {
2✔
2260
        eopts := parseOpts(opts)
2✔
2261
        if ae, ok := eopts.err.(*ApiError); ok {
2✔
2262
                return ae
×
2263
        }
×
2264

2265
        e := ApiErrors[JSStreamMsgDeleteFailedF]
2✔
2266
        args := e.toReplacerArgs([]interface{}{"{err}", err})
2✔
2267
        return &ApiError{
2✔
2268
                Code:        e.Code,
2✔
2269
                ErrCode:     e.ErrCode,
2✔
2270
                Description: strings.NewReplacer(args...).Replace(e.Description),
2✔
2271
        }
2✔
2272
}
2273

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

2281
        return ApiErrors[JSStreamNameContainsPathSeparatorsErr]
6✔
2282
}
2283

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

2291
        return ApiErrors[JSStreamNameExistErr]
×
2292
}
2293

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

2301
        return ApiErrors[JSStreamNameExistRestoreFailedErr]
3✔
2302
}
2303

2304
// NewJSStreamNotFoundError creates a new JSStreamNotFoundErr error: "stream not found"
2305
func NewJSStreamNotFoundError(opts ...ErrorOption) *ApiError {
23,097✔
2306
        eopts := parseOpts(opts)
23,097✔
2307
        if ae, ok := eopts.err.(*ApiError); ok {
23,763✔
2308
                return ae
666✔
2309
        }
666✔
2310

2311
        return ApiErrors[JSStreamNotFoundErr]
22,431✔
2312
}
2313

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

2321
        return ApiErrors[JSStreamNotMatchErr]
5✔
2322
}
2323

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

2331
        return ApiErrors[JSStreamOfflineErr]
2✔
2332
}
2333

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

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

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

2357
        return ApiErrors[JSStreamReplicasNotSupportedErr]
1✔
2358
}
2359

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

2367
        return ApiErrors[JSStreamReplicasNotUpdatableErr]
×
2368
}
2369

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

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

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

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

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

2409
        return ApiErrors[JSStreamSealedErr]
10✔
2410
}
2411

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

2419
        return ApiErrors[JSStreamSequenceNotMatchErr]
×
2420
}
2421

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

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

2438
// NewJSStreamStoreFailedError creates a new JSStreamStoreFailedF error: "{err}"
2439
func NewJSStreamStoreFailedError(err error, opts ...ErrorOption) *ApiError {
161,566✔
2440
        eopts := parseOpts(opts)
161,566✔
2441
        if ae, ok := eopts.err.(*ApiError); ok {
161,566✔
2442
                return ae
×
2443
        }
×
2444

2445
        e := ApiErrors[JSStreamStoreFailedF]
161,566✔
2446
        args := e.toReplacerArgs([]interface{}{"{err}", err})
161,566✔
2447
        return &ApiError{
161,566✔
2448
                Code:        e.Code,
161,566✔
2449
                ErrCode:     e.ErrCode,
161,566✔
2450
                Description: strings.NewReplacer(args...).Replace(e.Description),
161,566✔
2451
        }
161,566✔
2452
}
2453

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

2461
        return ApiErrors[JSStreamSubjectOverlapErr]
39✔
2462
}
2463

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

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

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

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

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

2503
        return ApiErrors[JSStreamTemplateNotFoundErr]
4✔
2504
}
2505

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

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

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

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

2538
// NewJSStreamUpdateError creates a new JSStreamUpdateErrF error: "{err}"
2539
func NewJSStreamUpdateError(err error, opts ...ErrorOption) *ApiError {
20✔
2540
        eopts := parseOpts(opts)
20✔
2541
        if ae, ok := eopts.err.(*ApiError); ok {
34✔
2542
                return ae
14✔
2543
        }
14✔
2544

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

2554
// NewJSStreamWrongLastMsgIDError creates a new JSStreamWrongLastMsgIDErrF error: "wrong last msg ID: {id}"
2555
func NewJSStreamWrongLastMsgIDError(id interface{}, opts ...ErrorOption) *ApiError {
5✔
2556
        eopts := parseOpts(opts)
5✔
2557
        if ae, ok := eopts.err.(*ApiError); ok {
5✔
2558
                return ae
×
2559
        }
×
2560

2561
        e := ApiErrors[JSStreamWrongLastMsgIDErrF]
5✔
2562
        args := e.toReplacerArgs([]interface{}{"{id}", id})
5✔
2563
        return &ApiError{
5✔
2564
                Code:        e.Code,
5✔
2565
                ErrCode:     e.ErrCode,
5✔
2566
                Description: strings.NewReplacer(args...).Replace(e.Description),
5✔
2567
        }
5✔
2568
}
2569

2570
// NewJSStreamWrongLastSequenceConstantError creates a new JSStreamWrongLastSequenceConstantErr error: "wrong last sequence"
2571
func NewJSStreamWrongLastSequenceConstantError(opts ...ErrorOption) *ApiError {
11✔
2572
        eopts := parseOpts(opts)
11✔
2573
        if ae, ok := eopts.err.(*ApiError); ok {
11✔
2574
                return ae
×
2575
        }
×
2576

2577
        return ApiErrors[JSStreamWrongLastSequenceConstantErr]
11✔
2578
}
2579

2580
// NewJSStreamWrongLastSequenceError creates a new JSStreamWrongLastSequenceErrF error: "wrong last sequence: {seq}"
2581
func NewJSStreamWrongLastSequenceError(seq uint64, opts ...ErrorOption) *ApiError {
57✔
2582
        eopts := parseOpts(opts)
57✔
2583
        if ae, ok := eopts.err.(*ApiError); ok {
57✔
2584
                return ae
×
2585
        }
×
2586

2587
        e := ApiErrors[JSStreamWrongLastSequenceErrF]
57✔
2588
        args := e.toReplacerArgs([]interface{}{"{seq}", seq})
57✔
2589
        return &ApiError{
57✔
2590
                Code:        e.Code,
57✔
2591
                ErrCode:     e.ErrCode,
57✔
2592
                Description: strings.NewReplacer(args...).Replace(e.Description),
57✔
2593
        }
57✔
2594
}
2595

2596
// NewJSTempStorageFailedError creates a new JSTempStorageFailedErr error: "JetStream unable to open temp storage for restore"
2597
func NewJSTempStorageFailedError(opts ...ErrorOption) *ApiError {
×
2598
        eopts := parseOpts(opts)
×
2599
        if ae, ok := eopts.err.(*ApiError); ok {
×
2600
                return ae
×
2601
        }
×
2602

2603
        return ApiErrors[JSTempStorageFailedErr]
×
2604
}
2605

2606
// NewJSTemplateNameNotMatchSubjectError creates a new JSTemplateNameNotMatchSubjectErr error: "template name in subject does not match request"
2607
func NewJSTemplateNameNotMatchSubjectError(opts ...ErrorOption) *ApiError {
1✔
2608
        eopts := parseOpts(opts)
1✔
2609
        if ae, ok := eopts.err.(*ApiError); ok {
1✔
2610
                return ae
×
2611
        }
×
2612

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