serve-d icon indicating copy to clipboard operation
serve-d copied to clipboard

Avoid crash if the document has errors

Open ryuukk opened this issue 2 years ago • 1 comments

I got hit by this error

std.utf.UTFException@\/usr\/include\/dlang\/ldc\/std\/utf.d(1547): Invalid UTF-8 sequence (at index 1)\n----------------\n\/usr\/include\/dlang\/ldc\/std\/utf.d:1585 pure dchar std.utf.decodeImpl!(true, 0, const(char)[]).decodeImpl(ref const(char)[], ref ulong) [0x560d91cf050e]\n\/usr\/include\/dlang\/ldc\/std\/utf.d:1186 pure @trusted dchar std.utf.decode!(0, const(char)[]).decode(scope ref const(char)[], ref ulong) [0x560d91cf0429]\n\/usr\/include\/dlang\/ldc\/std\/range\/primitives.d:2504 pure @property @safe dchar std.range.primitives.front!(char).front(scope const(char)[]) [0x560d91cfdbcb]\n\/usr\/include\/dlang\/ldc\/std\/algorithm\/searching.d:2718 [0x560d9223703f]\n\/usr\/include\/dlang\/ldc\/std\/string.d:1645 [0x560d92273a92]\n\/usr\/include\/dlang\/ldc\/std\/string.d:1770 [0x560d922739df]\n..\/..\/.dub\/packages\/libdparse-0.19.0\/libdparse\/src\/dparse\/strings.d:665 [0x560d92272b53]\n..\/..\/.dub\/packages\/libdparse-0.19.0\/libdparse\/src\/dparse\/strings.d:262 [0x560d9209daf4]\n..\/..\/.dub\/packages\/workspace-d-3.8.0\/workspace-d\/source\/workspaced\/dparseext.d:312 [0x560d9209ce93]\n..\/..\/.dub\/packages\/workspace-d-3.8.0\/workspace-d\/source\/workspaced\/com\/dcdext.d:949 [0x560d91ff855d]\nsource\/served\/commands\/highlight.d:63 [0x560d91d40997]\nsource\/served\/commands\/highlight.d:46 [0x560d91c877f1]\nserverbase\/source\/served\/serverbase.d:198 [0x560d91c9b34d]\nserverbase\/source\/served\/utils\/events.d:232 [0x560d91c9ab4a]\nserverbase\/source\/served\/utils\/events.d:297 [0x560d91c8b081]\nserverbase\/source\/served\/utils\/events.d:206 [0x560d91c6aeb7]\nserverbase\/source\/served\/serverbase.d:171 [0x560d91c69d71]\nserverbase\/source\/served\/serverbase.d:306 [0x560d91c6b48c]\n??:? fiber_entryPoint [0x7f0bd538b5ba]

ryuukk avatar Jul 02 '22 21:07 ryuukk

should we catch Exception in general?

It might also throw ConvException: https://github.com/dlang-community/libdparse/blob/6f0893f6b07ec561d382f26c81e74f7788056828/src/dparse/strings.d#L223

WebFreak001 avatar Jul 02 '22 21:07 WebFreak001