Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/core/mentions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ function getUrlErrorMessage(error: unknown): string {
if (errorMessage.includes("net::ERR_INTERNET_DISCONNECTED")) {
return t("common:errors.no_internet")
}
if (errorMessage.includes("net::ERR_ABORTED")) {
return t("common:errors.url_request_aborted")
}
if (errorMessage.includes("403") || errorMessage.includes("Forbidden")) {
return t("common:errors.url_forbidden")
}
Expand Down
1 change: 1 addition & 0 deletions src/i18n/locales/ca/common.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/i18n/locales/de/common.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/i18n/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"no_internet": "No internet connection. Please check your network connection and try again.",
"url_forbidden": "Access to this website is forbidden. The site may block automated access or require authentication.",
"url_page_not_found": "The page was not found. Please check if the URL is correct.",
"url_request_aborted": "The request to fetch the URL was aborted. This may happen if the site blocks automated access, requires authentication, or if there's a network issue. Please try again or check if the URL is accessible in a regular browser.",
"url_fetch_failed": "Failed to fetch URL content: {{error}}",
"url_fetch_error_with_url": "Error fetching content for {{url}}: {{error}}",
"command_timeout": "Command execution timed out after {{seconds}} seconds",
Expand Down
1 change: 1 addition & 0 deletions src/i18n/locales/es/common.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/i18n/locales/fr/common.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/i18n/locales/hi/common.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/i18n/locales/id/common.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/i18n/locales/it/common.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/i18n/locales/ja/common.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/i18n/locales/ko/common.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/i18n/locales/nl/common.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/i18n/locales/pl/common.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/i18n/locales/pt-BR/common.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/i18n/locales/ru/common.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/i18n/locales/tr/common.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/i18n/locales/vi/common.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/i18n/locales/zh-CN/common.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/i18n/locales/zh-TW/common.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions src/services/browser/__tests__/UrlContentFetcher.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,36 @@ describe("UrlContentFetcher", () => {
await expect(urlContentFetcher.urlToMarkdown("https://example.com")).rejects.toThrow("Simple string error")
expect(mockPage.goto).toHaveBeenCalledTimes(1)
})

it("should retry net::ERR_ABORTED like other network errors", async () => {
const abortedError = new Error("net::ERR_ABORTED at https://example.com")
mockPage.goto.mockRejectedValueOnce(abortedError).mockResolvedValueOnce(undefined)

const result = await urlContentFetcher.urlToMarkdown("https://example.com")

expect(mockPage.goto).toHaveBeenCalledTimes(2)
expect(mockPage.goto).toHaveBeenNthCalledWith(1, "https://example.com", {
timeout: 30000,
waitUntil: ["domcontentloaded", "networkidle2"],
})
expect(mockPage.goto).toHaveBeenNthCalledWith(2, "https://example.com", {
timeout: 20000,
waitUntil: ["domcontentloaded"],
})
expect(result).toBe("# Test content")
})

it("should throw error when ERR_ABORTED retry also fails", async () => {
const abortedError = new Error("net::ERR_ABORTED at https://example.com")
const retryError = new Error("net::ERR_CONNECTION_REFUSED")
mockPage.goto.mockRejectedValueOnce(abortedError).mockRejectedValueOnce(retryError)

await expect(urlContentFetcher.urlToMarkdown("https://example.com")).rejects.toThrow(
"net::ERR_CONNECTION_REFUSED",
)

expect(mockPage.goto).toHaveBeenCalledTimes(2)
})
})

describe("closeBrowser", () => {
Expand Down
Loading