Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: When API key is consumed during translation attempt publisher throws an exception

Status Resolved
Add-on / Version Publisher 3.7.4
Severity
EE Version 6.3.5

Gavin @ JCOGS

Sep 27, 2022

As per subject - it seems that the DeepL API is set to throw an exception when it is used with an API key that is exhausted.

Not sure about php API, but in web API it is pretty simple to get status of a key before you use it to trigger a translation, so you can trap such exceptions (though using web api you get a different kind of error).

Would be kinder to the user to trap the exception rather than have EE die a messy death due to the API key…

A suggestion also - you might want to consider adding the option to lodge multiple API keys for DeepL - so that when one is consumed processing will shift to the next one in the list etc.

#1

BoldMinded (Brian)

Try the build in the next comment, it’ll prevent the error and show an alert when the limit has been reached. As for rotating through API keys… that is a feature request that I’ll revisit at a later date.

#2

BoldMinded (Brian)

Comment has been marked private.

#3

Gavin @ JCOGS

Yep - this one does catch the crash, but for unknown reasons has two weirdnesses:

1) The publisher controls have all moved to the “Publisher” tab within the CP - with earlier versions it looks like although this tab was created on page load some kind of process hides the tab and puts the contents above the main publish tab content. Not sure if the change is by design or a regression, but preferred the earlier behaviour.

2) When you execute a translation and then save the results, EE throws out some php warnings on a white screen - to recover session requires editing the URL to only leave the entry_id - however it appears the save is completed, so it is just a bit annoying.

e.g.

<pre><code> Warning Undefined array key “grid_row_id”

ee/ExpressionEngine/Addons/relationship/ft.relationship.php, line 168

Severity: E_WARNING

Warning Cannot modify header information - headers already sent by (output started at ee/legacy/core/Exceptions.php:120)

ee/legacy/core/Input.php, line 266

Severity: E_WARNING

Warning Cannot modify header information - headers already sent by (output started at ee/legacy/core/Exceptions.php:120)

ee/legacy/core/Input.php, line 266

Severity: E_WARNING

Warning Cannot modify header information - headers already sent by (output started at ee/legacy/core/Exceptions.php:120)

ee/legacy/libraries/Functions.php, line 458

Severity: E_WARNING[/code]
#4

BoldMinded (Brian)

Regarding #1 - This has been the add-on’s behavior for years. It moves the contents of the tab out of the tab and into the main publish page so it is always visible.

Regarding #2 -That sounds like a separate issue/ticket, and I need more info provided, hopefully the full call stack so I know what is calling that relationship file, and perhaps screenshots of what you’re trying to save. Is this a Rel field inside of a Grid? Is it a standalone Rel field?

#5

BoldMinded (Brian)

As for the rotating API keys, I’m probably not going to implement such a feature. If you’re hitting the API limit you should probably be paying for a bigger plan 😉

#6

Gavin @ JCOGS

Comment has been marked private.

Login to reply