Open ia0 opened 1 year ago
Prelude functions should panic on errors that the user could have prevented (e.g. out of bound index).
Hey just to make sure I understand this point. By panicking do you mean using scheduling::abort
somewhere in the applet? or panicking somewhere in the scheduler using log::panic!
For example, for dealing with an index out of bounds error on led::set
. I assume we would have to get the out-of-bounds-error from here. Then,
scheduling::abort
some where here ?log::panic!
here instead of sending the error back to the scheduler to trap hereI assume we would have to get the out-of-bounds-error from here.
Yes, we would need to return an error there instead of a trap. Then the prelude would simply unwrap the result (maybe it does do already) with a track_caller attribute for the panic location to be in the user code.
No need to call scheduling abort, that should be automatic when panicking.
Also we should never panic in the scheduler.
When calling the prelude with wrong arguments, instead of panicking without error message, an error message could describe the problem. For example when calling
led::set()
with an out-of-bound index.Ideas:
is_supported
function).Sub-tasks:
463
464