AtomBuild / atom-build-cargo

Cargo (Rust) integration for Atom
MIT License
18 stars 6 forks source link

Uncaught TypeError: Cannot read property 'charAt' of undefined #75

Closed jgrund closed 7 years ago

jgrund commented 7 years ago

Hi,

I am seeing this trace occasionally

TypeError: Cannot read property 'charAt' of undefined
    at Object.level2type (/Users/joegrund/.atom/packages/build-cargo/lib/errors.js:150:15)
    at Object.parseMessage (/Users/joegrund/.atom/packages/build-cargo/lib/json-parser.js:69:15)
    at matchFunction (/Users/joegrund/.atom/packages/build-cargo/lib/cargo.js:130:24)
    at buildCfg.functionMatch (/Users/joegrund/.atom/packages/build-cargo/lib/cargo.js:206:63)
    at /Users/joegrund/.atom/packages/build/lib/error-matcher.js:74:52
    at Array.forEach (native)
    at ErrorMatcher._parse (/Users/joegrund/.atom/packages/build/lib/error-matcher.js:73:38)
    at ErrorMatcher.set (/Users/joegrund/.atom/packages/build/lib/error-matcher.js:131:10)
    at ChildProcess.<anonymous> (/Users/joegrund/.atom/packages/build/lib/build.js:189:27)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Socket.<anonymous> (internal/child_process.js:334:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:493:12)
alygin commented 7 years ago

@jgrund, thanks for the report! I'll fix the problem anyway, but it would be great if you could provide a cargo command output that leads to this problem.

jgrund commented 7 years ago

First off, thanks for working on and maintaining this plugin; it's been nice to use.

Here's a reduced case.

  1. Create a .rs file that contains just
s
  1. Run a build. In this case I'm running:

cargo build --message-format=json --verbose

Here is the output:


1
1
Rust
Error
expected one of `!` or `::`, found `<eof>`

s
Rust
Error
expected one of `!` or `::`, found `<eof>`at line 1 col 1
120.3 s
/Users/joegrund/.cargo/bin/cargo build --message-format=json --verbose
lumn_end":2,"is_primary":true,"text":[{"text":"s","highlight_start":1,"highlight_end":2}],"label":
null,"suggested_replacement":null,"expansion":null}],"children":[],"rendered":null}
{"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"
rendered":null}
alygin commented 7 years ago

Thanks for the example! The fix is on the way.