-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add api wrapper with retries (WP-669) #355
Conversation
private function formatError(\Exception $e): string | ||
{ | ||
return $e instanceof SmartlingApiException ? $e->formatErrors() : $e->getMessage(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extracted helper function since \Exception doesn't have formatErrors()
use Smartling\Vendor\Jralph\Retry\Retry; | ||
use Smartling\Vendor\Jralph\Retry\RetryException; | ||
|
||
class ApiWrapperWithRetries implements ApiWrapperInterface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I already left this comment: why not use PHP magic methods instead of implement dumb proxy for each method
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a strong opponent of magic methods, but I've tried experimenting with them for this task. I've found no magic methods that are applicable, so created another wrapper level
No description provided.