Also adds a system for writing tests that assert that certain error codes are triggered so that I could test this.