File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
packages/neovim/src/utils Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 3
3
*/
4
4
5
5
import { EventEmitter } from 'node:events' ;
6
+ import { inspect } from 'node:util' ;
6
7
7
8
import {
8
9
encode ,
@@ -111,7 +112,21 @@ class Transport extends EventEmitter {
111
112
iter . next ( ) . then ( resolved => {
112
113
if ( ! resolved . done ) {
113
114
if ( ! Array . isArray ( resolved . value ) ) {
114
- throw new TypeError ( 'expected msgpack result to be array' ) ;
115
+ let valstr = '?' ;
116
+ try {
117
+ valstr = inspect ( resolved . value , {
118
+ sorted : true ,
119
+ maxArrayLength : 10 ,
120
+ maxStringLength : 500 ,
121
+ compact : true ,
122
+ breakLength : 500 ,
123
+ } ) ;
124
+ } catch ( error ) {
125
+ console . error ( 'Failed to inspect value: ' , error ) ;
126
+ }
127
+ throw new TypeError (
128
+ `Expected msgpack result to be an array, but got ${ valstr } `
129
+ ) ;
115
130
}
116
131
this . parseMessage ( resolved . value ) ;
117
132
return resolveGeneratorRecursively ( iter ) ;
You can’t perform that action at this time.
0 commit comments