Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Check input for pipe #125

Closed
Beanow opened this issue Dec 20, 2015 · 2 comments
Closed

[Feature] Check input for pipe #125

Beanow opened this issue Dec 20, 2015 · 2 comments

Comments

@Beanow
Copy link

Beanow commented Dec 20, 2015

Please check ahead of time when declaring pipe statements if the functions are defined.
Currently stack traces when a piped function is undefined are very obscure.

Using version 0.7.1.

import {pipe} from 'sanctuary';
const samplePackage = {};
const breakingFunction = pipe([samplePackage.doesNotExist]);
breakingFunction("Hello world");

Outputs

TypeError: g is not a function
    at /.../node_modules/sanctuary/index.js:257:16
    at /.../node_modules/sanctuary/index.js:395:42
    at /.../node_modules/sanctuary/index.js:246:48
    at /.../node_modules/sanctuary/index.js:179:45
    at Object.<anonymous> (/.../src/index.js:4:1)
@davidchambers
Copy link
Member

Good idea, @Beanow. Fortunately, this will be resolved by #123:

S.pipe([undefined]);
// ! TypeError: ‘pipe’ expected a value of type (List Function) as its first argument; received [undefined]

@davidchambers
Copy link
Member

I've just published v0.8.0, which has the behaviour indicated in the comment above. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants