TypeNotInDbError(type_id) should be enough, the message can be generated in the class itself and the type_id can be saved as a property on the error object, so anyone catching it may make use of it.