Added test for error checking, TODO: error equality is not checked correctly