How do you implement an inline validator in the model class?

I’ve got a method which gets called with the attribute name but how do I return an error for it to display?

Any examples about?

For set the error use the function addError

$this->addError('attribute', 'error message');

See also this comment.

Ah, Thought it would be something simple, thanks.