Two reasons:<p>1. mainly: the C library has no concept of “wrong password”; only “verification failed with an error”.  If you want to know <i>why</i> it failed, you need the error.  As you can see in the example, a wrong password is &quot;Decoding failed” which can also be your fault.  It seems like they want to interpret their own failures as little possible.  Therefore raising an exception with the error seemed the best way forward.
2. secondarily: in security context, I tend to prefer loud failures for dangerous problems so they don’t pass unnoticed by accident. ymmv