Skip to content

Commit

Permalink
Merge pull request #108 from chnrqpd/chatgpt-implementation
Browse files Browse the repository at this point in the history
fix: changing API returns on error to avoid crashes
  • Loading branch information
lokinmodar authored Aug 3, 2024
2 parents 8f1378a + 741af31 commit 60802cb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ChatGPTTranslator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ public async Task<string> TranslateAsync(string text, string sourceLanguage, str
}
else
{
pluginLog.Error($"Translation failed or exceeded 350 characters: {translatedText.Length} characters");
return null;
return $"[Translation Error: Exceeded character limit ({translatedText.Length} characters)]";
}
}
catch (Exception ex)
{
pluginLog.Error($"Translation error: {ex.Message}");
return $"[Translation Error: {ex.Message}]";
}

return null;
Expand Down

0 comments on commit 60802cb

Please sign in to comment.