Avoids naming conflict with the stdlib's Error class, also now matches Rust's naming.
Also converts them to data classes.