Repository navigation
Typed SpawnError rejections; list failures never look empty (#125) - #134
Merged
Merged
Conversation
This was referenced Nov 11, 2026
Instance actions, launch and refresh reject with SpawnError carrying the operation, instance id and AWS code. An action resolves only when its provider call succeeded; a failed refresh after it is reported through the new client.listState and an "error" event, never an unhandled rejection. refresh() rejects instead of resolving [] on a failed DescribeInstances, and EC2Provider.list follows NextToken. The Dashboard shows a refused action on its card in plain words with the AWS code, shows "stopping..." while it runs, keeps the last cards with a "couldn't check" banner when the list fails, and says "no instances" only after a list loaded. Fixes #125
scttfrdmn
force-pushed
the
fix/125-errors-propagate
branch
from
November 11, 2026 05:01
270499f to
7924910
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #125
Client
SpawnError(src/core/errors.ts).stop / start / hibernate / terminate / extend / signalComplete / launch / refreshreject with it. Fields:operation,instanceId,code,aws,httpStatus,requestId,cause.aws: true,codeis the AWS code:UnauthorizedOperation,IncorrectInstanceState,UnsupportedHibernationConfiguration,ExpiredToken, and so on. It is read from SDK v3'snamewhen$fault/$metadataare present, or fromCode.codeis one of spawn-ts's own:InvalidInstanceId,InstanceNotFound,AmbiguousName,NotSimulated,NoTtl,InvalidDuration,LaunchRefused,NetworkError,Unknown.toThrow(/…/)matches still hold.refresh()rejects on a failed DescribeInstances and never resolves[]. The newclient.listStateis{ status: "loading" | "ok" | "error", instances, checkedAtMs?, error? }. Onerror,instancesis the last list that loaded.EC2Provider.listfollowsNextToken. Reading only one page was another way to show a wrong list as if it were current.{ type: "error", error }. Before,void this.tick()left an unhandled rejection.launchtypes its errors at each throw point rather than wrapping the method. A wrapper adds a microtask per launch, and the fan-out pump's ordering is sensitive to that (one sweep test caught it).Dashboard
.card-error,role="alert") as one plain sentence naming the action, fromdescribeSpawnError, plus the code and AWS's message, with a dismiss link. It survives re-renders, is cleared by the next successful action, and is logged as anerrorline.stopping…/starting…/terminating…and the card's buttons are disabled. Terminate confirms before anything runs..list-errorbanner: "…[ExpiredToken] Showing the list from 12:00:00; those instances may still be running.".orphan-banner[hidden](and the new elements) now actually hide.display: flexwas overriding the attribute, as the brief noted.Tests
src/core/errors.test.ts:toSpawnErrorkeeping the code, status, request id, cause and message; network and local codes; the plain sentences.UnauthorizedOperation,UnsupportedHibernationConfigurationandIncorrectInstanceState. A Name rejects withInvalidInstanceIdand makes no AWS call.listStateto error.EC2Provider.listrejects instead of returning[], and paginates.refreshrejects, keeps the last good list and marks it stale.errorevents and leave no unhandled rejection (process.on("unhandledRejection")).dashboard.test.ts:Breaking for existing consumers
Mildly, and noted in the CHANGELOG:
SpawnError, though messages are unchanged andinstanceof Errorstill holds;