This could have its own exception class, but I'm not fussed.