encounter / objdiff

A local diffing tool for decompilation projects
Apache License 2.0
79 stars 13 forks source link

Replace panic! with Option in `to_obj_section_kind` #25

Closed NickCondron closed 1 year ago

NickCondron commented 1 year ago

I think this simplifies the code a little and reduces the likelihood of introducing a panic in the future. Maybe in the future we would want to log something if we see an unsupported section.

Btw, I'm curious why so much work is done to convert object:: types to various obj::Obj types? Are there some features of the object crate that are incompatible with objdiff's goals?

encounter commented 1 year ago

The panic happens on a separate thread, where the job system will pick up the error and present it normally. I may prefer replacing the panic! with anyhow::bail!, so it returns an error gracefully. But this change looks good for now.

Converting to the Obj* types is for several reasons: