Enquiry form errors
How MedosEnquiry reports failures — config mistakes that throw, start-up and submission failures that reach onError, and inline field validation.
Only some failures reach onError.
| What went wrong | How you see it | Example |
|---|---|---|
| Bad config | init() throws synchronously | "API key is required" |
| Client can't start | onError(error) | The key was rejected |
| Submission rejected | onError(error) | The server refused the enquiry |
| A field is invalid | Inline validation on the field | A malformed email address |
Config mistakes throw
try {
MedosEnquiry.init({
apiKey: "mk_...",
mode: "inline",
containerId: "medos-enquiry",
});
} catch (err) {
console.error("Medos enquiry failed to start:", err);
}API key is required is thrown when apiKey is missing.
Validation never reaches your code
Every field is validated inline before the form will submit — a bad email shows
a message under the field and blocks submission without calling onError. Treat
onError as "the widget or the server refused", not "the patient typed
something wrong".
Don't branch on message strings
Error message text can change between releases. If you need to branch on error type, ask the platform team about a stable error code.
For problems that apply to every widget — a key that works on one domain but not another, a theme or font that doesn't apply — see Troubleshooting.