1111 * See the License for the specific language governing permissions and
1212 * limitations under the License.
1313 **/
14- use GuzzleHttp \Client ;
1514use Exception ;
1615use GuzzleHttp \ClientInterface ;
1716use GuzzleHttp \Exception \RequestException ;
@@ -91,11 +90,19 @@ public function checkUser(Summit $summit, string $userId, string $region = Regio
9190 }
9291 catch (RequestException $ ex ) {
9392 Log::warning ($ ex ->getMessage ());
94- return null ;
93+ return [];
94+ }
95+ catch (EmptyResponse $ ex ){
96+ Log::warning ($ ex ->getMessage ());
97+ return [];
98+ }
99+ catch (InvalidResponse $ ex ){
100+ Log::warning ($ ex ->getMessage ());
101+ return [];
95102 }
96103 catch (Exception $ ex ) {
97104 Log::error ($ ex ->getMessage ());
98- return null ;
105+ return [] ;
99106 }
100107 }
101108
@@ -114,7 +121,6 @@ public function checkEmail(Summit $summit,string $email, string $region = Region
114121
115122 Log::debug (sprintf ("SamsungRegistrationAPI::checkEmail POST %s payload %s " , $ this ->endpoint , $ request ));
116123
117-
118124 // http://docs.guzzlephp.org/en/stable/request-options.html
119125 $ response = $ this ->client ->request ('POST ' ,
120126 $ this ->endpoint ,
@@ -138,11 +144,19 @@ public function checkEmail(Summit $summit,string $email, string $region = Region
138144 }
139145 catch (RequestException $ ex ) {
140146 Log::warning ($ ex ->getMessage ());
141- return null ;
147+ return [];
148+ }
149+ catch (EmptyResponse $ ex ){
150+ Log::warning ($ ex ->getMessage ());
151+ return [];
152+ }
153+ catch (InvalidResponse $ ex ){
154+ Log::warning ($ ex ->getMessage ());
155+ return [];
142156 }
143157 catch (Exception $ ex ) {
144158 Log::error ($ ex ->getMessage ());
145- return null ;
159+ return [] ;
146160 }
147161 }
148162
@@ -182,6 +196,14 @@ public function userList(Summit $summit, string $region = Regions::US)
182196 Log::warning ($ ex ->getMessage ());
183197 return null ;
184198 }
199+ catch (EmptyResponse $ ex ){
200+ Log::warning ($ ex ->getMessage ());
201+ return null ;
202+ }
203+ catch (InvalidResponse $ ex ){
204+ Log::warning ($ ex ->getMessage ());
205+ return null ;
206+ }
185207 catch (Exception $ ex ) {
186208 Log::error ($ ex ->getMessage ());
187209 return null ;
0 commit comments