1
0
mirror of https://github.com/RSS-Bridge/rss-bridge.git synced 2025-08-15 13:04:01 +02:00

bridges: Replace returnError function with more specific

Replacements depend on original error code:
400: returnClientError
404: returnServerError
500: returnServerError
501: returnServerError
This commit is contained in:
logmanoriginal
2016-08-17 14:45:08 +02:00
parent 73a1bcf3d6
commit 74f0572d91
124 changed files with 401 additions and 400 deletions

View File

@@ -11,7 +11,7 @@ class PinterestBridge extends BridgeAbstract{
$this->name = "Pinterest Bridge";
$this->uri = "http://www.pinterest.com";
$this->description = "Returns the newest images on a board";
$this->update = "2016-08-06";
$this->update = '2016-08-17';
$this->parameters["By username and board"] =
'[
@@ -41,26 +41,26 @@ class PinterestBridge extends BridgeAbstract{
if (empty($param['u']))
{
$this->returnError('You must specify a Pinterest username (?u=...).', 400);
$this->returnClientError('You must specify a Pinterest username (?u=...).');
}
if (empty($param['b']))
{
$this->returnError('You must specify a Pinterest board for this username (?b=...).', 400);
$this->returnClientError('You must specify a Pinterest board for this username (?b=...).');
}
$this->username = $param['u'];
$this->board = $param['b'];
$html = $this->file_get_html($this->getURI().'/'.urlencode($this->username).'/'.urlencode($this->board)) or $this->returnError('Username and/or board not found', 404);
$html = $this->file_get_html($this->getURI().'/'.urlencode($this->username).'/'.urlencode($this->board)) or $this->returnServerError('Username and/or board not found');
} else if (isset($param['q']))
{
$this->query = $param['q'];
$html = $this->file_get_html($this->getURI().'/search/?q='.urlencode($this->query)) or $this->returnError('Could not request Pinterest.', 404);
$html = $this->file_get_html($this->getURI().'/search/?q='.urlencode($this->query)) or $this->returnServerError('Could not request Pinterest.');
}
else {
$this->returnError('You must specify a Pinterest username and a board name (?u=...&b=...).', 400);
$this->returnClientError('You must specify a Pinterest username and a board name (?u=...&b=...).');
}