You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.
transfer
.write_function(|new_data| {letmut data = data.borrow_mut();
data.extend_from_slice(new_data);Ok(new_data.len())}).unwrap();
Why are we unwrapping here, when the value isnt being assigned to anything?
im currently debugging an issue I ran into related to trying to submit nonsense requests. We crashed because later in this function call we try to unwrap an error when we were expecting a value. I fixed that
match transfer.perform(){Ok(_) => {let res = String::from_utf8(data.take()).unwrap();self.resp = Some(res.clone());Ok(())}Err(e) => {let res = format!("Error Executing Curl Request: {}", e);self.resp = Some(res.clone());Err(e)}}
Now we match on the transfer.perform() and anything that results from it, success or error, will get thrown into self.resp so we can display the result to the user.
This does avoid the panic I encountered with a nonsense request
but im not seeing the error / response displayed, just a blank screen, so im pretty confused. Im looking into it further and I encountered that .unwrap() without an assignment. Whats that for?
The text was updated successfully, but these errors were encountered:
im confused by this.
Why are we unwrapping here, when the value isnt being assigned to anything?
im currently debugging an issue I ran into related to trying to submit nonsense requests. We crashed because later in this function call we try to unwrap an error when we were expecting a value. I fixed that
Now we match on the transfer.perform() and anything that results from it, success or error, will get thrown into self.resp so we can display the result to the user.
This does avoid the panic I encountered with a nonsense request
but im not seeing the error / response displayed, just a blank screen, so im pretty confused. Im looking into it further and I encountered that .unwrap() without an assignment. Whats that for?
The text was updated successfully, but these errors were encountered: