🎨 Improve debug output

This commit is contained in:
C-3PO 2018-07-08 22:11:52 +02:00
parent 4827292e9a
commit e6d42844f5
Signed by: c3po
GPG key ID: 62993C4BB4D86F24

View file

@ -73,7 +73,7 @@ function bpParse(dv: DataView, posIn: number = 0): { obj: any, pos: number } {
break;
}
default:
throw new Error(`Unexpected leading char 0x${header.toString(16)} during Bencode parsing at position ${pos - 1}.`);
throw new Error(`Unexpected leading char 0x${header.toString(16)} during Bencode parsing at position ${pos - 1}. Full text:\n${decoder.decode(dv)}`);
}
return { obj, pos };
}