11
11
12
12
namespace Symfony \Component \HttpClient \Chunk ;
13
13
14
+ use Symfony \Component \HttpClient \Exception \TimeoutException ;
14
15
use Symfony \Component \HttpClient \Exception \TransportException ;
15
16
use Symfony \Contracts \HttpClient \ChunkInterface ;
16
17
@@ -61,7 +62,7 @@ public function isTimeout(): bool
61
62
public function isFirst (): bool
62
63
{
63
64
$ this ->didThrow = true ;
64
- throw new TransportException ($ this ->errorMessage , 0 , $ this ->error );
65
+ throw null !== $ this -> error ? new TransportException ($ this ->errorMessage , 0 , $ this ->error ) : new TimeoutException ( $ this -> errorMessage );
65
66
}
66
67
67
68
/**
@@ -70,7 +71,7 @@ public function isFirst(): bool
70
71
public function isLast (): bool
71
72
{
72
73
$ this ->didThrow = true ;
73
- throw new TransportException ($ this ->errorMessage , 0 , $ this ->error );
74
+ throw null !== $ this -> error ? new TransportException ($ this ->errorMessage , 0 , $ this ->error ) : new TimeoutException ( $ this -> errorMessage );
74
75
}
75
76
76
77
/**
@@ -79,7 +80,7 @@ public function isLast(): bool
79
80
public function getInformationalStatus (): ?array
80
81
{
81
82
$ this ->didThrow = true ;
82
- throw new TransportException ($ this ->errorMessage , 0 , $ this ->error );
83
+ throw null !== $ this -> error ? new TransportException ($ this ->errorMessage , 0 , $ this ->error ) : new TimeoutException ( $ this -> errorMessage );
83
84
}
84
85
85
86
/**
@@ -88,7 +89,7 @@ public function getInformationalStatus(): ?array
88
89
public function getContent (): string
89
90
{
90
91
$ this ->didThrow = true ;
91
- throw new TransportException ($ this ->errorMessage , 0 , $ this ->error );
92
+ throw null !== $ this -> error ? new TransportException ($ this ->errorMessage , 0 , $ this ->error ) : new TimeoutException ( $ this -> errorMessage );
92
93
}
93
94
94
95
/**
@@ -119,7 +120,7 @@ public function __destruct()
119
120
{
120
121
if (!$ this ->didThrow ) {
121
122
$ this ->didThrow = true ;
122
- throw new TransportException ($ this ->errorMessage , 0 , $ this ->error );
123
+ throw null !== $ this -> error ? new TransportException ($ this ->errorMessage , 0 , $ this ->error ) : new TimeoutException ( $ this -> errorMessage );
123
124
}
124
125
}
125
126
}
0 commit comments