From abc4af43b3d15c00536f79afb2b9c8557a58a8e3 Mon Sep 17 00:00:00 2001 From: Dag Date: Fri, 8 Jul 2022 20:39:13 +0200 Subject: feat: improve error handling (#2902) --- lib/Exceptions.php | 201 ----------------------------------------------------- 1 file changed, 201 deletions(-) delete mode 100644 lib/Exceptions.php (limited to 'lib/Exceptions.php') diff --git a/lib/Exceptions.php b/lib/Exceptions.php deleted file mode 100644 index 489cf56a..00000000 --- a/lib/Exceptions.php +++ /dev/null @@ -1,201 +0,0 @@ - 0) { - if (count($lables) === 1) { - $uri .= '&labels=' . urlencode($labels[0]); - } else { - foreach ($labels as $label) { - $uri .= '&labels[]=' . urlencode($label); - } - } - } elseif (!is_null($labels) && is_string($labels)) { - $uri .= '&labels=' . urlencode($labels); - } - - // Add maintainer - if (!empty($maintainer)) { - $uri .= '&assignee=' . urlencode($maintainer); - } - - return $uri; -} - -function buildBridgeException(\Throwable $e, BridgeInterface $bridge): string -{ - $title = $bridge->getName() . ' failed with error ' . $e->getCode(); - - // Build a GitHub compatible message - $body = 'Error message: `' - . $e->getMessage() - . "`\nQuery string: `" - . ($_SERVER['QUERY_STRING'] ?? '') - . "`\nVersion: `" - . Configuration::getVersion() - . '`'; - - $body_html = nl2br($body); - $link = buildGitHubIssueQuery($title, $body, 'Bridge-Broken', $bridge->getMaintainer()); - $searchQuery = buildGitHubSearchQuery($bridge::NAME); - - $header = buildHeader($e, $bridge); - $message = <<{$bridge->getName()} was unable to receive or process the -remote website's content!
-{$body_html} -EOD; - $section = buildSection($e, $bridge, $message, $link, $searchQuery); - - return $section; -} - -function buildTransformException(\Throwable $e, BridgeInterface $bridge): string -{ - $title = $bridge->getName() . ' failed with error ' . $e->getCode(); - - // Build a GitHub compatible message - $body = 'Error message: `' - . $e->getMessage() - . "`\nQuery string: `" - . ($_SERVER['QUERY_STRING'] ?? '') - . '`'; - - $link = buildGitHubIssueQuery($title, $body, 'Bridge-Broken', $bridge->getMaintainer()); - $searchQuery = buildGitHubSearchQuery($bridge::NAME); - $header = buildHeader($e, $bridge); - $message = "RSS-Bridge was unable to transform the contents returned by -{$bridge->getName()}!"; - $section = buildSection($e, $bridge, $message, $link, $searchQuery); - - return buildPage($title, $header, $section); -} - -/** - * Builds a new HTML header with data from a exception an a bridge - * - * @param object $e The exception object - * @param object $bridge The bridge object - * @return string The HTML header - * - * @todo This function belongs inside a class - */ -function buildHeader($e, $bridge) -{ - return << -

Error {$e->getCode()}

-

{$e->getMessage()}

-

{$bridge->getName()}

- -EOD; -} - -/** - * Builds a new HTML section - * - * @param object $e The exception object - * @param object $bridge The bridge object - * @param string $message The message to display - * @param string $link The link to include in the anchor - * @param string $searchQuery A GitHub search query for the current bridge - * @return string The HTML section - * - * @todo This function belongs inside a class - */ -function buildSection($e, $bridge, $message, $link, $searchQuery) -{ - return << -

{$message}

-
-
    -
  • Press Return to check your input parameters
  • -
  • Press F5 to retry
  • -
  • Check if this issue was already reported on GitHub (give it a thumbs-up)
  • -
  • Open a GitHub Issue if this error persists
  • -
-
- - - - -

{$bridge->getMaintainer()}

- -EOD; -} - -/** - * Builds a new HTML page - * - * @param string $title The HTML title - * @param string $header The HTML header - * @param string $section The HTML section - * @return string The HTML page - * - * @todo This function belongs inside a class - */ -function buildPage($title, $header, $section) -{ - return << - - - {$title} - - - - {$header} - {$section} - - -EOD; -} -- cgit v1.2.3 tion> Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
AgeCommit message (Expand)AuthorFilesLines
2023-09-01keep export star as (#4451)Gravatar Dylan Conway 1-14/+0
2023-09-01bun-vscode 0.0.8Gravatar Colin McDonnell 3-41/+39
2023-09-01Update commandsGravatar Colin McDonnell 3-4/+6
2023-09-01fix `Bun.serve` with tls and `Bun.file` (#4450)Gravatar Dylan Conway 3-14/+40
2023-09-01exclusive maxGravatar Dylan Conway 1-1/+1
2023-09-01Fix debug console from appears on startGravatar Ashcon Partovi 2-2/+5
2023-09-01Add configuration options to extensionGravatar Ashcon Partovi 5-5/+137
2023-09-01Fix run button starting cwd at /Gravatar Ashcon Partovi 1-0/+2
2023-09-01fix(runtime): fix dns_resolver crash (#4435)Gravatar dave caruso 3-17/+19
2023-09-01Fix background colorGravatar Ashcon Partovi 1-2/+3
2023-09-01Allow older versions of VSCodeGravatar Ashcon Partovi 2-6/+5
2023-09-01Fix README for extensionGravatar Ashcon Partovi 2-7/+12
2023-09-01Update VSCode extensionGravatar Ashcon Partovi 1-3/+4
2023-09-01Fix breakpoint on entry for extensionGravatar Ashcon Partovi 5-18/+15
2023-09-01Add Bun.canReload event to inspectorGravatar Ashcon Partovi 2-0/+17
2023-08-31JavaScript Debug Terminal == Bun TerminalGravatar Ashcon Partovi 1-0/+32
2023-08-31fix(runtime): `fs.cp` edge cases (#4439)Gravatar dave caruso 2-8/+44
2023-08-31only set initial debugger breakpoint once (#4441)Gravatar Dylan Conway 1-2/+11
2023-08-31Make breakpoints faster in VSCode extensionGravatar Ashcon Partovi 1-241/+327
2023-08-31`bun install` correctly join dependency URLs (#4421)Gravatar Julian 6-64/+243
2023-08-31get name if not provided in `FormData.append` (#4434)Gravatar Dylan Conway 4-5/+45
2023-08-31Fix vscode debug terminalGravatar Ashcon Partovi 1-21/+0