From 79eb3efb9b5cb7c079f9ebbab11775e2add3414c Mon Sep 17 00:00:00 2001 From: gggeek Date: Fri, 20 Jan 2023 11:30:13 +0000 Subject: [PATCH] add throw_on_fault option to the Wrapper --- NEWS.md | 5 ++++ debugger/action.php | 10 ++++++-- src/Wrapper.php | 62 ++++++++++++++++++++++++++++++++------------- 3 files changed, 57 insertions(+), 20 deletions(-) diff --git a/NEWS.md b/NEWS.md index f5dc55d6..69f0d456 100644 --- a/NEWS.md +++ b/NEWS.md @@ -27,6 +27,9 @@ * new: it is now possible to inject a custom logger into helper classes `Charset`, `Http`, `XMLParser`, inching a step closer to supporting DIC patterns +* new: when calling `Wrapper::wrapXmlrpcMethod`, it is possible to pass 'throw_on_fault' as option to argument + `$extraOptions`. This will make the generated function throw on errors instead of returning a Response object + * improved: all the Client's `setSomething()` methods now return the client object, allowing for usage of fluent style calling. The same applies to `Request::setDebug` @@ -58,6 +61,8 @@ set. We expect this to affect few users, as setting `PhpXmlRpc::$internal_encoding` to a custom character set did not make a lot of sense beforehand - parameters `$timeout` and `$method` are now considered deprecated in `Client::send()` and `Client::multicall()` + - the code generated by the debugger when using "Generate stub for method call" will throw on errors instead of + returning a Response object for library extenders diff --git a/debugger/action.php b/debugger/action.php index ec22c44c..83205c4f 100644 --- a/debugger/action.php +++ b/debugger/action.php @@ -526,7 +526,12 @@ if ($action) { } else { $wrapper = new PhpXmlRpc\Wrapper(); } - $code = $wrapper->buildWrapMethodSource($client, $method, array('timeout' => $timeout, 'protocol' => $proto, 'simple_client_copy' => $opts, 'prefix' => $prefix), str_replace('.', '_', $prefix . '_' . $method), $msig, $mdesc); + $code = $wrapper->buildWrapMethodSource( + $client, + $method, + array('timeout' => $timeout, 'protocol' => $proto, 'simple_client_copy' => $opts, 'prefix' => $prefix, 'throw_on_fault' => true), + str_replace('.', '_', $prefix . '_' . $method), $msig, $mdesc + ); //if ($code) //{ echo "
\n"; @@ -578,7 +583,8 @@ if ($action) {

Changelog