File tree Expand file tree Collapse file tree
src/main/java/com/translated/lara Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package com .translated .lara .errors ;
2+
3+ public class LaraApiConnectionTimeoutException extends LaraApiConnectionException {
4+ public LaraApiConnectionTimeoutException (String message ) {
5+ super (message );
6+ }
7+
8+ public LaraApiConnectionTimeoutException (String message , Throwable cause ) {
9+ super (message , cause );
10+ }
11+ }
Original file line number Diff line number Diff line change 66import com .google .gson .JsonParser ;
77import com .translated .lara .errors .LaraApiConnectionException ;
88import com .translated .lara .errors .LaraApiException ;
9+ import com .translated .lara .errors .LaraApiConnectionTimeoutException ;
910
1011import java .io .BufferedReader ;
1112import java .io .IOException ;
1213import java .io .InputStreamReader ;
1314import java .io .Reader ;
1415import java .net .HttpURLConnection ;
16+ import java .net .SocketTimeoutException ;
1517import java .nio .charset .StandardCharsets ;
1618import java .util .ArrayList ;
1719import java .util .Collections ;
@@ -32,6 +34,8 @@ public class ClientResponse {
3234 int httpStatus ;
3335 try {
3436 httpStatus = connection .getResponseCode ();
37+ } catch (SocketTimeoutException e ) {
38+ throw new LaraApiConnectionTimeoutException ("Request timed out" , e );
3539 } catch (IOException e ) {
3640 throw new LaraApiConnectionException ("Failed to get response code" , e );
3741 }
You can’t perform that action at this time.
0 commit comments