94 symbols from @neontechspace/fluxerly
Functions#
describeError #
Describe any error as readable multi-line text: Its name, SDK code, message, suggested fix, safe details and cause chain, with the members of an AggregateError under it
Works for SDK errors, application errors, thrown non-Error values and Effect Causes, and never throws. A Cause is described reason by reason, as Failure, Defect or Interrupted, so pass exit.cause directly rather than squashing it first
Credential patterns, such as Authorization, Cookie and X-API-Key values, bare bot tokens, a value after a name ending in token, secret, password, passwd or API key, written as api_key, apiKey or X-API-Key, token-shaped Bot or Bearer values, values under credential keys of a thrown object, webhook URL tokens and the user information of a URL, such as user:password in https://
A client's own configured token is masked only in that client's log records and failure reports. Use it to print a failed Result, an SdkDefect or a FailureReport's error
describeError(
error: unknown,
options?: DescribeErrorOptions
): stringdescribeError(
error: unknown,
options?: DescribeErrorOptions
): stringParameters
error-
unknown optionsoptional-
DescribeErrorOptions
- Returns
string
import { createClient, describeError, orThrow } from "@neontechspace/fluxerly"
try {
await using client = createClient({ token: process.env.FLUXER_BOT_TOKEN })
orThrow(await client.run())
}
catch (error) {
// Configuration errors, connection failures and SDK defects all print with their cause chain
console.error(describeError(error))
}
import { createClient, describeError, orThrow } from "@neontechspace/fluxerly"
try {
await using client = createClient({ token: process.env.FLUXER_BOT_TOKEN })
orThrow(await client.run())
} catch (error) {
// Configuration errors, connection failures and SDK defects all print with their cause chain
console.error(describeError(error))
}
orThrow #
Return the value of an Ok result, or throw the error of an Err result
Use it where a failure should end the surrounding function, such as a command handler whose thrown error is reported with the command name, or a startup script that should stop with the SDK's message and hint. The thrown value is the operation's own error, so its message, hint, code and cause remain available
orThrow<T, E>(result: Result<T, E>): TorThrow<T, E>(
result: Result<T, E>
): TParameters
result-
Result<T, E>
- Returns
T
A ResultAsync, or any promise of a Result, returns a Promise that resolves with the value or rejects with the error.
Keep checking isErr() where the application must recover from a particular failure instead
import { orThrow } from "@neontechspace/fluxerly"
export async function greet(client, channelId) {
const message = orThrow(await client.messages.send(channelId, { content: "Hello" }))
return orThrow(client.messages.edit(message, { content: "Hello again" }))
}
import { orThrow, type Client } from "@neontechspace/fluxerly"
export async function greet(client: Client, channelId: string) {
const message = orThrow(await client.messages.send(channelId, { content: "Hello" }))
return orThrow(client.messages.edit(message, { content: "Hello again" }))
}
Wait for a ResultAsync, or any promise of a Result, and resolve with its value or reject with its error
orThrow<T, E>(result: PromiseLike<Result<T, E>>): Promise<T>orThrow<T, E>(
result: PromiseLike<Result<T, E>>
): Promise<T>Parameters
result-
PromiseLike<Result<T, E>>
- Returns
Promise<T>
Variables#
errors#
Error helpers that classify and match errors through apiCode, isNotFound, isRetryable, retryAfterMs, outcome and match
To print an error, use describeError
const errors: ErrorToolsimport { describeError, errors } from "@neontechspace/fluxerly"
export async function sendWithOneRetry(client, channelId) {
let sent = await client.messages.send(channelId, { content: "Hello" })
if (sent.isErr() && errors.isRetryable(sent.error))
sent = await client.messages.send(channelId, { content: "Hello" })
if (sent.isErr() && errors.isNotFound(sent.error, "channel"))
return console.warn("The channel was not found")
if (sent.isErr() && errors.apiCode(sent.error) === "missingPermissions")
return console.warn("The bot cannot post here")
if (sent.isErr() && errors.outcome(sent.error) === "rejected")
return console.warn("Fluxer refused the message", describeError(sent.error))
if (sent.isErr() && errors.outcome(sent.error) !== "notDispatched")
return console.warn("The message may have been sent, so check the channel before sending it again")
// Only a request that was not dispatched is safe to send again
if (sent.isErr())
errors.match(sent.error, {
MessageError: (error) => console.warn("The message was not sent", error.reason),
_: (error) => console.error(describeError(error)),
})
}
import { describeError, errors, type Client } from "@neontechspace/fluxerly"
export async function sendWithOneRetry(client: Client, channelId: string) {
let sent = await client.messages.send(channelId, { content: "Hello" })
if (sent.isErr() && errors.isRetryable(sent.error)) sent = await client.messages.send(channelId, { content: "Hello" })
if (sent.isErr() && errors.isNotFound(sent.error, "channel")) return console.warn("The channel was not found")
if (sent.isErr() && errors.apiCode(sent.error) === "missingPermissions") return console.warn("The bot cannot post here")
if (sent.isErr() && errors.outcome(sent.error) === "rejected")
return console.warn("Fluxer refused the message", describeError(sent.error))
if (sent.isErr() && errors.outcome(sent.error) !== "notDispatched")
return console.warn("The message may have been sent, so check the channel before sending it again")
// Only a request that was not dispatched is safe to send again
if (sent.isErr())
errors.match(sent.error, {
MessageError: (error) => console.warn("The message was not sent", error.reason),
_: (error) => console.error(describeError(error)),
})
}
Classes#
ApplicationError - An application callback invoked by the SDK failed, threw or rejected
AssetUrl Error - The SDK could not make an asset URL from the supplied input
AttachmentDownload Error - Expected bounded attachment-download failure, without a URL, response body or credential
AttachmentRefresh Error - The SDK could not refresh one ordered batch of attachment URL strings
AuthenticationError - Fluxer rejected the bot token during connection startup or recovery
BotApplication Operation Error - The SDK could not read the current bot application
CancelledError - A default API operation was cancelled through its signal
ChannelOperation Error - Expected failure when reading or changing community channels, threads and forum tags
ClientBusy Error - A competing connection operation already owns the client, so this call did not take ownership
ClientClosed Error - The client is permanently closing or closed, so reconnecting requires a new client
CollectorError - Expected collector failure, separate from results that stop at the count, deadline, idle deadline or explicit stop
ConfigurationError - A client setting or operation option is invalid before the requested work starts
ConnectionError - Instance discovery or the gateway connection failed
ConnectionTimeout Error - Gateway startup or explicit instance discovery exceeded its time budget
CountOperation Error - A fresh gateway-count call could not return its complete result
CriticalWorker Stopped Error - One of the bot's event or command subscriptions ended while its client was still running
EventOverflow Error - An event subscription stopped because unread events exceeded its count or byte limit
EventRead Busy Error - A second next call tried to read while the same default API pull subscription already had a pending read
EventWait Error - A filtered event wait ended without a match or could not use its synchronous filter
FluxerlyError - Base class for every error the SDK returns, throws or reports, in both entry points
GatewaySend Error - Why
gateway.senddid not hand a command to the shard's connection GuildOperation Error - Expected failure from guild, member, role and related resource operations
HelperError - A helper could not use its input
MemberChunk Error - A member stream stopped before it could return every batch
MessageCleanup Error - A cleanup preview or deletion failed, with selected IDs and batch progress where available
MessageError - A send, reply or forward ended without confirming that Fluxer created the message
MessageOperation Error - A message lookup, read or change failed
OAuthOperation Error - An OAuth call failed an input check, reached a local capacity limit, or failed during its request or response
PaginationError - Reading multiple pages failed because of invalid settings, a page limit, a stalled cursor or search readiness
PresenceError - The SDK rejected a status update or member-presence selection before changing its saved settings
RateLimit Error - Discovery HTTP or the gateway imposed a connection rate limit
RestRequest Error - Expected failure of
client.rest.request SdkDefect - An unexpected fault thrown or rejected by the default API instead of returned as a typed error result
ShardConnection Error - A configured gateway shard failed startup or permanently lost its established connection
SupervisorChild Error - Child-helper failure because the parent's message channel is unavailable or carries invalid coordination data
SupervisorError - Parent-process lifecycle failure, not the child's original client or configuration error
UserOperation Error - Expected failure from account reads or private-conversation operations
WebhookOperation Error - An expected failure while managing a webhook or one of its messages
Interfaces#
ApiErrorDetail #
Safe details about a Fluxer API rejection, available in an operation error's apiError field
The code is the SDK's category. The providerCode is the exact server code that the SDK recognizes. The explanation is fixed SDK text, not the server's message or text to show directly to users
If the SDK does not recognize the server code, apiError is null rather than containing unreviewed text, and the error's details.providerCode names the unrecognized code when it is an uppercase code of at most 64 characters. For form errors, validationErrors contains at most 32 validation codes with their field paths, without messages or rejected values
These details never contain the response body, localized message, rejected value or private caller data. Responses from presigned upload destinations do not receive this classification
interface ApiErrorDetailFor code missingPermissions, the operation error's details lists the permissions that Fluxer checks for the failed operation, as keys of Permissions such as ViewChannel, and the error's hint names them. Fluxer does not report which one is missing, so the bot may already have some of them
The list covers the operation's usual path, and the hint adds other checks behind the same rejection, such as role hierarchy or a permission that only some inputs need
Other rejections, rest.request and operations whose checks depend on data the SDK does not have, such as who created an emoji, carry no details and keep a general hint
export function formatApiErrorDetail(detail) {
// Branch on the category, which groups related server codes such as every resource limit
if (detail.code === "resourceLimit")
return `Limit reached: ${detail.explanation}`
const fields = detail.validationErrors?.map((error) => error.path ?? error.providerCode) ?? []
return `${detail.providerCode}: ${detail.explanation}${fields.length > 0 ? ` (${fields.join(", ")})` : ""}`
}
import type { ApiErrorDetail } from "@neontechspace/fluxerly"
export function formatApiErrorDetail(detail: ApiErrorDetail): string {
// Branch on the category, which groups related server codes such as every resource limit
if (detail.code === "resourceLimit") return `Limit reached: ${detail.explanation}`
const fields = detail.validationErrors?.map((error) => error.path ?? error.providerCode) ?? []
return `${detail.providerCode}: ${detail.explanation}${fields.length > 0 ? ` (${fields.join(", ")})` : ""}`
}
code#-
Stable SDK category for this recognized rejection
Several Fluxer codes can share one category
ApiErrorCode explanation#-
Fixed SDK explanation, never Fluxer's localized response text
string provider#Code -
Exact recognized Fluxer server code
ApiProviderCode validationoptional#Errors -
Present only when code is
invalidFormBodyHolds at most 32 validation codes with field paths, without Fluxer messages or rejected values
readonly ApiValidationErrorDetail[]
ApiValidationErrorDetail #
A validation error reported by Fluxer, with a fixed SDK explanation
This is a server rejection, not a problem found by local input checks. It includes the rejected field path when Fluxer supplied one, but never the rejected value or localized server message
interface ApiValidationErrorDetailexplanation#-
Fixed SDK explanation of the validation code
string pathoptional#-
Request field path that Fluxer rejected, such as embeds.0.title, when supplied in a plain dotted form
string provider#Code -
Fluxer validation code
A code this SDK version does not recognize is kept when it is an uppercase code of at most 64 characters, with a generic explanation, so its field path is not lost. An empty string when Fluxer named the field without a code
string & { … } | ApiValidationCode
DescribeErrorOptions #
Settings for describeError
interface DescribeErrorOptionsstackoptional#-
Include stack frames for each error in the cause chain
Defaults to true. Consecutive frames inside the SDK and Effect collapse into one line, and expected SDK errors other than
ConfigurationErrorandSdkDefectprint no frames, because their stacks only show SDK internalsboolean
ErrorTools #
Helpers for inspecting SDK errors in either entry point
interface ErrorToolsapi#Code -
The recognized Fluxer rejection category of an operation error, such as
"missingPermissions", read from itsapiErrorReturns undefined for any other value, including cancellation, closed clients, invalid input and rejections Fluxer did not describe with a recognized code, so one condition works on every error of an operation's Result
(error: unknown) => ApiErrorCode | undefined(error: unknown) => ApiErrorCode | undefined is#Not Found -
Whether the value is an SDK error for an HTTP
404, such as a deleted channel or a member who leftFluxer answers UNKNOWN_CHANNEL for a missing channel and also for message and reaction requests in a thread from a bot that is no longer in the community. Other requests from such a bot get a 403
missingPermissions, so a 404 does not tell why a resource is missingThe check reads the error's HTTP status, so it also holds for a 404 that an operation reports with reason rejected, such as
messages.sendto a missing channel. Pass a resource, such as"member", to also require that Fluxer named that resource as the missing one, which separates a missing member from a missing guildA thread counts as a
"channel". A 404 without a recognized Fluxer code is true without a resource and false with one. Returns false for any other value, so one condition works on every error of an operation's ResultThrows
HelperErrorwith operationerrors.isNotFoundand reason resource for a resource that is not aNotFoundResource, which is a defect in the native API. A 404 does not prove that an earlier deletion succeeded(error: unknown, resource?: NotFoundResource) => boolean( error: unknown, resource?: NotFoundResource ) => boolean is#Retryable -
Whether repeating the same call is safe and may succeed, such as after a rate limit, full local capacity, or a network failure or timeout of a read or of a write that was not sent
A write whose outcome is unknown is not retryable, because Fluxer may already have applied it. Rejections, invalid input, cancellation and closed clients are never retryable, because a closed client cannot send again and a new client is needed. A failed cleanup is never retryable, because its plan works only once
A rate-limited upload that read an attachment from a ReadableStream, marked by
details.streamUsed, is not retryable, because the stream is used up. Send it again with a new stream or with the file as bytes. A retryable failure from run needs a new client, because run always closes the client when it endsCreate a new client and call run on it instead of repeating run on the same client. An Effect Cause, such as that of a failed Exit, is retryable only when it has at least one reason and every reason is a retryable failure
A defect, an interruption or an empty Cause gives false, because the work may have stopped part-way. Concurrent
forEachand all can drop the reasons of siblings they interrupt, as described for outcome, so for several concurrent writes check each item's own result rather than the combined Cause(error: unknown) => boolean match#-
Call the handler named by the error's _tag, or the _ fallback, and return its result
Returns undefined when no handler applies
<E, R>(error: E, handlers: ErrorMatchHandlers<E, R>) => R | undefined<E, R>( error: E, handlers: ErrorMatchHandlers<E, R> ) => R | undefined outcome#-
Whether the failed request may have reached Fluxer:
"notDispatched"when it was not sent,"rejected"when Fluxer refused it and"unknown"when the result is uncertain, such as a write whose response was lostAn unknown write may already have applied, so check remote state before repeating it. Only
"notDispatched"shows that a write was not sent. Treat every other value, including undefined, as a write that may have applied, and reconcile before sending it againReads the outcome of an SDK error, including a closed client's, and for an Effect Cause the least certain outcome of its failures, where unknown outranks rejected and rejected outranks
notDispatched. A Cause covers only the failures it keptEffect's concurrent
forEachand all drop the reasons of siblings that they interrupt, so for several concurrent writes check each item's own result, such as with{ mode: "result" }orEffect.result, instead of the combined Cause. Returns undefined when the SDK cannot establish an outcome, so the caller applies its own policyThat holds for errors without an outcome, such as
CancelledError,SdkDefect, collector and gateway failures and non-SDK values, and for a Cause that is empty or holds a defect, an interruption or a failure without an outcome. For a multi-step operation the outcome covers the failed step, not the steps before itThe preparation steps of a message send, namely opening a direct message and uploading attachments, count as not sent for the message, so a closure during them reports
"notDispatched"for the message request even if the earlier step took effectWrapping an SDK call in
Effect.timeoutyields only a TimeoutError, which has no outcome, so pass the operation'stimeoutMsoption instead to keep it. A default-APICancelledErrorcarries no outcome either(error: unknown) => OperationOutcome | undefined(error: unknown) => OperationOutcome | undefined retry#After Ms -
How many milliseconds to wait before repeating the call, as Fluxer or the SDK's own rate limiting requires
It reads the error's
retryAfterMs, which every operation error andRateLimitErrorcarries when the wait is known. For aShardConnectionErrorit is the wait of the failure that stopped the shardFor an Effect Cause it is the longest wait among its failures, which covers all of them, and defects and interruptions in the Cause are ignored. Returns undefined when there is no usable wait, including for a value that is not an SDK error, so the caller can use its own backoff. It never throws
It does not say whether repeating the call is safe, so check
isRetryabletoo(error: unknown) => number | undefined
FluxerlyErrorJson #
The JSON form of an SDK error, produced by toJSON
Credential patterns are masked in error names and messages, including summarized causes. SDK codes remain fixed identifiers
interface FluxerlyErrorJson_tag#-
Error class discriminator, such as
GuildOperationErrorstring causeoptional#-
Summary of the underlying cause, when one was retained
| FluxerlyErrorJson | { readonly cause?: FluxerlyErrorJson | { readonly name: string; readonly message: string; readonly cause?: FluxerlyErrorJson | ... | undefined; } | undefined readonly message: string readonly name: string }| FluxerlyErrorJson | { readonly cause?: FluxerlyErrorJson | { readonly name: string; readonly message: string; readonly cause?: FluxerlyErrorJson | ... | undefined; } | undefined readonly message: string readonly name: string } code#-
Stable dotted failure code
string details#-
Safe structured facts about the failure
Readonly<Record<string, unknown>> hintoptional#-
Actionable next step, when available
string message#-
Human-readable message
string name#-
Error name, normally equal to _tag
string
FluxerlyErrorOptions #
Settings shared by SDK error constructors
interface FluxerlyErrorOptionscauseoptional#-
Underlying failure, exposed as the standard ES2022 cause property
unknown code#-
Stable dotted identifier for this failure, such as
configurationor.invalid guild.rateLimitstring detailsoptional#-
Safe structured facts about the failure, without credentials or private payloads
Readonly<Record<string, unknown>> hintoptional#-
Actionable next step for a person reading the error, when the SDK can suggest one
string
InputValidationDetail #
Describes why the SDK rejected an input without keeping the rejected value
Read this detail from an operation error's inputValidation field when it is non-null. The path names the input field, constraint names the rule, and explanation describes what the SDK accepts. The SDK reports the first failure it can describe, not every invalid field. Paths and explanations are SDK-authored, with no rejected values or provider responses
Every operation input, query and options object rejects keys it does not support before sending, with constraint allowedFields. The explanation names the key when it is a short identifier, such as a misspelled field name, suggests the closest supported key and lists the supported keys
Write application-specific user-facing messages rather than displaying this diagnostic as application copy
interface InputValidationDetailexport function readInputValidation(error) {
return error._tag === "MessageOperationError" ? error.inputValidation : null
}
import type { InputValidationDetail, MessageOperationFailure } from "@neontechspace/fluxerly"
export function readInputValidation(error: MessageOperationFailure): InputValidationDetail | null {
return error._tag === "MessageOperationError" ? error.inputValidation : null
}
constraint#-
Kind of rule the input failed, suitable for application-specific error handling
InputValidationConstraint explanation#-
Fixed SDK explanation of the accepted input, not the rejected value or ready-made application text
string path#-
Field or input path the SDK identified as invalid, without copying arbitrary caller keys
string
MessageCleanupFailureMetadata #
Expected batch failure details included in a failed progress notification
Contains SDK-owned classifications, not message bodies, filter details or raw provider response text
interface MessageCleanupFailureMetadataapi#Error -
Safe Fluxer rejection classification, or null, excluding raw response text and provider field paths
ApiErrorDetail | null outcome#-
What is known about dispatch: Not sent, definitively rejected, or uncertain
MessageCleanupOutcome reason#-
Classified cause of the failure, such as invalid input, closure, rejection or deadline expiry
MessageCleanupErrorReason retry#After Ms -
Retry delay reported by Fluxer in milliseconds, or null
This does not establish that retrying is safe
number | null status#-
Known HTTP status, or null when none is available
number | null
OperationErrorOptions #
Constructor settings shared by resource operation errors, such as GuildOperationError and Message
interface OperationErrorOptions<
Operation extends string,
Reason extends string = OperationReason
>interface OperationErrorOptions<
Operation extends string,
Reason extends string
= OperationReason
>apioptional#Error -
Safe classification of a Fluxer rejection
Defaults to null
ApiErrorDetail | null causeoptional#-
Underlying failure retained as the error's cause
unknown inputoptional#Validation -
Safe explanation of locally invalid input
Defaults to null
InputValidationDetail | null operation#-
The failed step
Operation outcome#-
Whether the request may have reached Fluxer
OperationOutcome provideroptional#Code -
Fluxer error code that this SDK version does not recognize, recorded as
details.providerCodeand named in the messageKept only when
apiErroris null and the code is an uppercase code of at most 64 characters. Defaults to nullstring | null readoptional#-
Whether the failed request only read data, so even an unknown outcome cannot have changed remote state
A read is recorded as
details.readand keeps network and timeout failures retryable. Defaults to falseboolean reason#-
Failure category
Reason responseoptional#Field -
For reason response, the response field path or named check that failed, such as type or
channelMismatchRecorded as
detailsand named in the message. Defaults to null.response Field string | null retryoptional#After Ms -
Usable server-required retry wait in milliseconds
Defaults to null
number | null statusoptional#-
HTTP status when available
Defaults to null
number | null streamoptional#Used -
Whether a rate-limited upload read an attachment from a ReadableStream, which cannot be read again
Recorded as
details.streamUsed. It makeserrors.isRetryablefalse, because repeating the same call would send the used stream. Send again with a new stream or with the file as bytes. Defaults to falseboolean
Type Aliases#
ApiErrorCode #
Stable SDK category of a recognized Fluxer API rejection, read from ApiErrorDetail.code
Branch on this rather than on providerCode when several server codes mean the same thing, such as every resource limit. Announcement, follow, channel conversion and publishing preconditions have distinct categories. Publishing and published-message editing limits are separate from the general rateLimited category
Thread state, forum tag and webhook post preconditions also have distinct categories, while the thread, tag and pinned-post limits join resourceLimit and a missing forum tag or thread member joins unknownResource. The name cannot comes from Fluxer's code. Fluxer sends it for system messages, not webhooks
type ApiErrorCode =
| "missingAccess" | "missingPermissions"
| "communicationDisabled" | "cannotSendMessagesToUser"
| "cannotSendEmptyMessage" | "cannotModifySystemWebhook"
| "announcementChannelRequired" | "channelAlreadyFollowed"
| "channelHasFollowedChannels"
| "channelTypeConversionNotSupported"
| "followTargetContentWarningRequired"
| "followTargetNotAgeRestricted" | "invalidFollowTargetChannel"
| "messageAlreadyCrossposted" | "messageNotCrosspostable"
| "messageCrosspostRateLimited"
| "publishedMessageEditRateLimited" | "invalidChannelType"
| "channelHasThreads" | "threadAlreadyCreated"
| "threadArchived" | "threadLocked" | "forumTagNamesNotUnique"
| "forumTagRequired" | "noTagsAvailable"
| "mediaChannelRequired" | "webhookForumTargetRequired"
| "webhookThreadNameRequiresForum" | "captchaRequired"
| "invalidCaptcha" | "invalidFormBody" | "unknownResource"
| "missingOAuthScope" | "cannotEditOtherUserMessage"
| "cannotSendMessagesInNonTextChannel" | "contentBlocked"
| "directMessagesDisabled" | "explicitContentCannotBeSent"
| "fileSizeTooLarge" | "featureTemporarilyDisabled"
| "slowmodeRateLimited" | "guildVerificationRequired"
| "twoFactorRequired" | "botAlreadyInGuild" | "botIsPrivate"
| "notBotApplication" | "applicationNotOwned" | "resourceLocked"
| "accessDenied" | "badRequest" | "conflict" | "forbidden"
| "notFound" | "rateLimited" | "serviceUnavailable"
| "unauthorized" | "gone" | "serviceFailure" | "notImplemented"
| "cannotExecuteOnDirectMessage" | "invitesDisabled"
| "featureNotAvailableSelfHosted" | "userNotInVoice"
| "nsfwContentAgeRestricted" | "singleCommunityCannotLeave"
| "discoveryDisabled" | "discoveryInsufficientMembers"
| "discoveryAlreadyApplied" | "discoveryApplicationNotFound"
| "discoveryApplicationAlreadyReviewed" | "resourceLimit"type ApiErrorCode =
| "missingAccess"
| "missingPermissions"
| "communicationDisabled"
| "cannotSendMessagesToUser"
| "cannotSendEmptyMessage"
| "cannotModifySystemWebhook"
| "announcementChannelRequired"
| "channelAlreadyFollowed"
| "channelHasFollowedChannels"
| "channelTypeConversionNotSupported"
| "followTargetContentWarningRequired"
| "followTargetNotAgeRestricted"
| "invalidFollowTargetChannel"
| "messageAlreadyCrossposted"
| "messageNotCrosspostable"
| "messageCrosspostRateLimited"
| "publishedMessageEditRateLimited"
| "invalidChannelType"
| "channelHasThreads"
| "threadAlreadyCreated"
| "threadArchived"
| "threadLocked"
| "forumTagNamesNotUnique"
| "forumTagRequired"
| "noTagsAvailable"
| "mediaChannelRequired"
| "webhookForumTargetRequired"
| "webhookThreadNameRequiresForum"
| "captchaRequired"
| "invalidCaptcha"
| "invalidFormBody"
| "unknownResource"
| "missingOAuthScope"
| "cannotEditOtherUserMessage"
| "cannotSendMessagesInNonTextChannel"
| "contentBlocked"
| "directMessagesDisabled"
| "explicitContentCannotBeSent"
| "fileSizeTooLarge"
| "featureTemporarilyDisabled"
| "slowmodeRateLimited"
| "guildVerificationRequired"
| "twoFactorRequired"
| "botAlreadyInGuild"
| "botIsPrivate"
| "notBotApplication"
| "applicationNotOwned"
| "resourceLocked"
| "accessDenied" | "badRequest"
| "conflict" | "forbidden"
| "notFound" | "rateLimited"
| "serviceUnavailable"
| "unauthorized" | "gone"
| "serviceFailure"
| "notImplemented"
| "cannotExecuteOnDirectMessage"
| "invitesDisabled"
| "featureNotAvailableSelfHosted"
| "userNotInVoice"
| "nsfwContentAgeRestricted"
| "singleCommunityCannotLeave"
| "discoveryDisabled"
| "discoveryInsufficientMembers"
| "discoveryAlreadyApplied"
| "discoveryApplicationNotFound"
| "discoveryApplicationAlreadyReviewed"
| "resourceLimit"ApiProviderCode #
Exact Fluxer server code that the SDK recognizes, read from Api
An unrecognized server code produces no ApiErrorDetail
type ApiProviderCode =
| "MISSING_ACCESS" | "MISSING_PERMISSIONS"
| "COMMUNICATION_DISABLED" | "CANNOT_SEND_MESSAGES_TO_USER"
| "CANNOT_SEND_EMPTY_MESSAGE" | "CANNOT_MODIFY_SYSTEM_WEBHOOK"
| "ANNOUNCEMENT_CHANNEL_REQUIRED" | "CHANNEL_ALREADY_FOLLOWED"
| "CHANNEL_HAS_FOLLOWED_CHANNELS"
| "CHANNEL_TYPE_CONVERSION_NOT_SUPPORTED"
| "FOLLOW_TARGET_CONTENT_WARNING_REQUIRED"
| "FOLLOW_TARGET_NOT_AGE_RESTRICTED"
| "INVALID_FOLLOW_TARGET_CHANNEL"
| "MESSAGE_ALREADY_CROSSPOSTED" | "MESSAGE_NOT_CROSSPOSTABLE"
| "MESSAGE_CROSSPOST_RATE_LIMITED"
| "PUBLISHED_MESSAGE_EDIT_RATE_LIMITED" | "INVALID_CHANNEL_TYPE"
| "CHANNEL_HAS_THREADS" | "THREAD_ALREADY_CREATED_FOR_MESSAGE"
| "THREAD_ARCHIVED" | "THREAD_LOCKED"
| "FORUM_TAG_NAMES_MUST_BE_UNIQUE" | "FORUM_TAG_REQUIRED"
| "NO_TAGS_AVAILABLE_TO_NON_MODERATORS"
| "HIDE_MEDIA_DOWNLOAD_OPTION_MEDIA_ONLY"
| "WEBHOOK_FORUM_TARGET_REQUIRED"
| "WEBHOOK_THREAD_NAME_REQUIRES_FORUM" | "CAPTCHA_REQUIRED"
| "INVALID_CAPTCHA" | "INVALID_FORM_BODY" | "VALIDATION_ERROR"
| "UNKNOWN_APPLICATION" | "UNKNOWN_CHANNEL" | "UNKNOWN_EMOJI"
| "UNKNOWN_FORUM_TAG" | "UNKNOWN_GUILD" | "UNKNOWN_INVITE"
| "UNKNOWN_MEMBER" | "UNKNOWN_MESSAGE" | "UNKNOWN_ROLE"
| "UNKNOWN_STICKER" | "UNKNOWN_THREAD_MEMBER" | "UNKNOWN_USER"
| "UNKNOWN_WEBHOOK" | "MISSING_OAUTH_SCOPE"
| "CANNOT_EDIT_OTHER_USER_MESSAGE"
| "CANNOT_SEND_MESSAGES_IN_NON_TEXT_CHANNEL" | "CONTENT_BLOCKED"
| "DIRECT_MESSAGES_DISABLED" | "EXPLICIT_CONTENT_CANNOT_BE_SENT"
| "FILE_SIZE_TOO_LARGE" | "FEATURE_TEMPORARILY_DISABLED"
| "SLOWMODE_RATE_LIMITED" | "GUILD_VERIFICATION_REQUIRED"
| "GUILD_EMAIL_VERIFICATION_REQUIRED" | "TWO_FACTOR_REQUIRED"
| "BOT_ALREADY_IN_GUILD" | "BOT_IS_PRIVATE"
| "NOT_A_BOT_APPLICATION" | "APPLICATION_NOT_OWNED"
| "RESOURCE_LOCKED" | "ACCESS_DENIED" | "BAD_REQUEST"
| "CONFLICT" | "FORBIDDEN" | "NOT_FOUND" | "RATE_LIMITED"
| "SERVICE_UNAVAILABLE" | "UNAUTHORIZED" | "INVALID_TOKEN"
| "MISSING_AUTHORIZATION" | "GONE" | "BAD_GATEWAY"
| "GATEWAY_TIMEOUT" | "INTERNAL_SERVER_ERROR"
| "NOT_IMPLEMENTED" | "CANNOT_EXECUTE_ON_DM"
| "INVITES_DISABLED" | "FEATURE_NOT_AVAILABLE_SELF_HOSTED"
| "USER_NOT_IN_VOICE" | "NSFW_CONTENT_AGE_RESTRICTED"
| "SINGLE_COMMUNITY_CANNOT_LEAVE" | "DISCOVERY_DISABLED"
| "DISCOVERY_INSUFFICIENT_MEMBERS" | "DISCOVERY_ALREADY_APPLIED"
| "DISCOVERY_APPLICATION_NOT_FOUND"
| "DISCOVERY_APPLICATION_ALREADY_REVIEWED"
| "MAX_ACTIVE_THREADS" | "MAX_CATEGORY_CHANNELS" | "MAX_EMOJIS"
| "MAX_FORUM_TAGS" | "MAX_GUILD_CHANNELS" | "MAX_GUILD_MEMBERS"
| "MAX_GUILD_ROLES" | "MAX_INVITES"
| "MAX_PINNED_THREADS_IN_FORUM" | "MAX_REACTIONS"
| "MAX_STICKERS" | "MAX_THREAD_MEMBERS"
| "MAX_WEBHOOKS_PER_CHANNEL" | "MAX_WEBHOOKS_PER_GUILD"type ApiProviderCode =
| "MISSING_ACCESS"
| "MISSING_PERMISSIONS"
| "COMMUNICATION_DISABLED"
| "CANNOT_SEND_MESSAGES_TO_USER"
| "CANNOT_SEND_EMPTY_MESSAGE"
| "CANNOT_MODIFY_SYSTEM_WEBHOOK"
| "ANNOUNCEMENT_CHANNEL_REQUIRED"
| "CHANNEL_ALREADY_FOLLOWED"
| "CHANNEL_HAS_FOLLOWED_CHANNELS"
| "CHANNEL_TYPE_CONVERSION_NOT_SUPPORTED"
| "FOLLOW_TARGET_CONTENT_WARNING_REQUIRED"
| "FOLLOW_TARGET_NOT_AGE_RESTRICTED"
| "INVALID_FOLLOW_TARGET_CHANNEL"
| "MESSAGE_ALREADY_CROSSPOSTED"
| "MESSAGE_NOT_CROSSPOSTABLE"
| "MESSAGE_CROSSPOST_RATE_LIMITED"
| "PUBLISHED_MESSAGE_EDIT_RATE_LIMITED"
| "INVALID_CHANNEL_TYPE"
| "CHANNEL_HAS_THREADS"
| "THREAD_ALREADY_CREATED_FOR_MESSAGE"
| "THREAD_ARCHIVED"
| "THREAD_LOCKED"
| "FORUM_TAG_NAMES_MUST_BE_UNIQUE"
| "FORUM_TAG_REQUIRED"
| "NO_TAGS_AVAILABLE_TO_NON_MODERATORS"
| "HIDE_MEDIA_DOWNLOAD_OPTION_MEDIA_ONLY"
| "WEBHOOK_FORUM_TARGET_REQUIRED"
| "WEBHOOK_THREAD_NAME_REQUIRES_FORUM"
| "CAPTCHA_REQUIRED"
| "INVALID_CAPTCHA"
| "INVALID_FORM_BODY"
| "VALIDATION_ERROR"
| "UNKNOWN_APPLICATION"
| "UNKNOWN_CHANNEL"
| "UNKNOWN_EMOJI"
| "UNKNOWN_FORUM_TAG"
| "UNKNOWN_GUILD"
| "UNKNOWN_INVITE"
| "UNKNOWN_MEMBER"
| "UNKNOWN_MESSAGE"
| "UNKNOWN_ROLE"
| "UNKNOWN_STICKER"
| "UNKNOWN_THREAD_MEMBER"
| "UNKNOWN_USER"
| "UNKNOWN_WEBHOOK"
| "MISSING_OAUTH_SCOPE"
| "CANNOT_EDIT_OTHER_USER_MESSAGE"
| "CANNOT_SEND_MESSAGES_IN_NON_TEXT_CHANNEL"
| "CONTENT_BLOCKED"
| "DIRECT_MESSAGES_DISABLED"
| "EXPLICIT_CONTENT_CANNOT_BE_SENT"
| "FILE_SIZE_TOO_LARGE"
| "FEATURE_TEMPORARILY_DISABLED"
| "SLOWMODE_RATE_LIMITED"
| "GUILD_VERIFICATION_REQUIRED"
| "GUILD_EMAIL_VERIFICATION_REQUIRED"
| "TWO_FACTOR_REQUIRED"
| "BOT_ALREADY_IN_GUILD"
| "BOT_IS_PRIVATE"
| "NOT_A_BOT_APPLICATION"
| "APPLICATION_NOT_OWNED"
| "RESOURCE_LOCKED"
| "ACCESS_DENIED"
| "BAD_REQUEST" | "CONFLICT"
| "FORBIDDEN" | "NOT_FOUND"
| "RATE_LIMITED"
| "SERVICE_UNAVAILABLE"
| "UNAUTHORIZED"
| "INVALID_TOKEN"
| "MISSING_AUTHORIZATION"
| "GONE" | "BAD_GATEWAY"
| "GATEWAY_TIMEOUT"
| "INTERNAL_SERVER_ERROR"
| "NOT_IMPLEMENTED"
| "CANNOT_EXECUTE_ON_DM"
| "INVITES_DISABLED"
| "FEATURE_NOT_AVAILABLE_SELF_HOSTED"
| "USER_NOT_IN_VOICE"
| "NSFW_CONTENT_AGE_RESTRICTED"
| "SINGLE_COMMUNITY_CANNOT_LEAVE"
| "DISCOVERY_DISABLED"
| "DISCOVERY_INSUFFICIENT_MEMBERS"
| "DISCOVERY_ALREADY_APPLIED"
| "DISCOVERY_APPLICATION_NOT_FOUND"
| "DISCOVERY_APPLICATION_ALREADY_REVIEWED"
| "MAX_ACTIVE_THREADS"
| "MAX_CATEGORY_CHANNELS"
| "MAX_EMOJIS"
| "MAX_FORUM_TAGS"
| "MAX_GUILD_CHANNELS"
| "MAX_GUILD_MEMBERS"
| "MAX_GUILD_ROLES"
| "MAX_INVITES"
| "MAX_PINNED_THREADS_IN_FORUM"
| "MAX_REACTIONS"
| "MAX_STICKERS"
| "MAX_THREAD_MEMBERS"
| "MAX_WEBHOOKS_PER_CHANNEL"
| "MAX_WEBHOOKS_PER_GUILD"ApiValidationCode #
Exact Fluxer validation code that the SDK recognizes, read from Api
An unrecognized validation code stays in validationErrors with a generic explanation when it has a safe code shape
type ApiValidationCode =
| "ATTACHMENTS_NOT_ALLOWED_FOR_MESSAGE"
| "CANNOT_DELETE_MORE_THAN_100_MESSAGES"
| "CANNOT_SEND_EMPTY_MESSAGE"
| "CANNOT_SPECIFY_BOTH_BEFORE_AND_AFTER"
| "CONTENT_EXCEEDS_MAX_LENGTH"
| "DUPLICATE_ATTACHMENT_IDS_NOT_ALLOWED"
| "DUPLICATE_FILE_INDEX" | "EMBEDS_EXCEED_MAX_CHARACTERS"
| "FILE_INDEX_EXCEEDS_MAXIMUM" | "INVALID_AUDIT_LOG_REASON"
| "INVALID_FORMAT" | "INVALID_MESSAGE_DATA"
| "INVALID_SNOWFLAKE" | "INVALID_SNOWFLAKE_FORMAT"
| "INVALID_URL_FORMAT" | "MESSAGE_IDS_CANNOT_BE_EMPTY"
| "STRING_LENGTH_INVALID" | "TOO_MANY_EMBEDS" | "TOO_MANY_FILES"
| "TOO_LARGE" | "ATTACHMENT_FIELDS_REQUIRED"
| "INVALID_TIMEOUT_VALUE" | "TIMEOUT_CANNOT_EXCEED_365_DAYS"
| "RECIPIENT_IDS_CANNOT_BE_EMPTY"
| "DUPLICATE_RECIPIENTS_NOT_ALLOWED"
| "VANITY_URL_CODE_ALREADY_TAKEN"
| "VANITY_URL_CODE_LENGTH_INVALID"
| "VANITY_URL_INVALID_CHARACTERS"
| "VOICE_MESSAGES_ATTACHMENT_MUST_BE_AUDIO"
| "VOICE_MESSAGES_ATTACHMENT_WAVEFORM_REQUIRED"
| "VOICE_MESSAGES_ATTACHMENT_DURATION_REQUIRED"
| "VOICE_MESSAGES_CANNOT_HAVE_CONTENT"
| "VOICE_MESSAGES_CANNOT_HAVE_EMBEDS"
| "VOICE_MESSAGES_CANNOT_HAVE_FAVORITE_MEMES"
| "VOICE_MESSAGES_CANNOT_HAVE_STICKERS"
| "VOICE_MESSAGES_DURATION_EXCEEDS_LIMIT"
| "VOICE_MESSAGES_REQUIRE_SINGLE_ATTACHMENT"type ApiValidationCode =
| "ATTACHMENTS_NOT_ALLOWED_FOR_MESSAGE"
| "CANNOT_DELETE_MORE_THAN_100_MESSAGES"
| "CANNOT_SEND_EMPTY_MESSAGE"
| "CANNOT_SPECIFY_BOTH_BEFORE_AND_AFTER"
| "CONTENT_EXCEEDS_MAX_LENGTH"
| "DUPLICATE_ATTACHMENT_IDS_NOT_ALLOWED"
| "DUPLICATE_FILE_INDEX"
| "EMBEDS_EXCEED_MAX_CHARACTERS"
| "FILE_INDEX_EXCEEDS_MAXIMUM"
| "INVALID_AUDIT_LOG_REASON"
| "INVALID_FORMAT"
| "INVALID_MESSAGE_DATA"
| "INVALID_SNOWFLAKE"
| "INVALID_SNOWFLAKE_FORMAT"
| "INVALID_URL_FORMAT"
| "MESSAGE_IDS_CANNOT_BE_EMPTY"
| "STRING_LENGTH_INVALID"
| "TOO_MANY_EMBEDS"
| "TOO_MANY_FILES"
| "TOO_LARGE"
| "ATTACHMENT_FIELDS_REQUIRED"
| "INVALID_TIMEOUT_VALUE"
| "TIMEOUT_CANNOT_EXCEED_365_DAYS"
| "RECIPIENT_IDS_CANNOT_BE_EMPTY"
| "DUPLICATE_RECIPIENTS_NOT_ALLOWED"
| "VANITY_URL_CODE_ALREADY_TAKEN"
| "VANITY_URL_CODE_LENGTH_INVALID"
| "VANITY_URL_INVALID_CHARACTERS"
| "VOICE_MESSAGES_ATTACHMENT_MUST_BE_AUDIO"
| "VOICE_MESSAGES_ATTACHMENT_WAVEFORM_REQUIRED"
| "VOICE_MESSAGES_ATTACHMENT_DURATION_REQUIRED"
| "VOICE_MESSAGES_CANNOT_HAVE_CONTENT"
| "VOICE_MESSAGES_CANNOT_HAVE_EMBEDS"
| "VOICE_MESSAGES_CANNOT_HAVE_FAVORITE_MEMES"
| "VOICE_MESSAGES_CANNOT_HAVE_STICKERS"
| "VOICE_MESSAGES_DURATION_EXCEEDS_LIMIT"
| "VOICE_MESSAGES_REQUIRE_SINGLE_ATTACHMENT"AttachmentDownloadFailure #
Expected attachment-download failures shared by both entry points
Cancellation in the default API adds CancelledError
type AttachmentDownloadFailure =
AttachmentDownloadError | ClientClosedErrortype AttachmentDownloadFailure =
| AttachmentDownloadError
| ClientClosedErrorAttachmentRefreshFailure #
Expected attachment URL refresh failures shared by both entry points
Native interruption remains in the Effect cause, while default API calls additionally return CancelledError
type AttachmentRefreshFailure =
AttachmentRefreshError | ClientClosedErrortype AttachmentRefreshFailure =
| AttachmentRefreshError
| ClientClosedErrorAttachmentRefreshOperation #
Attachment URL refresh operation identified by safe failure metadata
type AttachmentRefreshOperation = "attachments.refreshUrls"type AttachmentRefreshOperation =
"attachments.refreshUrls"BotApplicationOperation #
Operation name included in application-read failures
type BotApplicationOperation = "application.fetch"type BotApplicationOperation =
"application.fetch"BotApplicationOperationFailure #
Expected application-read failures in both APIs
The Effect API reports interruption in its Cause. The default API can also return CancelledError
type BotApplicationOperationFailure =
BotApplicationOperationError | ClientClosedErrortype BotApplicationOperationFailure =
| BotApplicationOperationError
| ClientClosedErrorChannelOperation #
type ChannelOperation =
| "channels.get" | "channels.fetch" | "channels.fetchAll"
| "channels.follow" | "channels.fetchFollowerStats"
| "channels.create" | "channels.edit" | "channels.delete"
| "channels.reorder" | "channels.setPermissionOverwrite"
| "channels.removePermissionOverwrite"
| "channels.createForumTag" | "channels.editForumTag"
| "channels.deleteForumTag" | "threads.create"
| "threads.createFromMessage" | "threads.createPost"
| "threads.edit" | "threads.fetchActive"
| "threads.fetchArchived" | "threads.search"
| "threads.fetchPostData" | "threads.join" | "threads.leave"
| "threads.addMember" | "threads.removeMember"
| "threads.fetchMember" | "threads.fetchMembers"type ChannelOperation =
| "channels.get"
| "channels.fetch"
| "channels.fetchAll"
| "channels.follow"
| "channels.fetchFollowerStats"
| "channels.create"
| "channels.edit"
| "channels.delete"
| "channels.reorder"
| "channels.setPermissionOverwrite"
| "channels.removePermissionOverwrite"
| "channels.createForumTag"
| "channels.editForumTag"
| "channels.deleteForumTag"
| "threads.create"
| "threads.createFromMessage"
| "threads.createPost"
| "threads.edit"
| "threads.fetchActive"
| "threads.fetchArchived"
| "threads.search"
| "threads.fetchPostData"
| "threads.join"
| "threads.leave"
| "threads.addMember"
| "threads.removeMember"
| "threads.fetchMember"
| "threads.fetchMembers"ChannelOperationFailure #
Native interruption is outside this union, with default API methods additionally returning CancelledError
type ChannelOperationFailure =
ChannelOperationError | ClientClosedErrortype ChannelOperationFailure =
| ChannelOperationError
| ClientClosedErrorCollectorFailure #
Expected terminal failures shared by both API styles
Collection in the default API can additionally return CancelledError. Native interruption remains in the Effect Cause, outside this union
type CollectorFailure = CollectorError | ClientClosedErrortype CollectorFailure =
| CollectorError
| ClientClosedErrorConnectError #
Expected connect and run failures, with default API methods adding CancelledError to their result union
type ConnectError =
ConnectionFailure | ClientBusyError | ClientClosedErrortype ConnectError =
| ConnectionFailure
| ClientBusyError
| ClientClosedErrorConnectionFailure #
Expected startup or terminal connection failures, excluding cancellation and SDK defects
type ConnectionFailure =
| AuthenticationError | ConnectionError | ConnectionTimeoutError
| RateLimitError | ShardConnectionErrortype ConnectionFailure =
| AuthenticationError
| ConnectionError
| ConnectionTimeoutError
| RateLimitError
| ShardConnectionErrorCountOperation #
The guild or channel count request named in an error
One call can send commands to several local shards but occupies one shared request slot and does not cache counts
type CountOperation =
"guilds.fetchCounts" | "channels.fetchMemberCounts"type CountOperation =
| "guilds.fetchCounts"
| "channels.fetchMemberCounts"CountOperationFailure #
Expected fresh-count failure
Native interruption and cancellation in the default API remain separate from this union
type CountOperationFailure = CountOperationError | ClientClosedErrortype CountOperationFailure =
| CountOperationError
| ClientClosedErrorDefectReason #
Details of what caused an SdkDefect in the default API
Failure holds an expected SDK error, Defect holds an unexpected fault with its original value, and Interruption marks cancellation. More than one entry can describe both the original failure and a cleanup fault. Effect reports an expected failure that occurs together with a fault as a fault too, so that failure appears as a Defect entry holding the expected SDK error
type DefectReason =
| {
readonly failure:
| ConnectError | ConfigurationError | EventReadError
| EventWaitError | MessageError
| MessageOperationError | MessageCleanupError
| GuildOperationError | ChannelOperationError
| WebhookOperationError | UserOperationError
| BotApplicationOperationError | OAuthOperationError
| CountOperationError | MemberChunkError
| PresenceError | PaginationError | CollectorError
| AttachmentDownloadFailure | AttachmentRefreshFailure
| SupervisorError | SupervisorChildError
| CancelledError | CriticalWorkerStoppedError
readonly kind: "Failure"
}
| {
readonly defect: unknown
readonly kind: "Defect"
readonly origin: "application" | "sdk"
}
| { readonly kind: "Interruption" }type DefectReason =
| {
readonly failure:
| ConnectError
| ConfigurationError
| EventReadError
| EventWaitError
| MessageError
| MessageOperationError
| MessageCleanupError
| GuildOperationError
| ChannelOperationError
| WebhookOperationError
| UserOperationError
| BotApplicationOperationError
| OAuthOperationError
| CountOperationError
| MemberChunkError
| PresenceError
| PaginationError
| CollectorError
| AttachmentDownloadFailure
| AttachmentRefreshFailure
| SupervisorError
| SupervisorChildError
| CancelledError
| CriticalWorkerStoppedError
readonly kind: "Failure"
}
| {
readonly defect: unknown
readonly kind: "Defect"
readonly origin:
| "application" | "sdk"
}
| {
readonly kind:
"Interruption"
}ErrorMatchHandlers #
Handlers for errors.match, keyed by each possible error's _tag, plus an optional _ fallback
type ErrorMatchHandlers<E, R> =
& {
readonly [K in E extends { readonly _tag: string }
? E["_tag"]
: never]?:
(error: Extract<E, { readonly _tag: K }>) => R
}
& { readonly _?: (error: unknown) => R }type ErrorMatchHandlers<E, R> =
& {
readonly [K in E extends {
readonly _tag: string
}
? E["_tag"]
: never]?:
(
error: Extract<
E,
{ readonly _tag: K }
>
) => R
}
& {
readonly _?: (
error: unknown
) => R
}EventReadError #
Expected subscription-read failures from queue overflow or a competing pending read
Default API calls add CancelledError, while native interruption remains in the Effect cause
type EventReadError = EventOverflowError | EventReadBusyErrortype EventReadError =
| EventOverflowError
| EventReadBusyErrorEventWaitFailure #
Expected filtered event-wait failures, including invalid options, client closure, queue overflow, deadline expiry or a failed filter
Default API calls add CancelledError, while native interruption remains in the Effect cause
type EventWaitFailure =
| ConfigurationError | ClientClosedError | EventOverflowError
| EventWaitErrortype EventWaitFailure =
| ConfigurationError
| ClientClosedError
| EventOverflowError
| EventWaitErrorGatewaySendFailure #
Expected gateway.send failures in both APIs
type GatewaySendFailure = GatewaySendError | ClientClosedErrortype GatewaySendFailure =
| GatewaySendError
| ClientClosedErrorGuildOperation #
type GuildOperation =
| "permissions.calculate"
| "permissions.fetch"
| "permissions.fetchChannels"
| `hierarchy.${
| "compare" | "isAbove" | "canManage" | "highestRole"
| "canManageRole"}`
| "members.search"
| `discovery.${
| "search" | "fetchStatus" | "fetchCategories" | "apply"
| "edit" | "withdraw"}`
| `invites.${
| "fetch" | "create" | "fetchForChannel" | "fetchForGuild"
| "delete"}`
| `${"emojis" | "stickers"}.${
| "get" | "fetchAll" | "fetchMetadata" | "fetchSource"
| "create" | "createMany" | "clone" | "edit" | "delete"}`
| "instance.fetchBadges"
| "guilds.get"
| "guilds.edit"
| "guilds.fetchVanityUrl"
| "guilds.editVanityUrl"
| "auditLogs.fetchPage"
| "members.get"
| "members.getSelf"
| "roles.get"
| "roles.getAll"
| "guilds.fetch"
| "guilds.fetchPage"
| "guilds.leave"
| "guilds.deleteOwnMessages"
| "members.ban"
| "members.unban"
| "members.fetchBans"
| "members.timeout"
| "members.clearTimeout"
| "members.timeoutState"
| "members.kick"
| "members.fetch"
| "members.fetchSelf"
| "members.fetchCanManage"
| "members.fetchPage"
| "members.editSelf"
| "members.setNickname"
| "members.move"
| "members.disconnect"
| "members.setMute"
| "members.setDeaf"
| "members.setRoles"
| "members.addRole"
| "members.removeRole"
| "roles.fetchAll"
| "roles.create"
| "roles.edit"
| "roles.delete"
| "roles.reorder"
| "roles.setHoistPositions"
| "roles.resetHoistPositions"type GuildOperation =
| "permissions.calculate"
| "permissions.fetch"
| "permissions.fetchChannels"
| `hierarchy.${
| "compare" | "isAbove"
| "canManage"
| "highestRole"
| "canManageRole"}`
| "members.search"
| `discovery.${
| "search" | "fetchStatus"
| "fetchCategories"
| "apply" | "edit"
| "withdraw"}`
| `invites.${
| "fetch" | "create"
| "fetchForChannel"
| "fetchForGuild"
| "delete"}`
| `${"emojis" | "stickers"}.${
| "get" | "fetchAll"
| "fetchMetadata"
| "fetchSource" | "create"
| "createMany" | "clone"
| "edit" | "delete"}`
| "instance.fetchBadges"
| "guilds.get"
| "guilds.edit"
| "guilds.fetchVanityUrl"
| "guilds.editVanityUrl"
| "auditLogs.fetchPage"
| "members.get"
| "members.getSelf"
| "roles.get"
| "roles.getAll"
| "guilds.fetch"
| "guilds.fetchPage"
| "guilds.leave"
| "guilds.deleteOwnMessages"
| "members.ban"
| "members.unban"
| "members.fetchBans"
| "members.timeout"
| "members.clearTimeout"
| "members.timeoutState"
| "members.kick"
| "members.fetch"
| "members.fetchSelf"
| "members.fetchCanManage"
| "members.fetchPage"
| "members.editSelf"
| "members.setNickname"
| "members.move"
| "members.disconnect"
| "members.setMute"
| "members.setDeaf"
| "members.setRoles"
| "members.addRole"
| "members.removeRole"
| "roles.fetchAll"
| "roles.create"
| "roles.edit"
| "roles.delete"
| "roles.reorder"
| "roles.setHoistPositions"
| "roles.resetHoistPositions"GuildOperationFailure #
Native interruption is outside this union
Default API methods additionally return CancelledError
type GuildOperationFailure = GuildOperationError | ClientClosedErrortype GuildOperationFailure =
| GuildOperationError
| ClientClosedErrorInputValidationConstraint #
Identifies why the SDK rejected an input before sending a request
The rule may concern its type, allowed range, format or relationship to another field. These categories do not describe Fluxer errors and are not ready-made messages for users
type InputValidationConstraint =
| "required" | "type" | "format" | "range" | "length"
| "allowedValue" | "allowedFields" | "relationship" | "unique"
| "size"type InputValidationConstraint =
| "required" | "type"
| "format" | "range" | "length"
| "allowedValue"
| "allowedFields"
| "relationship" | "unique"
| "size"InstanceResolveError #
Expected instance-resolution failures, including invalid options, connection trouble, deadline expiry, rate limits and client closure
Default API calls add CancelledError, while native interruption remains in the Effect cause
type InstanceResolveError =
| ConnectionError | ConnectionTimeoutError | RateLimitError
| ClientClosedError | ConfigurationErrortype InstanceResolveError =
| ConnectionError
| ConnectionTimeoutError
| RateLimitError
| ClientClosedError
| ConfigurationErrorMemberChunkFailure #
Expected stream failure
Native interruption and CancelledError in the default API remain separate
type MemberChunkFailure = MemberChunkError | ClientClosedErrortype MemberChunkFailure =
| MemberChunkError
| ClientClosedErrorMessageCleanupErrorReason #
Expected preview or cleanup failure classification
The reason filter denotes a bad selection callback, closed denotes client closure, which keeps the outcome of the step it ended, and input denotes invalid settings or plan ownership. Other values preserve the underlying message operation's failure reason
type MessageCleanupErrorReason =
"filter" | "closed" | "input" | MessageOperationError["reason"]type MessageCleanupErrorReason =
| "filter"
| "closed"
| "input"
| MessageOperationError["reason"]MessageCleanupFailure #
Expected preview and cleanup errors shared by both entry points
CancelledError in the default API and interruption in Effect are separate from this type
type MessageCleanupFailure = MessageCleanupErrortype MessageCleanupFailure =
MessageCleanupErrorMessageOperationFailure #
Message lookup, management and reaction failures shared by both entry points
Native interruption remains outside this union
type MessageOperationFailure =
MessageOperationError | ClientClosedErrortype MessageOperationFailure =
| MessageOperationError
| ClientClosedErrorNotFoundResource #
Resources that Fluxer reports as missing, accepted by errors.isNotFound
A thread is a channel
type NotFoundResource =
| "application" | "channel" | "emoji" | "forumTag" | "guild"
| "invite" | "member" | "message" | "role" | "sticker"
| "threadMember" | "user" | "webhook"type NotFoundResource =
| "application" | "channel"
| "emoji" | "forumTag"
| "guild" | "invite" | "member"
| "message" | "role"
| "sticker" | "threadMember"
| "user" | "webhook"OAuthOperation #
Public OAuth call identified by operation-error metadata
type OAuthOperation =
| "oauth.authorizationUrl" | "oauth.exchangeCode"
| "oauth.refresh" | "oauth.revoke" | "oauth.fetchIdentity"
| "oauth.fetchAuthorization" | "oauth.fetchGuilds"
| "oauth.fetchConnections" | "oauth.introspect"type OAuthOperation =
| "oauth.authorizationUrl"
| "oauth.exchangeCode"
| "oauth.refresh"
| "oauth.revoke"
| "oauth.fetchIdentity"
| "oauth.fetchAuthorization"
| "oauth.fetchGuilds"
| "oauth.fetchConnections"
| "oauth.introspect"OAuthOperationFailure #
Expected OAuth failures shared by both entry points
Default-API calls add CancelledError, while native interruption remains in the Effect cause
type OAuthOperationFailure = OAuthOperationError | ClientClosedErrortype OAuthOperationFailure =
| OAuthOperationError
| ClientClosedErrorOperation#
Identifies the default API call during which an SdkDefect was observed
This attribution does not establish whether a dispatched server mutation took effect or was rolled back
type Operation =
| "attachments.download" | "attachments.stream"
| AttachmentRefreshOperation | "instance.resolve"
| "presence.set" | "presence.setMembers" | "cache.entries"
| "users.getSelf" | "directMessages.send"
| BotApplicationOperation | "oauth.create" | OAuthOperation
| CountOperation | "members.iterateChunks" | UserOperation
| WebhookOperation | "createWebhookClient" | ChannelOperation
| GuildOperation | RestOperation | "gateway.send"
| "logging.configure" | "cache.onChange" | PaginationOperation
| "createClient" | "supervisor.create" | "supervisor.start"
| "supervisor.waitForClose" | "supervisor.waitForReady"
| "supervisor.shutdown" | "supervisor.child.run" | "commands"
| "connect" | "run" | "runBot" | "waitForClose" | "waitFor"
| "shutdown" | "on" | "subscribe" | "schedule" | "next" | "send"
| "forward" | "reply" | "typing" | "keepTyping" | "fetch"
| "publish" | "fetchCrosspostSource" | "messages.get"
| "fetchHistory" | "previewCleanup" | "search"
| "fetchReactionUsers" | "fetchHasReaction" | "pin" | "unpin"
| "fetchPins" | "addReaction" | "removeReaction"
| "removeUserReaction" | "clearReaction" | "clearReactions"
| "edit" | "delete" | "deleteAttachment" | "deleteMany"
| "deleteOwnMessages" | "cleanup" | "subscription.waitForClose"
| "collect" | "collector.result" | "collectReactions"
| "reactionCollector.result" | "paginate"type Operation =
| "attachments.download"
| "attachments.stream"
| AttachmentRefreshOperation
| "instance.resolve"
| "presence.set"
| "presence.setMembers"
| "cache.entries"
| "users.getSelf"
| "directMessages.send"
| BotApplicationOperation
| "oauth.create"
| OAuthOperation
| CountOperation
| "members.iterateChunks"
| UserOperation
| WebhookOperation
| "createWebhookClient"
| ChannelOperation
| GuildOperation
| RestOperation
| "gateway.send"
| "logging.configure"
| "cache.onChange"
| PaginationOperation
| "createClient"
| "supervisor.create"
| "supervisor.start"
| "supervisor.waitForClose"
| "supervisor.waitForReady"
| "supervisor.shutdown"
| "supervisor.child.run"
| "commands" | "connect"
| "run" | "runBot"
| "waitForClose" | "waitFor"
| "shutdown" | "on"
| "subscribe" | "schedule"
| "next" | "send" | "forward"
| "reply" | "typing"
| "keepTyping" | "fetch"
| "publish"
| "fetchCrosspostSource"
| "messages.get"
| "fetchHistory"
| "previewCleanup" | "search"
| "fetchReactionUsers"
| "fetchHasReaction" | "pin"
| "unpin" | "fetchPins"
| "addReaction"
| "removeReaction"
| "removeUserReaction"
| "clearReaction"
| "clearReactions" | "edit"
| "delete" | "deleteAttachment"
| "deleteMany"
| "deleteOwnMessages"
| "cleanup"
| "subscription.waitForClose"
| "collect"
| "collector.result"
| "collectReactions"
| "reactionCollector.result"
| "paginate"OperationOutcome #
Whether a request may have reached Fluxer
The outcome notDispatched means it was not sent, rejected means Fluxer refused it, and unknown means the result is uncertain. A write with an unknown outcome may already have applied, so reconcile remote state before repeating it. A read with an unknown outcome cannot have changed remote state and is safe to repeat. A rejection does not prove rollback
type OperationOutcome = "notDispatched" | "rejected" | "unknown"type OperationOutcome =
| "notDispatched" | "rejected"
| "unknown"OperationReason #
Why a remote operation failed
The reason input means local validation failed, busy means local request capacity was full, and notFound means HTTP 404. A 404 does not prove that an earlier deletion succeeded. The reason rejected means Fluxer refused the request, or with outcome notDispatched that the SDK refused it before sending because a permission is missing
The reason network is a transport failure, response means unusable success data, timeout means the deadline expired, and rateLimit means the wait the server required could not be completed. A connection lost while a response body arrives is a network failure. HTTP failures keep their status, never their response bodies
type OperationReason =
| "input" | "busy" | "notFound" | "rejected" | "network"
| "response" | "timeout" | "rateLimit"type OperationReason =
| "input" | "busy" | "notFound"
| "rejected" | "network"
| "response" | "timeout"
| "rateLimit"PaginateFailure #
Expected reaction page failures: Invalid pages or options, a failed send, a failed page change, arrow or click removal, an unavailable or lost gateway, an overflowing listener or a failing users check
After the first page is sent, the message stays at its current page and the bot still removes its own arrows. When that removal also fails, the earlier failure is returned. After an otherwise normal end, the removal failure is returned
type PaginateFailure =
| ConfigurationError | SendError | MessageOperationFailure
| CollectorFailuretype PaginateFailure =
| ConfigurationError
| SendError
| MessageOperationFailure
| CollectorFailurePaginationOperation #
Operation name included in a PaginationError or default-API SDK defect to identify the traversal
type PaginationOperation =
| "iterateHistory" | "messages.iterateSearch"
| "members.iterate" | "guilds.iterate" | "members.iterateSearch"
| "iterateReactionUsers" | "iteratePins" | "auditLogs.iterate"
| "threads.iterateMembers" | "threads.iterateArchived"type PaginationOperation =
| "iterateHistory"
| "messages.iterateSearch"
| "members.iterate"
| "guilds.iterate"
| "members.iterateSearch"
| "iterateReactionUsers"
| "iteratePins"
| "auditLogs.iterate"
| "threads.iterateMembers"
| "threads.iterateArchived"PresenceFailure #
Expected presence-operation failure
Client closure remains distinct from local input rejection
type PresenceFailure = PresenceError | ClientClosedErrortype PresenceFailure =
| PresenceError
| ClientClosedErrorRestOperation #
Operation name included in REST request failures
type RestOperation = "rest.request"RestRequestFailure #
Expected REST request failures in both APIs
Native interruption is outside this union, and default API calls additionally return CancelledError and ConfigurationError for a malformed signal
type RestRequestFailure = RestRequestError | ClientClosedErrortype RestRequestFailure =
| RestRequestError
| ClientClosedErrorSendError #
Expected message-creation failures shared by both entry points, including permanent client closure
Default API calls add CancelledError, while native interruption remains in the Effect cause
type SendError = MessageError | ClientClosedErrortype SendError =
| MessageError
| ClientClosedErrorUserOperation #
User/private-conversation operation named by safe failure metadata
type UserOperation =
| "users.fetch" | "users.fetchSelf" | "users.fetchProfile"
| "users.get" | "directMessages.open" | "directMessages.fetch"
| "directMessages.fetchAll"
| "directMessages.fetchLatestMessages" | "directMessages.get"
| "directMessages.editGroup" | "directMessages.close"
| "directMessages.removeRecipient"type UserOperation =
| "users.fetch"
| "users.fetchSelf"
| "users.fetchProfile"
| "users.get"
| "directMessages.open"
| "directMessages.fetch"
| "directMessages.fetchAll"
| "directMessages.fetchLatestMessages"
| "directMessages.get"
| "directMessages.editGroup"
| "directMessages.close"
| "directMessages.removeRecipient"UserOperationFailure #
Cancellation in the default API additionally returns CancelledError
Native interruption remains in the Effect cause
type UserOperationFailure = UserOperationError | ClientClosedErrortype UserOperationFailure =
| UserOperationError
| ClientClosedErrorWebhookOperation #
Identifies the webhook action that failed, so an error can be associated with the request the application made
type WebhookOperation =
| "webhooks.create" | "webhooks.fetch"
| "webhooks.fetchForChannel" | "webhooks.fetchForGuild"
| "webhooks.edit" | "webhooks.delete" | "webhooks.fetchToken"
| "webhooks.editToken" | "webhooks.deleteToken"
| "webhooks.send" | "webhooks.fetchMessage"
| "webhooks.editMessage" | "webhooks.deleteMessage"type WebhookOperation =
| "webhooks.create"
| "webhooks.fetch"
| "webhooks.fetchForChannel"
| "webhooks.fetchForGuild"
| "webhooks.edit"
| "webhooks.delete"
| "webhooks.fetchToken"
| "webhooks.editToken"
| "webhooks.deleteToken"
| "webhooks.send"
| "webhooks.fetchMessage"
| "webhooks.editMessage"
| "webhooks.deleteMessage"WebhookOperationFailure #
Expected failures shared by webhook operations, including requests made after the client closes
Default API methods additionally return CancelledError when their AbortSignal is aborted. Effect cancellation interrupts the running Effect rather than adding a cancellation value to this union
type WebhookOperationFailure =
WebhookOperationError | ClientClosedErrortype WebhookOperationFailure =
| WebhookOperationError
| ClientClosedError