Errors
Every failure throws a plain Error. Its message says what went wrong, and is
fine to log or show.
try {
await client.checkText(message, 'chat');
} catch (err) {
console.error(err.message);
}
The SDK doesn't retry, and a check that fails isn't charged.
Checks
| Message | What to do |
|---|---|
Invalid API key. | Check the key. Revoked keys stop working at once. |
This organization is out of credit… | An Admin or Owner adds credit on the Usage page. |
No policy set with that name in this project. | Save the set first, with a key from the same project. |
Too many requests for this project. Try again in Ns. | Wait that long, then retry. |
The image is over the 20 MB limit. | Make the image smaller. |
Unrecognised image format… | Use JPEG, PNG, GIF, BMP or WebP. |
This policy set couldn't be prepared for text checks… (or image checks) | Save the same set again. |
Internal server error | Retry after a moment. |
Saving a policy set
| Message | What to do |
|---|---|
This policy set contradicts itself: … | Merge the two rules into one with an exception, or drop one. |
No enforceable rules found. | Write rules about content, e.g. "No threats of violence." |
This holds N rules, over the 40-rule limit… | Split it into smaller sets. |
This policy has too many conditions… | Simplify it, or split it. |
A policy set with that name already exists in this project. | Use another name, or drop ifNotExists. |
This policy set is already being saved… | Wait for that save to finish. |
Saving the policy set failed. | Try again. |
Connection
| Message | What to do |
|---|---|
could not reach the safety service at <url>: … | Check baseUrl, then retry. |
the safety service at <url> didn't answer within <n>ms | Retry, or raise timeoutMs. |