Ignore:
Timestamp:
Sep 1, 2015, 7:30:46 PM (11 years ago)
Author:
Joachim Langenbach <joachim.langenbach@…>
Branches:
master
Children:
cf345ee
Parents:
ff873dc
Message:

Improved setup routine regarding the api test functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/webservice/htdocs/SiWeather/Webservice/Setup.php

    rff873dc r098c36e  
    326326
    327327                # base_url needs to end with a /, otherwise the last element is chopped
    328                 $client = new \GuzzleHttp\Client
    329                 (
    330                         [
    331                                 "base_uri" => $baseUrl,
    332                                 "timeout" => 2.0,
    333                                 "http_errors" => false,
    334                         ]
    335                 );
    336                 $response = $client->get($url);
     328                try{
     329                        $client = new \GuzzleHttp\Client
     330                        (
     331                                [
     332                                        "base_uri" => $baseUrl,
     333                                        "timeout" => 2.0,
     334                                        "http_errors" => false,
     335                                ]
     336                        );
     337                        $response = $client->get($url);
     338                }
     339                catch(\GuzzleHttp\Exception\ConnectException $exception){
     340                        $errorMessage = \Translator::swGettext("Webservce has not answered at url %s! Error: %s", $baseUrl, $exception->getMessage());
     341                        return false;
     342                }
    337343                if(is_null($response)){
    338344                        $errorMessage = \Translator::swGettext("Webservice has not answered at url %s!", $baseUrl);
Note: See TracChangeset for help on using the changeset viewer.