Skip to content
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 Exception handling #17

Open
MajPay opened this issue Mar 6, 2024 · 6 comments
Open

Add Exception handling #17

MajPay opened this issue Mar 6, 2024 · 6 comments

Comments

@MajPay
Copy link

MajPay commented Mar 6, 2024

When the DeeplTranslationService is constructed it may throw an exception when something is wrong with deepl or the apikey (quota limit for example). In that case an error message should be rendered. In the moment the exception is thrown and the backend is no longer usable.

@dmitryd
Copy link
Owner

dmitryd commented Mar 7, 2024

Please, provide a full stack trace.

@MajPay
Copy link
Author

MajPay commented Mar 11, 2024

Really? Its enough to configure a wrong api key.

Simply include the typoscript and add the following constant:

module.tx_dddeepl.settings.apiKey = invalid-key

From now on it's impossible to fix this from the backend, you can not open any module with a page-tree. The same happens if your quota is exhausted.

A DeepL\AuthorizationException exception is thrown by /vendor/deeplcom/deepl-php/src/Translator.php and won't be handled by Dmitryd\DdDeepl\Service\DeeplTranslationService in the constructor.

@MajPay
Copy link
Author

MajPay commented Mar 11, 2024

you can not open any module with a page-tree

So in case you added a wrong api key, you wont be able to fix this without using raw SQL or uninstalling deepl, removing the wrong key, installing it again... So IMO this is pretty severe

@dmitryd
Copy link
Owner

dmitryd commented Mar 11, 2024

Preferred method to set the API key is via environment. I will check. I think it is already solved in the recent version.

@MajPay
Copy link
Author

MajPay commented Mar 13, 2024

I need to add different keys for different sites, so i used the constants.

@saitho
Copy link

saitho commented Oct 4, 2024

Is this still happening in the latest version? We're trying the extension with a free key for now.
Would be bad if the backend was unusable, if the quota is reached. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants