ceramicnetwork / ceramicnetwork/js-ceramic

Ceramic daemon should return a promise rejection if cannot connect to ipfs node

Open
#799 5 comments 0 reactions 0 assignees View on GitHub
dontclose good first issue
Dominant language
TypeScript
Stars
423
Forks
126
PR merge metrics
No merged PRs in 30d

Description

For bash scripting purposes, it would be helpful if the ceramic daemon would more gracefully fail, returning non-zero exit codes.

When the IPFS node is starting up, if we start the ceramic daemon too early, we get:

```
Executing command in 1 package: "ceramic daemon --ipfs-api http://localhost:5011"
(node:39087) UnhandledPromiseRejectionWarning: FetchError: request to http://localhost:5011/api/v0/id failed, reason: socket hang up
at ClientRequest. (/Users/jonathanschwartz/Documents/daemon-land/js-sdk/services/api/node_modules/node-fetch/lib/index.js:1461:11)
at ClientRequest.emit (events.js:314:20)
at Socket.socketOnEnd (_http_client.js:493:9)
at Socket.emit (events.js:326:22)
at endReadableNT (_stream_readable.js:1244:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:39087) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:39087) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
```

For some reason this still seems to register as a successfully run command. This makes it hard to gracefully script deployments.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.