cess icon indicating copy to clipboard operation
cess copied to clipboard

SBP: Review all your `unwrap()`

Open NachoPal opened this issue 3 years ago • 2 comments

Avoid panics at almost any cost and add "proofs" for expect() calls on why they cannot fail. The only reason to panic should be in case a block should not be built when that code path is triggered or when it indicates a bug.

In most cases you should handle the Error.

e.g: A potential place to handle the error: https://github.com/CESSProject/cess/blob/main/c-pallets/file-bank/src/lib.rs#L537

NachoPal avatar May 20 '22 11:05 NachoPal

Hi, Nacho. Thank you very much for your suggestion, this is very helpful for us. We are making adjustments and will communicate with you when it is fixed.

swowk avatar May 26 '22 06:05 swowk

Now we have changed all the places in the code where unwrap() and expect() are used, and we will pay attention to this in future development. PR: (#49)

ytqaljn avatar Jun 15 '22 11:06 ytqaljn