delvtech/hyperdrive-rs

improve error handling in rust sdk get_short_deposit

Opened this issue · 1 comments

the get_short_deposit function includes a call to state.short_principal that can optionally return None. In this case, the function forwards that None return (here). It would be better if we used Result return type and threw a meaningful error -- since this is effectively indicating that the short cannot be opened.

something along the lines of

if principal.is_none() {
    panic!("some helpful description of what went wrong");
}

We should also fix this in get_out_for_in_safe