From 57b0a766d872233cd0b82b98478f26a5772587c1 Mon Sep 17 00:00:00 2001 From: heyjun Date: Wed, 24 Jan 2024 13:58:24 +0800 Subject: [PATCH] optimize --- src/DeepLTranslator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DeepLTranslator.php b/src/DeepLTranslator.php index c686db5..6f59a42 100644 --- a/src/DeepLTranslator.php +++ b/src/DeepLTranslator.php @@ -115,7 +115,7 @@ public function result(int $type = self::TYPE_FORMAT) return [ 'status' => self::ERROR, 'code' => $error['code'], - 'message' => sprintf('%s,what:%s', $error['message'], $error['data']['what']), 'data' => [], + 'message' => sprintf('%s,what:%s', $error['message'] ?? '', $error['data']['what'] ?? ''), 'data' => [], ]; }