@wordpress/editor
Version:
Enhanced block editor for WordPress posts.
51 lines (50 loc) • 1.79 kB
JavaScript
// packages/editor/src/utils/sync-error-messages.ts
import { __ } from "@wordpress/i18n";
var AUTHENTICATION_FAILED = "authentication-failed";
var CONNECTION_EXPIRED = "connection-expired";
var CONNECTION_LIMIT_EXCEEDED = "connection-limit-exceeded";
var DOCUMENT_SIZE_LIMIT_EXCEEDED = "document-size-limit-exceeded";
var UNKNOWN_ERROR = "unknown-error";
var ERROR_MESSAGES = {
[]: {
title: __("Unable to connect"),
description: __(
"Real-time collaboration couldn't verify your permissions. Check that you have access to edit this post or contact your site administrator."
)
},
[]: {
title: __("Connection expired"),
description: __(
"Your connection to real-time collaboration has timed out. Editing is paused to prevent conflicts with other editors."
)
},
[]: {
title: __("Too many editors connected"),
description: __(
"Real-time collaboration has reached its connection limit. Try again later or contact your site administrator."
)
},
// DOCUMENT_SIZE_LIMIT_EXCEEDED is not included here because it results in
// collaboration being disabled entirely.
[]: {
title: __("Connection lost"),
description: __(
"The connection to real-time collaboration was interrupted. Editing is paused to prevent conflicts with other editors."
)
}
};
function getSyncErrorMessages(error) {
if (error?.code && ERROR_MESSAGES[error?.code]) {
return ERROR_MESSAGES[error.code];
}
return ERROR_MESSAGES[UNKNOWN_ERROR];
}
export {
AUTHENTICATION_FAILED,
CONNECTION_EXPIRED,
CONNECTION_LIMIT_EXCEEDED,
DOCUMENT_SIZE_LIMIT_EXCEEDED,
UNKNOWN_ERROR,
getSyncErrorMessages
};
//# sourceMappingURL=sync-error-messages.mjs.map