Throw typed errors with a `cause`
Maintainers usually reply within 4 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 42/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- docker, node.js, typescript
Research direction
Start by reading the listed wait-strategy, generic-container, bound-ports, and docker-compose-environment files, then trace the 33 new Error(...) sites and existing tests. Define exported error categories with useful fields and preserve existing messages while attaching underlying errors as cause. Done when the main listed failure types are distinguishable by class, retain causes where errors are wrapped, and tests cover the new fields and unchanged messages.
Written by the indexing model from the issue text.
Description
What happens
Every error created by packages/testcontainers is a plain Error. There are 33 new Error(...) sites and no error subclasses. A caller can only tell failures apart by matching message text:
Log message "..." not received after 60000msURL /health not accessible after 60000msImage "..." does not exist locally and pull policy is "never"No port binding found for :8080/tcpCannot get container "..." as it is not runningFailed to build image
None of them carry a cause, so the underlying Docker or network error is lost when one is wrapped.
Expected
Exported error classes for the main failure categories, with useful fields, so callers and test helpers can branch on them:
- startup timeout (strategy, timeout, container id)
- container exited during startup (exit code)
- image pull or build failure
- missing port binding or unknown container
Underlying errors are attached as cause.
Where
packages/testcontainers/src/wait-strategies/*.tspackages/testcontainers/src/generic-container/*.tspackages/testcontainers/src/utils/bound-ports.tspackages/testcontainers/src/docker-compose-environment/*.ts
Notes
- Java has
ContainerLaunchExceptionandContainerFetchException. - Related: #1506 (container logs in the start error), #1507 (fail the HTTP wait when the container exits), #1508 (build output on a failed build). Typed errors give those a place to put the logs and exit code.
- Keeping the existing messages makes this additive.
Dependencies
- Nothing blocks this. It can start now.
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 290
- Avg merge
- 4d 1h
- Merged PRs (30d)
- 22
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from testcontainers/testcontainers-node
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
testcontainers/testcontainers-node#1673 ·
Maintainers usually reply within 4 days
-
enhancement minor
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
testcontainers/testcontainers-node#1539 ·
Maintainers usually reply within 4 days
-
Let `Wait.forListeningPorts()` wait on specific portsPossibly taken @artbom claimed this 29 days ago. Openenhancement minor
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
testcontainers/testcontainers-node#1533 ·
Maintainers usually reply within 4 days
-
enhancement minor
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
testcontainers/testcontainers-node#1531 ·
Maintainers usually reply within 4 days
-
Export the types used in public method signaturesPossibly taken @artbom claimed this 29 days ago. Openenhancement minor
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
testcontainers/testcontainers-node#1528 ·
Maintainers usually reply within 4 days
All issues in testcontainers/testcontainers-node
Similar issues
-
prio:low scope:hud
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
OliverRomhagen/vrigstad-joyride#953 ·
Maintainers usually reply within 1 day
-
review-followup
Difficulty 1/5 Under an hour Newbie friendliness 92/100
griffinwork40/agent-afk#5446 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
kacper-szewczyk/Ticknest#346 ·
Maintainers usually reply within 1 day
-
echarts geo: a GeoJSON URL that returns 200 with a body that is not JSON is fetched on each refreshOpenbug plugin/echarts/geo
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Yeachan-Heo/gajae-code#8230 ·
Maintainers usually reply within 1 day