mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-03-04 17:23:33 +01:00
main: improve process_region() error handling
This commit is contained in:
parent
b2d849081d
commit
fd0c9fbf1b
1 changed files with 7 additions and 12 deletions
19
src/main.rs
19
src/main.rs
|
@ -37,19 +37,14 @@ impl RegionProcessor {
|
|||
/// Processes a single region file
|
||||
fn process_region(&self, path: &Path, _x: i32, _z: i32) -> Result<()> {
|
||||
minedmap::io::region::from_file(path)?.foreach_chunk(|coords, data: world::de::Chunk| {
|
||||
let chunk = match world::chunk::Chunk::new(&data) {
|
||||
Ok(chunk) => chunk,
|
||||
Err(err) => {
|
||||
eprintln!("Chunk {:?}: {}", coords, err);
|
||||
return Ok(());
|
||||
}
|
||||
};
|
||||
(|| -> Result<()> {
|
||||
let chunk = world::chunk::Chunk::new(&data)?;
|
||||
|
||||
match world::layer::top_layer(&chunk, &self.block_types) {
|
||||
Ok(_) => {}
|
||||
Err(err) => println!("{:?}", err),
|
||||
};
|
||||
Ok(())
|
||||
let _top_layer = world::layer::top_layer(&chunk, &self.block_types)?;
|
||||
|
||||
Ok(())
|
||||
})()
|
||||
.with_context(|| format!("Failed to process chunk {:?}", coords))
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue