PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.9.5
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.9.5
4.9.5 4.9.4 4.9.3 4.9.2 4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 All 203 releases
betterdocs / react-src / admin / faq-builder / utils / ErrorMessage.js

ErrorMessage.js in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 4.9.5, at react-src/admin/faq-builder/utils/ErrorMessage.js

20 lines 644 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import React from "react";
2 import { decodeEntities } from "@wordpress/html-entities";
3
4 // Defensive: the error state should always be a string (see utils/aiErrorMessage),
5 // but coerce here too so a stray object can never render as "[object Object]".
6 const toText = ( error ) => {
7 if ( ! error ) return "";
8 if ( typeof error === "string" ) return error;
9 return typeof error.message === "string" ? error.message : "";
10 };
11
12 const ErrorMessage = ({ error }) => {
13 const text = toText( error );
14 return ( text && text.length && (
15 <p className="bd-error-message">{decodeEntities( text )}</p>
16 ) ) || "";
17 };
18
19 export default ErrorMessage;
20