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

Smaller stack traces #212

Open
danielo515 opened this issue Jul 1, 2018 · 1 comment
Open

Smaller stack traces #212

danielo515 opened this issue Jul 1, 2018 · 1 comment

Comments

@danielo515
Copy link

Hello,

I know there is already an issue about cleaner stack traces. This is somewhat related, but focused on the length, and not specifically on the number of stacks or where they come from.

Here is a small example of one type error I got today:

$ node test                                                                                                                            ‹ruby-2.3.0›
/Users/danielo/GIT/danielo-packages/packages/fp-min/node_modules/sanctuary-def/index.js:2513
          throw invalidArgumentsCount (typeInfo, index, 1, args);
          ^

TypeError: ‘sanfu/promise/pipeAcc’ applied to the wrong number of arguments

sanfu/promise/pipeAcc :: Array Function -> Function
                         ^^^^^^^^^^^^^^
                               2

Expected one argument but received three arguments:

  - function(x) {
        var args = slice.call (arguments);
        if (args.length !== 1) {
          throw invalidArgumentsCount (typeInfo, index, 1, args);
        }
        var typeVarMap = (assertRight (
          satisfactoryTypes (env,
                             typeInfo,
                             _typeVarMap,
                             typeInfo.types[index],
                             index,
                             [],
                             args)
        )).typeVarMap;

        var values = Z.concat (_values, args);
        if (index + 1 === n) {
          var value = values.reduce (function(f, x, idx) {
            return f (wrapFunctionCond (typeVarMap, idx, x));
          }, impl);
          typeVarMap = (assertRight (
            satisfactoryTypes (env,
                               typeInfo,
                               typeVarMap,
                               typeInfo.types[n],
                               n,
                               [],
                               [value])
          )).typeVarMap;
          return wrapFunctionCond (typeVarMap, n, value);
        } else {
          return wrapNext (typeVarMap, values, index + 1);
        }
      }
  - ([, b]) => b * 2
  - ([, , c]) => c - 1

    at invalidArgumentsCount (/Users/danielo/GIT/danielo-packages/packages/fp-min/node_modules/sanctuary-def/index.js:2069:12)
    at /Users/danielo/GIT/danielo-packages/packages/fp-min/node_modules/sanctuary-def/index.js:2513:17
    at Object.<anonymous> (/Users/danielo/GIT/danielo-packages/packages/fp-min/test/index.js:4:11)
    at Module._compile (internal/modules/cjs/loader.js:702:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    at Function.Module._load (internal/modules/cjs/loader.js:543:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)
    at startup (internal/bootstrap/node.js:238:19)

It does not even fit in the screen !!
This is a more or less complex example because the input was a function, or list of functions and it gets transform to string. But there are other scenarios where providing an array that does not fulfill some requirements results on the entire array being dumped on the console. In my case, where I usually handle arrays of thousands of objects this is not very useful.

Hope you can add a mechanism to output less information to the console.

Regards

@davidchambers
Copy link
Member

I'm 100% with you, @danielo515. I'd love to remove the noise from these error messages.

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