eclipse-glsp / glsp

Graphical language server platform for building web-based diagram editors
https://www.eclipse.dev/glsp
Other
202 stars 33 forks source link

Delegate error to action dispatcher #1386

Open haydar-metin opened 3 months ago

haydar-metin commented 3 months ago

Currently, it is not possible to catch an error thrown by a handler at the location where the action was dispatched when the error was thrown on the server.

https://github.com/eclipse-sprotty/sprotty/blob/c9e7c730842720f032dbf6ae2b346fc252bf63a0/packages/sprotty/src/base/actions/action-dispatcher.ts#L46

https://github.com/eclipse-glsp/glsp-client/blob/8eb216caeeb5efa5691e39a449ee18a4aba99298/packages/client/src/base/action-dispatcher.ts#L24

The server does not delegate the error, it catches the error and sends a MessageAction:

https://github.com/eclipse-glsp/glsp-server-node/blob/main/packages/server/src/common/protocol/glsp-server.ts#L167

planger commented 2 months ago

Suggested solution: Introduce ExecuteOperationRequestAction which wraps the operation and has a response on completion or throws error. This should then be orthogonal to existing code but allow the requested functionality.