Add an Errors module mirroring the Python one
As described in the module doc string, while writing this it dawned upon me that we're mixing all errors together into a single hierarchy (well, type on the Haskell side), which is not good. Some errors are used purely within noded, some in the CLI frontends, etc. so these should not be the same type; frontend functions should only be able to raise frontend errors, not backend ones. As to this patch itself, I've used again Template Haskell to generate both the data type and the serialisation functions, as the initial version, hand-written, seemed too prone to errors due to string matching. A small unittest for checking serialisation consistency is also added. Signed-off-by:Iustin Pop <iustin@google.com> Reviewed-by:
Guido Trotter <ultrotter@google.com>
Showing
- Makefile.am 2 additions, 0 deletionsMakefile.am
- htest/Test/Ganeti/Errors.hs 48 additions, 0 deletionshtest/Test/Ganeti/Errors.hs
- htest/test.hs 2 additions, 0 deletionshtest/test.hs
- htools/Ganeti/Errors.hs 117 additions, 0 deletionshtools/Ganeti/Errors.hs
- htools/Ganeti/THH.hs 108 additions, 0 deletionshtools/Ganeti/THH.hs
htest/Test/Ganeti/Errors.hs
0 → 100644
htools/Ganeti/Errors.hs
0 → 100644
Please register or sign in to comment