Fix the propagation of errors in the generated code

Would be nice to expose the usual combinators of the error monad at some point
Initialise the console in the genrated code if needed