Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Better error message when not initialized #1180

@vmx

Description

@vmx

Type:

Bug

Severity:

Low

Description:

jsipfs block put errors with an unhandled exception when IPFS wasn't previously initialized. Instead it should print a nice error that no repository was initialized and calling jsipfs init first might make sense. Example:

$ jsipfs block put README.md
/home/vmx/src/pl/js-ipfs/node_modules/ipfs-block-service/src/index.js:64
    this._repo.blocks.put(block, callback)
                      ^

TypeError: Cannot read property 'put' of undefined
    at BlockService.put (/home/vmx/src/pl/js-ipfs/node_modules/ipfs-block-service/src/index.js:64:23)
    at waterfall (/home/vmx/src/pl/js-ipfs/src/core/components/block.js:51:43)
    at nextTask (/home/vmx/src/pl/js-ipfs/node_modules/async/waterfall.js:16:14)
    at next (/home/vmx/src/pl/js-ipfs/node_modules/async/waterfall.js:23:9)
    at /home/vmx/src/pl/js-ipfs/node_modules/async/internal/onlyOnce.js:12:16
    at waterfall (/home/vmx/src/pl/js-ipfs/src/core/components/block.js:31:20)
    at nextTask (/home/vmx/src/pl/js-ipfs/node_modules/async/waterfall.js:16:14)
    at exports.default (/home/vmx/src/pl/js-ipfs/node_modules/async/waterfall.js:26:5)
    at Function.put.promisify (/home/vmx/src/pl/js-ipfs/src/core/components/block.js:28:7)
    at Object.put (/home/vmx/src/pl/js-ipfs/node_modules/promisify-es6/index.js:32:27)

Steps to reproduce the error:

Make sure you don't have a repository (i.e. rm -Rf ~/.jsipfs). Then run:

jsipfs block put <some-file>

Metadata

Metadata

Assignees

Labels

P2Medium: Good to have, but can wait until someone steps upexp/noviceSomeone with a little familiarity can pick uphelp wantedSeeking public contribution on this issuekind/bugA bug in existing code (including security flaws)status/in-progressIn progress

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions