tatethurston/TwirpScript

RangeError when service name is too long

antonioorct opened this issue · 1 comments

syntax = "proto3";
package pkg;

message VeryLongNameThatCausesAnError {
  int32 id = 1;
}

service VeryLongNameThatCausesAnErrorService {
  rpc GetAll(GetAllRequest) returns (GetAllResponse);
}

When a long service name as above is provided then the twirpscript errors out with the following error:

/stsi/proto/node_modules/twirpscript/dist/autogenerate.js:177
  //${" ".repeat(Math.floor(padding))}${heading}${" ".repeat(Math.ceil(padding))}//
          ^

RangeError: Invalid count value
    at String.repeat (<anonymous>)
    at printHeading (/stsi/proto/node_modules/twirpscript/dist/autogenerate.js:177:11)
    at /stsi/proto/node_modules/twirpscript/dist/autogenerate.js:190:19
    at Array.forEach (<anonymous>)
    at writeClients (/stsi/proto/node_modules/twirpscript/dist/autogenerate.js:189:14)
    at generate (/stsi/proto/node_modules/twirpscript/dist/autogenerate.js:287:3)
    at /stsi/proto/node_modules/twirpscript/dist/compiler.js:27:52
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/stsi/proto/node_modules/twirpscript/dist/compiler.js:22:28)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)

Hey @antonioorct thanks for reporting this. I've fixed the issue in #25 and published v.0.0.27 with the fix.