language-tools icon indicating copy to clipboard operation
language-tools copied to clipboard

Wasm module error behavior

Open janpio opened this issue 4 years ago • 7 comments

Wasm module probably behaves different than binary, we should figure out how and make sure it is nice for users to understand and create issues based on it.

Related:

  • https://github.com/prisma/language-tools/pull/966/files#r756836401
  • https://github.com/prisma/language-tools/pull/966
  • https://prisma-company.slack.com/archives/C02A1646TBR/p1637773282039600 + https://github.com/prisma/prisma-fmt-wasm/pull/8

janpio avatar Nov 25 '21 12:11 janpio

2021-11-25_13-11-39 2021-11-25_13-11-28

This is what an unhandled engine prisma-fmt crash would like (a non-helpful JS exception). We have error handlers for most methods though, I'll check what would happen there now.

tomhoule avatar Nov 25 '21 12:11 tomhoule

2021-11-25_13-11-50

Here's the output with the panic inside of a try block with a catch calling the error handler. What I understand from this: our error handler swallows errors (it's the same we used for the binary).

tomhoule avatar Nov 25 '21 12:11 tomhoule

I double checked and can confirm it's the behaviour I observe.

tomhoule avatar Nov 25 '21 12:11 tomhoule

the panics will throw unhelpful JS exceptions, we'd need to handle them and say what failed and how to report it

Jolg42 avatar Nov 25 '21 13:11 Jolg42

So the current implementation is only showing error messages for validateTextDocument (which calls lint()) And is surfaced via the onError callback as a notification error. https://github.com/prisma/language-tools/blob/main/packages/language-server/src/server.ts#L166-L168

Now the question is, do we want to have this notification error for all the methods? 🤔

Jolg42 avatar Dec 23 '21 14:12 Jolg42

Note: it may be possible to solve this issue by investigating ideas from this internal thread.

jkomyno avatar Aug 24 '22 10:08 jkomyno

Note that logging was improved in https://github.com/prisma/language-tools/pull/1474

Jolg42 avatar Aug 01 '23 12:08 Jolg42