feat(batch5): implement jetstream error constructors group08
This commit is contained in:
@@ -119,6 +119,17 @@ simple_methods=(
|
||||
"NewJSNotEnabledForAccountError|NotEnabledForAccount"
|
||||
"NewJSReplicasCountCannotBeNegativeError|ReplicasCountCannotBeNegative"
|
||||
"NewJSRequiredApiLevelError|RequiredApiLevel"
|
||||
"NewJSSnapshotDeliverSubjectInvalidError|SnapshotDeliverSubjectInvalid"
|
||||
"NewJSSourceDuplicateDetectedError|SourceDuplicateDetected"
|
||||
"NewJSSourceInvalidStreamNameError|SourceInvalidStreamName"
|
||||
"NewJSSourceMaxMessageSizeTooBigError|SourceMaxMessageSizeTooBig"
|
||||
"NewJSSourceMultipleFiltersNotAllowedError|SourceMultipleFiltersNotAllowed"
|
||||
"NewJSSourceOverlappingSubjectFiltersError|SourceOverlappingSubjectFilters"
|
||||
"NewJSSourceWithMsgSchedulesError|SourceWithMsgSchedules"
|
||||
"NewJSStorageResourcesExceededError|StorageResourcesExceeded"
|
||||
"NewJSStreamDuplicateMessageConflictError|StreamDuplicateMessageConflict"
|
||||
"NewJSStreamExpectedLastSeqPerSubjectInvalidError|StreamExpectedLastSeqPerSubjectInvalid"
|
||||
"NewJSStreamExpectedLastSeqPerSubjectNotReadyError|StreamExpectedLastSeqPerSubjectNotReady"
|
||||
)
|
||||
|
||||
templated_methods=(
|
||||
@@ -143,6 +154,18 @@ templated_methods=(
|
||||
"NewJSMirrorInvalidTransformDestinationError|Exception|err|MirrorInvalidTransformDestination|{err}"
|
||||
"NewJSPedanticError|Exception|err|Pedantic|{err}"
|
||||
"NewJSRaftGeneralError|Exception|err|RaftGeneralErr|{err}"
|
||||
"NewJSSequenceNotFoundError|ulong|seq|SequenceNotFound|{seq}"
|
||||
"NewJSSourceConsumerSetupFailedError|Exception|err|SourceConsumerSetupFailed|{err}"
|
||||
"NewJSSourceInvalidSubjectFilterError|Exception|err|SourceInvalidSubjectFilter|{err}"
|
||||
"NewJSSourceInvalidTransformDestinationError|Exception|err|SourceInvalidTransformDestination|{err}"
|
||||
"NewJSStreamAssignmentError|Exception|err|StreamAssignment|{err}"
|
||||
"NewJSStreamCreateError|Exception|err|StreamCreate|{err}"
|
||||
"NewJSStreamDeleteError|Exception|err|StreamDelete|{err}"
|
||||
)
|
||||
|
||||
templated_methods_two_args=(
|
||||
"NewJSStreamExternalApiOverlapError|object?|prefix|object?|subject|StreamExternalApiOverlap|{prefix}|{subject}"
|
||||
"NewJSStreamExternalDelPrefixOverlapsError|object?|prefix|object?|subject|StreamExternalDelPrefixOverlaps|{prefix}|{subject}"
|
||||
)
|
||||
|
||||
{
|
||||
@@ -184,6 +207,20 @@ EOF
|
||||
return NewWithTags(${field}, "${placeholder}", ${arg_name});
|
||||
}
|
||||
|
||||
EOF
|
||||
done
|
||||
|
||||
for entry in "${templated_methods_two_args[@]}"; do
|
||||
IFS='|' read -r method arg1_type arg1_name arg2_type arg2_name field placeholder1 placeholder2 <<<"$entry"
|
||||
cat <<EOF
|
||||
public static JsApiError ${method}(${arg1_type} ${arg1_name}, ${arg2_type} ${arg2_name}, params ErrorOption[] opts)
|
||||
{
|
||||
if (ParseOpts(opts) is JsApiError overridden)
|
||||
return Clone(overridden);
|
||||
|
||||
return NewWithTags(${field}, "${placeholder1}", ${arg1_name}, "${placeholder2}", ${arg2_name});
|
||||
}
|
||||
|
||||
EOF
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user