Skip to content

Commit

Permalink
chore: update error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
nshenderov committed Dec 20, 2024
1 parent e09b663 commit e6e8890
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions admin/src/components/CKEReact.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function CKEReact() {
const handleChangeAssets = useCallback(
(newElems: string): void => {
if (!editorInstance) {
throw new Error('CKEditor: Editor instance is not initialized');
throw new Error('The editor instance has not been initialized.');
}

const viewFragment = editorInstance.data.processor.toView(newElems);
Expand Down Expand Up @@ -94,7 +94,7 @@ export function CKEReact() {
try {
setUpFn(editor);
} catch (err) {
console.error(`CKEditor: Error setting up ${pluginName} plugin `, err);
console.error(`Failed to set up the ${pluginName} plugin `, err);
}
}
});
Expand Down
6 changes: 5 additions & 1 deletion admin/src/components/EditorProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ const EditorContext = createContext<EditorContextValue | null>(null);

export function useEditorContext(): EditorContextValue {
const context = useContext(EditorContext);
if (!context) throw Error('useEditorAttributes can only be used inside EditorProvider');

if (!context) {
throw new Error('The useEditorContext hook must be used within the EditorProvider.');
}

return context;
}

Expand Down
2 changes: 1 addition & 1 deletion admin/src/config/language.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ async function importLang(config: EditorConfig, language: string): Promise<void>
TRANSLATIONS[language] = translation.default;
config.translations = translation.default;
} else {
console.warn(`CKEditor: no translation found for language: ${language}`);
console.warn(`No CKEditor translation found for language: ${language}`);
}
}

Expand Down
4 changes: 2 additions & 2 deletions admin/src/plugins/StrapiMediaLib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class StrapiMediaLib extends Plugin implements StrapiMediaLibPlugin {

public connect(strapiToggle: () => void): void {
if (typeof strapiToggle !== 'function') {
throw new Error('Input parameter for toogle should be a function');
throw new Error('The input parameter for toggle must be a function.');
}

this.strapiToggle = strapiToggle;
Expand All @@ -50,7 +50,7 @@ export class StrapiMediaLib extends Plugin implements StrapiMediaLibPlugin {
public toggle(): void {
if (typeof this.strapiToggle !== 'function') {
throw new Error(
'Strapi media library toggle function not connected. Use connect function first'
'The Strapi Media Library toggle function is not connected. Use the connect function first.'
);
}

Expand Down

0 comments on commit e6e8890

Please sign in to comment.