When an Upgrade fails with a non-101 status code the server might include a reason message which can help in debugging. In my case I missed a query parameter which was difficult to find out without actually cloning this project locally and annotating the code with dbg!() calls. With this change we just add the reason to the error message if it's present - debug-printed so there should not be a danger of weird characters sneaking in. This is adding an explicit Result::expect call but as far as I can tell this can only happen if the Debug::fmt implementation of &str fails, hopefully never. Also, an implicit expect is already present in each call to format! which are used in various other places in the library.
When an
Upgrade
fails with a non-101
status code the server might include a reason message which can help in debugging. In my case I missed a query parameter which was difficult to find out without actually cloning this project locally and annotating the code withdbg!()
calls. With this change we just add thereason
to the error message if it's present - debug-printed so there should not be a danger of weird characters sneaking in. This is adding an explicitResult::expect
call but as far as I can tell this can only happen if theDebug::fmt
implementation of&str
fails, hopefully never. Also, an implicitexpect
is already present in each call toformat!
which are used in various other places in the library.