houqp / leptess

Productive and safe Rust binding for leptonica and tesseract
https://houqp.github.io/leptess/leptess/index.html
MIT License
258 stars 29 forks source link

Implement Error trait for TessInitError #14

Closed ccouzens closed 4 years ago

ccouzens commented 4 years ago

https://github.com/houqp/leptess/issues/12

The error trait makes it easier to work with errors.

kangalio commented 4 years ago

The explicit source() definition is not needed; std::error::Error provides a default implementation (which is just an empty function, like yours).

Therefore, this should suffice (it's coincidentally also what I have in my fork):

impl std::error::Error for TessInitError {}

But yeah this should make it easier to work with errors. :+1:

ccouzens commented 4 years ago

The explicit source() definition is not needed; std::error::Error provides a default implementation (which is just an empty function, like yours).

Therefore, this should suffice (it's coincidentally also what I have in my fork):

impl std::error::Error for TessInitError {}

But yeah this should make it easier to work with errors. +1

Thanks - I've updated it.