Add method `#to_h` for Errors