[SalesForce] Lightning Web Component Custom Errors

I'm trying to do some custom validation on submit for a Lightning Web Component. I'm trying to use the setErrors method for a lightning-input-field (https://developer.salesforce.com/docs/component-library/bundle/lightning-input-field/specification) and nothing seems to be happening.

Does anyone have any examples of how I can get the error message to show or know where I can find one?

handleSubmit(events){
    let f = this.template.querySelector('.myInputField');
    f.setErrors('error message');
    f.reportValidity();
}

Best Answer

The description for the method setErrors on lightning-input-field mentions:

Reserved for internal use.

I would imagine we cannot use any such attribute/method if it is reserved for internal use.