Hello, I would like to suggest a patch for the ruby augeas bindings to allow for fine grained exceptions like the ones in the C code.
I originally submitted this as a pull request on github[1], but seeing as I got no response there, I will copy the content of that message here as well: I was annoyed at the fact that most augeas errors pass silently, only returning an error code, which meant having to check after each command if there actually was an error. I think that behaviour is very C-like and not very ruby like. Instead I think the user should be prompted immediately when an error happened and which kind of error it was. This code does the following: - raises ruby exceptions on error (these are the same as the ones in the C library, they have the same message, but their names were changed to be more suggestive (e.g. ECMDRUN -> CommandExecutionError) - almost all commands are now declared in the ruby module and passed through a run_command private method which checks for errors and raises them (the corresponding methods from the C bindings file are now private) - a lot of new unit tests have been added for all the new errors and a few for normal invocation of methods which lacked unit tests before There are some issues remaining, mostly around the load and save commands which seem to have quite a different policy about errors (1. storing them in the augeas tree, 2. returning success when failing in case of load), but that should be a different issue. Thanks! -Ionuț [1] https://github.com/lutter/ruby-augeas/pull/1 _______________________________________________ augeas-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/augeas-devel
