Title: Define own hierarchy of exceptions? · Issue #248 · python-semver/python-semver · GitHub
Open Graph Title: Define own hierarchy of exceptions? · Issue #248 · python-semver/python-semver
X Title: Define own hierarchy of exceptions? · Issue #248 · python-semver/python-semver
Description: Situation Currently, our code catches an invalid version and raise an exception. This is good. However, the exceptions are usually builtin exceptions like TypeError, ValueError, or AttributeError. This could make it likely, that an semve...
Open Graph Description: Situation Currently, our code catches an invalid version and raise an exception. This is good. However, the exceptions are usually builtin exceptions like TypeError, ValueError, or AttributeError. ...
X Description: Situation Currently, our code catches an invalid version and raise an exception. This is good. However, the exceptions are usually builtin exceptions like TypeError, ValueError, or AttributeError. ...
Opengraph URL: https://github.com/python-semver/python-semver/issues/248
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Define own hierarchy of exceptions?","articleBody":"# Situation\r\n\r\nCurrently, our code catches an invalid version and raise an exception. This is good. However, the exceptions are usually builtin exceptions like `TypeError`, `ValueError`, or `AttributeError`.\r\n\r\nThis could make it likely, that an semver exceptions are \"hidden\". It cannot explicitly be checked that a `TypeError` is coming from semver and not from another, unrelated third party library.\r\n\r\n# Proposal\r\n\r\nThis part could be solved by introducing our own hierarchy of exceptions like so:\r\n\r\n```python\r\nclass InvalidVersionError(ValueError):\r\n \"\"\"Raised by invalid parts in a semver version\"\"\"\r\n```\r\n\r\nThe nice thing about this approach is, any old code would still work (as `InvalidVersionError` is derived from `ValueError`).\r\n\r\n@python-semver/reviewers would that be an option?\r\n","author":{"url":"https://github.com/tomschr","@type":"Person","name":"tomschr"},"datePublished":"2020-05-07T07:53:09.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/248/python-semver/issues/248"}
| 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:a22da983-6157-331e-c903-d10cc1ba0e6b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D6BC:4D5A5:168102A:1F87959:696FD400 |
| html-safe-nonce | 4379fe92b54aa8458d752aedd480b4d4442404ccc5c51685001be103b8cd64f5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJENkJDOjRENUE1OjE2ODEwMkE6MUY4Nzk1OTo2OTZGRDQwMCIsInZpc2l0b3JfaWQiOiI0MTQ4NjMxMjAzNTc5MTU1NDU2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 94705049601303b88c8b57bda4be9daf308c4d5f65c63cc297d87b486da72538 |
| hovercard-subject-tag | issue:613850524 |
| 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/python-semver/python-semver/248/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c22ce3e45f71256d481311f584fe067236fcb3370f30d684b5fea37418e9db6d/python-semver/python-semver/issues/248 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c22ce3e45f71256d481311f584fe067236fcb3370f30d684b5fea37418e9db6d/python-semver/python-semver/issues/248 |
| og:image:alt | Situation Currently, our code catches an invalid version and raise an exception. This is good. However, the exceptions are usually builtin exceptions like TypeError, ValueError, or AttributeError. ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tomschr |
| hostname | github.com |
| expected-hostname | github.com |
| None | a5d30ba41f7d9acded2fd135aa830ac2f5c7e52dca0e776e658d37eaf9dfb033 |
| turbo-cache-control | no-preview |
| go-import | github.com/python-semver/python-semver git https://github.com/python-semver/python-semver.git |
| octolytics-dimension-user_id | 57228994 |
| octolytics-dimension-user_login | python-semver |
| octolytics-dimension-repository_id | 3375726 |
| octolytics-dimension-repository_nwo | python-semver/python-semver |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3375726 |
| octolytics-dimension-repository_network_root_nwo | python-semver/python-semver |
| 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 | 2f945b7bb88421600e89dfefbb1548ad0a44781a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width