Title: catchException catches all exceptions rather than just Error exceptions · Issue #27 · purescript/purescript-exceptions · GitHub
Open Graph Title: catchException catches all exceptions rather than just Error exceptions · Issue #27 · purescript/purescript-exceptions
X Title: catchException catches all exceptions rather than just Error exceptions · Issue #27 · purescript/purescript-exceptions
Description: It seems clear that this package is intended to catch Error exceptions. However, catchException does this: try { return t(); } catch (e) { if (e instanceof Error || Object.prototype.toString.call(e) === "[object Error]") { return c(e)();...
Open Graph Description: It seems clear that this package is intended to catch Error exceptions. However, catchException does this: try { return t(); } catch (e) { if (e instanceof Error || Object.prototype.toString.call(e...
X Description: It seems clear that this package is intended to catch Error exceptions. However, catchException does this: try { return t(); } catch (e) { if (e instanceof Error || Object.prototype.toString.call(e...
Opengraph URL: https://github.com/purescript/purescript-exceptions/issues/27
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"catchException catches all exceptions rather than just Error exceptions","articleBody":"It seems clear that this package is intended to catch `Error` exceptions. However, `catchException` does this:\r\n\r\n```\r\ntry {\r\n return t();\r\n } catch (e) {\r\n if (e instanceof Error || Object.prototype.toString.call(e) === \"[object Error]\") {\r\n return c(e)();\r\n } else {\r\n return c(new Error(e.toString()))();\r\n }\r\n}\r\n```\r\n\r\nThat is, if the exception is determined to not be an `Error` exception, it attempts to convert the exception to an `Error` exception. This conversion itself throws for both `null` and `undefined`, which are possible values. Furthermore, this implementation prevents users from catching other types of exceptions in an obvious way (they would have to use a different catch before this one).\r\n\r\nSuggestion: just rethrow the exception if it is not `Error`.","author":{"url":"https://github.com/eric-corumdigital","@type":"Person","name":"eric-corumdigital"},"datePublished":"2018-04-06T17:43:38Z","url":"https://github.com/purescript/purescript-exceptions/issues/27"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:b2c75be2-0421-b952-ce14-ffe32cfd9d2d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8822:19F84C:E66569:12816E5:6B00F736 |
| html-safe-nonce | 63a35d5ef021ab89d7f16e94bb00ddb00054449decc4d88468c95cfe20762526 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4ODIyOjE5Rjg0QzpFNjY1Njk6MTI4MTZFNTo2QjAwRjczNiIsInZpc2l0b3JfaWQiOiI2Mzg0MzY1NjAxOTI1NjkxMTkwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 9bfbcc47f1f6e58f351ebe1299ad6850e71f1310a13713f30e8bb0b6e6d17ef8 |
| hovercard-subject-tag | issue:312060239 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/purescript/purescript-exceptions/27/issue_layout |
| twitter:image | https://opengraph.githubassets.com/bc7a66963cd705d4e4ef4f5c973c2ddc016492ca7c8cc89ffda6bc1d557d7458/purescript/purescript-exceptions/issues/27 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/bc7a66963cd705d4e4ef4f5c973c2ddc016492ca7c8cc89ffda6bc1d557d7458/purescript/purescript-exceptions/issues/27 |
| og:image:alt | It seems clear that this package is intended to catch Error exceptions. However, catchException does this: try { return t(); } catch (e) { if (e instanceof Error || Object.prototype.toString.call(e... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | eric-corumdigital |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc |
| turbo-cache-control | no-preview |
| go-import | github.com/purescript/purescript-exceptions git https://github.com/purescript/purescript-exceptions.git |
| octolytics-dimension-user_id | 6556677 |
| octolytics-dimension-user_login | purescript |
| octolytics-dimension-repository_id | 17921509 |
| octolytics-dimension-repository_nwo | purescript/purescript-exceptions |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 17921509 |
| octolytics-dimension-repository_network_root_nwo | purescript/purescript-exceptions |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9983dd5da06943f833c971dd5b6bc988e2858be5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width