Lots of code from before 0.6 was written in such a way that it would return magnus::Error whenever interacting with anything from Ruby. This worked well. Now, any such code (given the changes to values being made not Send and not Sync) may use Opaque or other types that need to get a handle to a Ruby object.
Calling Ruby::get() returns such handle in a Result but to my surprise the Err branch contains something that is not convertible to a magnus::Error.
how?
To fix this, I propose we add a new case to magnus::ErrorType so that we can impl From<RubyUnavailableError> for Error which would make all old code work by just adding a line to get the ruby handle.
other possibilities
another approach would be to let the user code handle this, with a new enum like
but I think it would be neat if this crate had one Error type which is easy to work with and has good DX on its own. But maybe I'm missing why it would be bad to go the way I propose in this pr
why?
Lots of code from before 0.6 was written in such a way that it would return
magnus::Error
whenever interacting with anything from Ruby. This worked well. Now, any such code (given the changes to values being made notSend
and notSync
) may useOpaque
or other types that need to get a handle to aRuby
object.Calling
Ruby::get()
returns such handle in aResult
but to my surprise theErr
branch contains something that is not convertible to amagnus::Error
.how?
To fix this, I propose we add a new case to
magnus::ErrorType
so that we canimpl From<RubyUnavailableError> for Error
which would make all old code work by just adding a line to get the ruby handle.other possibilities
another approach would be to let the user code handle this, with a new enum like
but I think it would be neat if this crate had one
Error
type which is easy to work with and has good DX on its own. But maybe I'm missing why it would be bad to go the way I propose in this pr