mirror of
https://github.com/maplibre/maplibre-rs.git
synced 2025-12-08 19:05:57 +00:00
Add error message if loading fails
This commit is contained in:
parent
311c97717c
commit
3e8d066ced
@ -5,6 +5,7 @@ use std::sync::{Arc, Condvar, Mutex};
|
|||||||
use log::{error, info};
|
use log::{error, info};
|
||||||
|
|
||||||
use crate::coords::TileCoords;
|
use crate::coords::TileCoords;
|
||||||
|
use crate::error::Error;
|
||||||
use vector_tile::parse_tile_bytes;
|
use vector_tile::parse_tile_bytes;
|
||||||
|
|
||||||
use crate::io::web_tile_fetcher::WebTileFetcher;
|
use crate::io::web_tile_fetcher::WebTileFetcher;
|
||||||
@ -55,21 +56,24 @@ impl Cache {
|
|||||||
let mut current_id = 0;
|
let mut current_id = 0;
|
||||||
loop {
|
loop {
|
||||||
while let Some(coords) = self.requests.pop() {
|
while let Some(coords) = self.requests.pop() {
|
||||||
if let Ok(data) = fetcher.fetch_tile(&coords).await {
|
match fetcher.fetch_tile(&coords).await {
|
||||||
info!("preparing tile {} with {}bytes", &coords, data.len());
|
Ok(data) => {
|
||||||
let tile = parse_tile_bytes(bytemuck::cast_slice(data.as_slice()))
|
info!("preparing tile {} with {}bytes", &coords, data.len());
|
||||||
.expect("failed to load tile");
|
let tile = parse_tile_bytes(bytemuck::cast_slice(data.as_slice()))
|
||||||
|
.expect("failed to load tile");
|
||||||
|
|
||||||
let buffer = tile.tesselate_stroke();
|
let buffer = tile.tesselate_stroke();
|
||||||
self.responses.push(TesselatedTile {
|
self.responses.push(TesselatedTile {
|
||||||
id: current_id,
|
id: current_id,
|
||||||
coords,
|
coords,
|
||||||
over_aligned: buffer.into(),
|
over_aligned: buffer.into(),
|
||||||
});
|
});
|
||||||
current_id += 1;
|
current_id += 1;
|
||||||
info!("tile ready: {:?}", &coords);
|
info!("tile ready: {:?}", &coords);
|
||||||
} else {
|
}
|
||||||
info!("tile failed: {:?}", &coords);
|
Err(err) => {
|
||||||
|
error!("tile failed: {:?}", &err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user