Skip to content

feat(Adapters): Add item context to HTTP errors#2252

Open
marcelklehr wants to merge 11 commits into
developfrom
feat/http-error-with-item-info
Open

feat(Adapters): Add item context to HTTP errors#2252
marcelklehr wants to merge 11 commits into
developfrom
feat/http-error-with-item-info

Conversation

@marcelklehr
Copy link
Copy Markdown
Member

@marcelklehr marcelklehr commented May 8, 2026

and always log response body when HTTP status >= 400

see #2158

and always log response body when HTTP status >= 400

see #2158

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances adapter HTTP error reporting to help diagnose sync failures (notably Karakeep 400 validation errors from #2158) by attaching item context to HttpError and logging response bodies for HTTP status codes ≥ 400.

Changes:

  • Extend HttpError to optionally include the related item in the error message.
  • Thread the current bookmark/folder through adapter request helpers so HttpError can reference the failing item.
  • Add response-body logging on HTTP errors in several adapters (browser + native paths).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/ui/views/native/Home.vue Template formatting/self-closing tag adjustment.
src/lib/adapters/NextcloudBookmarks.ts Pass item context into request helpers and log HTTP error response bodies.
src/lib/adapters/Linkwarden.ts Pass item context into request helpers and log HTTP error response bodies.
src/lib/adapters/Karakeep.ts Pass item context into request helpers and log HTTP error response bodies; adjust folder deletion to provide items.
src/errors/Error.ts Extend HttpError to include optional item context in message.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/lib/adapters/NextcloudBookmarks.ts Outdated
Comment thread src/lib/adapters/NextcloudBookmarks.ts Outdated
Comment thread src/lib/adapters/Linkwarden.ts Outdated
Comment thread src/lib/adapters/Karakeep.ts Outdated
Comment thread src/errors/Error.ts
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

src/lib/adapters/Karakeep.ts:126

  • These resource methods are typed as Bookmark<TItemLocation> / Folder<TItemLocation>, which is broader than the adapter’s declared IResource<typeof ItemLocation.SERVER> contract. Narrowing these to Bookmark<typeof ItemLocation.SERVER> / Folder<typeof ItemLocation.SERVER> helps prevent accidentally passing local-tree items into server calls and keeps typings consistent across adapters.
  async createBookmark(bookmark: Bookmark<TItemLocation>): Promise<string | number> {
    Logger.log('(karakeep)CREATE', { bookmark })
    const response = await this.sendRequest(
      'POST',
      '/api/v1/bookmarks',
      'application/json',

Comment thread src/lib/adapters/Karakeep.ts Outdated
Comment thread src/errors/Error.ts
Comment thread src/lib/adapters/NextcloudBookmarks.ts
Comment thread src/lib/adapters/Karakeep.ts
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
…s code

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Signed-off-by: Marcel Klehr <mklehr@gmx.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants