Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

clipper: improve error messages

Abdullah Atta9c9582ae121d
diff --git a/extensions/web-clipper/src/stores/app-store.tsx b/extensions/web-clipper/src/stores/app-store.tsx
index 9024682fe..f60fcc0e0 100644
--- a/extensions/web-clipper/src/stores/app-store.tsx
+++ b/extensions/web-clipper/src/stores/app-store.tsx
@@ -61,7 +61,9 @@ export const useAppStore = create<AppStore>((set) => ({
if (!notesnook) {
set({ isLoggingIn: false });
- return;
+ throw new Error(
+ "Please refresh the Notesnook web app to connect with the Web Clipper."
+ );
}
const user = await notesnook.login();
diff --git a/extensions/web-clipper/src/views/main.tsx b/extensions/web-clipper/src/views/main.tsx
index 9920d0ddb..1833c8c69 100644
--- a/extensions/web-clipper/src/views/main.tsx
+++ b/extensions/web-clipper/src/views/main.tsx
@@ -39,6 +39,10 @@ import { FlexScrollContainer } from "../components/scroll-container";
import { DEFAULT_SETTINGS, SETTINGS_KEY } from "./settings";
import type { Config } from "@notesnook/clipper/dist/types";
+const ERROR_MAP: Record<string, string> = {
+ "Could not establish connection. Receiving end does not exist.":
+ "Please refresh this web page and try again. If the error persists, it means you don't have the required permission."
+};
const clipAreas: { name: string; id: ClipArea; icon: string }[] = [
{
name: "Full page",
@@ -293,9 +297,11 @@ export function Main() {
setClipNonce((s) => ++s);
}}
>
- {error}
+ {ERROR_MAP[error] || error}
<br />
- Click here to retry.
+ <Text sx={{ fontSize: 11, color: "error" }}>
+ Click here to try again.
+ </Text>
</Text>
)}