mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2026-04-19 21:58:08 -04:00
Refactored translation of exception messages
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
namespace PrivateBin\Proxy;
|
||||
|
||||
use PrivateBin\Configuration;
|
||||
use PrivateBin\Exception\JsonException;
|
||||
use PrivateBin\Json;
|
||||
|
||||
/**
|
||||
@@ -48,12 +49,17 @@ class ShlinkProxy extends AbstractProxy
|
||||
'longUrl' => $link,
|
||||
);
|
||||
|
||||
return array(
|
||||
'method' => 'POST',
|
||||
'header' => "Content-Type: application/json\r\n" .
|
||||
'X-Api-Key: ' . $shlink_api_key . "\r\n",
|
||||
'content' => Json::encode($body),
|
||||
);
|
||||
try {
|
||||
return array(
|
||||
'method' => 'POST',
|
||||
'header' => "Content-Type: application/json\r\n" .
|
||||
'X-Api-Key: ' . $shlink_api_key . "\r\n",
|
||||
'content' => Json::encode($body),
|
||||
);
|
||||
} catch (JsonException $e) {
|
||||
error_log('[' . get_class($this) . '] Error encoding body: ' . $e->getMessage());
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user