Shall we have this print the error as well? Also we may want to write tests? Or, if we can find a way to combine this and the print function, then we won't have to be updating/testing them separately.