Skip to content

Smaller stack traces #212

Open
Open
@danielo515

Description

@danielo515

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions