mirror of
https://github.com/lenalebt/obsidian-pocketbook-cloud-highlight-importer.git
synced 2026-07-22 07:40:24 +00:00
better error handling
This commit is contained in:
parent
7b22e0e562
commit
60b251f103
7 changed files with 77 additions and 36 deletions
|
|
@ -258,7 +258,7 @@ export class PocketbookCloudLoginClient {
|
||||||
// use first defined response, if any
|
// use first defined response, if any
|
||||||
const login_response = login_responses.filter(response => response.result).first();
|
const login_response = login_responses.filter(response => response.result).first();
|
||||||
if (!login_response) {
|
if (!login_response) {
|
||||||
throw new Error('Could not log in to Pocketbook Cloud');
|
throw new Error('Could not log in to Pocketbook Cloud - check if username / password are correct.');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.access_token = login_response.result.access_token;
|
this.access_token = login_response.result.access_token;
|
||||||
|
|
|
||||||
|
|
@ -64,12 +64,17 @@ export class PocketbookCloudHighlightsImporterSettingTab extends PluginSettingTa
|
||||||
null,
|
null,
|
||||||
new Date()
|
new Date()
|
||||||
);
|
);
|
||||||
api_client.login();
|
try {
|
||||||
|
await api_client.login();
|
||||||
|
} catch (error) {
|
||||||
|
new Notice(`❌ Error logging in: ${error.message}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.plugin.settings.access_token = await api_client.getAccessToken();
|
this.plugin.settings.access_token = await api_client.getAccessToken();
|
||||||
this.plugin.settings.access_token_valid_until = api_client.getAccessTokenValidUntil();
|
this.plugin.settings.access_token_valid_until = api_client.getAccessTokenValidUntil();
|
||||||
this.plugin.settings.refresh_token = await api_client.getRefreshToken();
|
this.plugin.settings.refresh_token = await api_client.getRefreshToken();
|
||||||
this.plugin.saveSettings();
|
await this.plugin.saveSettings();
|
||||||
|
|
||||||
shop_name_text_field.setValue(this.plugin.settings.shop_name);
|
shop_name_text_field.setValue(this.plugin.settings.shop_name);
|
||||||
|
|
||||||
|
|
|
||||||
1
test-vault/.obsidian/community-plugins.json
vendored
1
test-vault/.obsidian/community-plugins.json
vendored
|
|
@ -1,5 +1,4 @@
|
||||||
[
|
[
|
||||||
"dataview",
|
"dataview",
|
||||||
"obsidian-pocketbook-cloud-highlight-importer",
|
|
||||||
"pocketbook-cloud-highlight-importer"
|
"pocketbook-cloud-highlight-importer"
|
||||||
]
|
]
|
||||||
52
test-vault/.obsidian/core-plugins.json
vendored
52
test-vault/.obsidian/core-plugins.json
vendored
|
|
@ -1,20 +1,32 @@
|
||||||
[
|
{
|
||||||
"file-explorer",
|
"file-explorer": true,
|
||||||
"global-search",
|
"global-search": true,
|
||||||
"switcher",
|
"switcher": true,
|
||||||
"graph",
|
"graph": true,
|
||||||
"backlink",
|
"backlink": true,
|
||||||
"canvas",
|
"canvas": true,
|
||||||
"outgoing-link",
|
"outgoing-link": true,
|
||||||
"tag-pane",
|
"tag-pane": true,
|
||||||
"page-preview",
|
"page-preview": true,
|
||||||
"daily-notes",
|
"daily-notes": true,
|
||||||
"templates",
|
"templates": true,
|
||||||
"note-composer",
|
"note-composer": true,
|
||||||
"command-palette",
|
"command-palette": true,
|
||||||
"editor-status",
|
"slash-command": false,
|
||||||
"bookmarks",
|
"editor-status": true,
|
||||||
"outline",
|
"starred": true,
|
||||||
"word-count",
|
"markdown-importer": false,
|
||||||
"file-recovery"
|
"zk-prefixer": false,
|
||||||
]
|
"random-note": false,
|
||||||
|
"outline": true,
|
||||||
|
"word-count": true,
|
||||||
|
"slides": false,
|
||||||
|
"audio-recorder": false,
|
||||||
|
"workspaces": false,
|
||||||
|
"file-recovery": true,
|
||||||
|
"publish": false,
|
||||||
|
"sync": false,
|
||||||
|
"bookmarks": true,
|
||||||
|
"properties": false,
|
||||||
|
"webviewer": false
|
||||||
|
}
|
||||||
0
test-vault/.obsidian/plugins/pocketbook-cloud-highlight-importer/.gitignore
vendored
Normal file
0
test-vault/.obsidian/plugins/pocketbook-cloud-highlight-importer/.gitignore
vendored
Normal file
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "pocketbook-cloud-highlight-importer",
|
"id": "pocketbook-cloud-highlight-importer",
|
||||||
"name": "Pocketbook Cloud Highlight Importer",
|
"name": "Pocketbook Cloud Highlight Importer",
|
||||||
"version": "0.1.5",
|
"version": "0.1.6",
|
||||||
"minAppVersion": "1.1.16",
|
"minAppVersion": "1.1.16",
|
||||||
"description": "Imports notes and highlights from your Pocketbook Cloud account.",
|
"description": "Imports notes and highlights from your Pocketbook Cloud account.",
|
||||||
"author": "Lena Brüder",
|
"author": "Lena Brüder",
|
||||||
|
|
|
||||||
47
test-vault/.obsidian/workspace.json
vendored
47
test-vault/.obsidian/workspace.json
vendored
|
|
@ -12,7 +12,9 @@
|
||||||
"type": "leaf",
|
"type": "leaf",
|
||||||
"state": {
|
"state": {
|
||||||
"type": "empty",
|
"type": "empty",
|
||||||
"state": {}
|
"state": {},
|
||||||
|
"icon": "lucide-file",
|
||||||
|
"title": "New tab"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
@ -34,8 +36,11 @@
|
||||||
"state": {
|
"state": {
|
||||||
"type": "file-explorer",
|
"type": "file-explorer",
|
||||||
"state": {
|
"state": {
|
||||||
"sortOrder": "alphabetical"
|
"sortOrder": "alphabetical",
|
||||||
}
|
"autoReveal": false
|
||||||
|
},
|
||||||
|
"icon": "lucide-folder-closed",
|
||||||
|
"title": "Files"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -50,7 +55,9 @@
|
||||||
"collapseAll": false,
|
"collapseAll": false,
|
||||||
"extraContext": false,
|
"extraContext": false,
|
||||||
"sortOrder": "alphabetical"
|
"sortOrder": "alphabetical"
|
||||||
}
|
},
|
||||||
|
"icon": "lucide-search",
|
||||||
|
"title": "Search"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -58,7 +65,9 @@
|
||||||
"type": "leaf",
|
"type": "leaf",
|
||||||
"state": {
|
"state": {
|
||||||
"type": "starred",
|
"type": "starred",
|
||||||
"state": {}
|
"state": {},
|
||||||
|
"icon": "lucide-file",
|
||||||
|
"title": "Plugin no longer active"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -66,7 +75,9 @@
|
||||||
"type": "leaf",
|
"type": "leaf",
|
||||||
"state": {
|
"state": {
|
||||||
"type": "bookmarks",
|
"type": "bookmarks",
|
||||||
"state": {}
|
"state": {},
|
||||||
|
"icon": "lucide-bookmark",
|
||||||
|
"title": "Bookmarks"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
@ -96,7 +107,9 @@
|
||||||
"searchQuery": "",
|
"searchQuery": "",
|
||||||
"backlinkCollapsed": false,
|
"backlinkCollapsed": false,
|
||||||
"unlinkedCollapsed": true
|
"unlinkedCollapsed": true
|
||||||
}
|
},
|
||||||
|
"icon": "links-coming-in",
|
||||||
|
"title": "Backlinks"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -107,7 +120,9 @@
|
||||||
"state": {
|
"state": {
|
||||||
"linksCollapsed": false,
|
"linksCollapsed": false,
|
||||||
"unlinkedCollapsed": true
|
"unlinkedCollapsed": true
|
||||||
}
|
},
|
||||||
|
"icon": "links-going-out",
|
||||||
|
"title": "Outgoing links"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -117,8 +132,12 @@
|
||||||
"type": "tag",
|
"type": "tag",
|
||||||
"state": {
|
"state": {
|
||||||
"sortOrder": "frequency",
|
"sortOrder": "frequency",
|
||||||
"useHierarchy": true
|
"useHierarchy": true,
|
||||||
}
|
"showSearch": false,
|
||||||
|
"searchQuery": ""
|
||||||
|
},
|
||||||
|
"icon": "lucide-tags",
|
||||||
|
"title": "Tags"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -126,7 +145,13 @@
|
||||||
"type": "leaf",
|
"type": "leaf",
|
||||||
"state": {
|
"state": {
|
||||||
"type": "outline",
|
"type": "outline",
|
||||||
"state": {}
|
"state": {
|
||||||
|
"followCursor": false,
|
||||||
|
"showSearch": false,
|
||||||
|
"searchQuery": ""
|
||||||
|
},
|
||||||
|
"icon": "lucide-list",
|
||||||
|
"title": "Outline"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue