poga / actix-lua

Safe Lua Scripting Environment for Actix
MIT License
121 stars 13 forks source link

better error handling #4

Closed poga closed 6 years ago

poga commented 6 years ago

Currently, there areunwrap everywhere. Some of them are needed. Some of them should be refactored into proper Result. We should have a cleaner big pictures about errors propagation.

Also need to document about how to deal with lua errors such as syntax error, error()...etc.

poga commented 6 years ago

With https://github.com/poga/actix-lua/commit/95b92769f873caff144c73d3eb927e00862f7e0a, all unwrap in LuaActorBuilder are removed.

poga commented 6 years ago

https://github.com/poga/actix-lua/commit/9f206ff6a3908946f646f228b23d268dea7dcc22 removed most of the unwrap in actor.rs.

There're 2 places still use unwrap. The first is converting parameter of invoke to Lua value. Since parameters are LuaMessage, it should be fine.

The second place is unwrapping do_send. AFAIK if do_send failed, then there's a bigger issue in the system. Panicking when it failed might be acceptable.

Let's close this for now.