File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,16 @@ OWSTMSTest >> testTile [
2222	tms url:  ' https://tile.openstreetmap.org/{z}/{x}/{y}.png' 
2323
2424	tile :=  tms tile:  0  y:  0  z:  0 .
25- 
2625	self  assert:  tile height equals:  256 .
2726	self  assert:  tile width equals:  256 
2827]
28+ 
29+ { #category  : #tests  }
30+ OWSTMSTest  >>  testTileNotExists [
31+ 
32+ 	| tile  |
33+ 	tms url:  ' https://tile.thisdomaindoesnotexist.org/{z}/{x}/{y}.png' 
34+ 
35+ 	tile :=  tms tile:  0  y:  0  z:  0 .
36+ 	self  assert:  tile isNil
37+ ]
Original file line number Diff line number Diff line change @@ -15,11 +15,15 @@ OWSTMS >> tile: aX y: aY z: aZ [
1515	tileUrl :=  tileUrl copyReplaceAll:  ' {y}' with:  aY printString.
1616	tileUrl :=  tileUrl copyReplaceAll:  ' {z}' with:  aZ printString.
1717
18- 	result :=  ZnClient  new  
18+ 	result :=  [  ZnClient  new  
1919		url:  tileUrl;
20- 		get.
20+ 		get ] on:  NameLookupFailure  do: [ :ex  |
21+ 		" Cannot reach the url, curently when there is no network, return nil" 
22+ 		nil 
23+ 	].
2124
22- 	result isString ifTrue:  [ (Error  new  messageText:  result) signal  ].
25+ 	result ifNil: [ ^  nil  ].
26+ 	result isString ifTrue:  [ ^  nil  ].
2327
2428	^  Form  fromBinaryStream:  result readStream
2529]
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments