diff --git a/src/DivanteTranslationBundle/Controller/ObjectController.php b/src/DivanteTranslationBundle/Controller/ObjectController.php index d8c2bf4..8d618ab 100644 --- a/src/DivanteTranslationBundle/Controller/ObjectController.php +++ b/src/DivanteTranslationBundle/Controller/ObjectController.php @@ -59,7 +59,7 @@ public function translateFieldAction(Request $request, ProviderFactory $provider } catch (\Throwable $exception) { return $this->adminJson([ 'success' => false, - 'message' => 'Something went wrong', + 'message' => $exception->getMessage() ]); } diff --git a/src/DivanteTranslationBundle/Provider/DeeplProvider.php b/src/DivanteTranslationBundle/Provider/DeeplProvider.php index 8ae5efe..44fe8e7 100644 --- a/src/DivanteTranslationBundle/Provider/DeeplProvider.php +++ b/src/DivanteTranslationBundle/Provider/DeeplProvider.php @@ -41,7 +41,7 @@ public function translate(string $data, string $targetLanguage): string $body = $response->getBody()->getContents(); $data = json_decode($body, true); } catch (\Throwable $exception) { - throw new TranslationException(); + throw new TranslationException($exception->getMessage()); } return $data['translations'][0]['text'];