sgilmore10 opened a new pull request, #35918:
URL: https://github.com/apache/arrow/pull/35918

   ### Rationale for this change
   This change integrates the latest version of `mathworks/libmexclass` into 
the MATLAB interface which enables throwing  MATLAB errors. 
   
   The  
[77f3d72](https://github.com/mathworks/libmexclass/commit/77f3d72c22a9ddab7b54ba325d757c3e82e57987)
 in `libmexclass` introduced the following changes:
   
   1. Added a new class called `libmexclass::error::Error`.
   2. Added a new field called `error` on the 
`libmexclass::proxy::method::Context` which is a 
`std::optional<libmexclass::proxy::Error>`. By default, this is a 
`std::nullopt`. To make MATLAB throw an error, set this optional. 
   3. To support throwing errors at construction, `libmexclass` now requires 
all `Proxy` subclasses to define a static `make` method: `static 
libmexclass::proxy::MakeResult make(const 
libmexclass::proxy::FunctionArguments& constructor_arguments)`. This workflow 
is similar to using an `arrow::Result<T>`object. 
   
   Examples of throwing errors in MATLAB can be found on lines 
[45](https://github.com/mathworks/libmexclass/blob/77f3d72c22a9ddab7b54ba325d757c3e82e57987/example/proxy/Car.cpp#L45)
 and 
[94](https://github.com/mathworks/libmexclass/blob/77f3d72c22a9ddab7b54ba325d757c3e82e57987/example/proxy/Car.cpp#L94)
 in 
[libmexclass/example/proxy/Car.cpp](https://github.com/mathworks/libmexclass/blob/main/example/proxy/Car.cpp)
   
   ### What changes are included in this PR?
   
   1. Pulled in the latest version of `libmexclass`: 
[77f3d72](https://github.com/mathworks/libmexclass/commit/77f3d72c22a9ddab7b54ba325d757c3e82e57987).
 
   2. Added `static libmexclass::proxy::MakeResult make(const 
libmexclass::proxy::FunctionArguments& constructor_arguments)` to 
`arrow::matlab::proxy::NumericArray<Type>`.
   3.  Throw an error when trying to create an unknown proxy class. 
   
   ### Are these changes tested?
   
   1. Added a new test class called `tGateway.m` that verifies 
`libmexclass.proxy.gateway("Create", ...)` errors if given the name of an 
unknown proxy class.
   
   ### Are there any user-facing changes?
   
   No.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to