From c73f0b375f433cc2f6c4f91660b5fc99543bd572 Mon Sep 17 00:00:00 2001 From: Krzysztof Marczak Date: Thu, 8 Jul 2021 10:24:31 +0200 Subject: [PATCH] make errors more verbose --- src/DivanteTranslationBundle/Controller/ObjectController.php | 2 +- src/DivanteTranslationBundle/Provider/DeeplProvider.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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'];