rzumer / dez80

A Z80 instruction decoding and (dis)assembly library.
MIT License
4 stars 1 forks source link

Improve error handling #2

Closed rzumer closed 5 years ago

rzumer commented 5 years ago

Instead of returning an Option<Instruction> from Instruction::decode(), a Result would allow providing the user more details on where an error may have occurred (e.g. differentiating read errors from decoding errors).

rzumer commented 5 years ago

Invalid instructions will be returning an Instruction object with a distinct type field, and hopefully the opcode to allow reassembly. So this leaves I/O errors that can for the most part simply be propagated.

rzumer commented 5 years ago

Since the number of possible cases for returning None has greatly decreased as mentioned in my last comment, I no longer believe that this is needed.