-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #199 from Crinibus/error-when-url-is-missing-schema
Raise exception when url has no schema
- Loading branch information
Showing
4 changed files
with
25 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,19 @@ | ||
from scraper.constants import URL_SCHEMES | ||
|
||
|
||
class WebsiteNotSupported(Exception): | ||
def __init__(self, website_name: str, *args: object) -> None: | ||
super().__init__(*args) | ||
self.website_name = website_name | ||
|
||
def __str__(self) -> str: | ||
return f"Website '{self.website_name}' is currently not supported" | ||
|
||
|
||
class URLMissingSchema(Exception): | ||
def __init__(self, url, *args: object) -> None: | ||
super().__init__(*args) | ||
self.url = url | ||
|
||
def __str__(self) -> str: | ||
return f"Missing schema in url '{self.url}'. Consider prefixing the url with one of following schemes: {', '.join(URL_SCHEMES)}" |