forked from BittyTax/BittyTax
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved exception handling for data source config
Data source names in config are now case-insensitive. Accounting/Price tool: display error message if data source name unrecognised. Price tool: display error message if date is invalid.
- Loading branch information
Showing
6 changed files
with
129 additions
and
72 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
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# -*- coding: utf-8 -*- | ||
# (c) Nano Nano Ltd 2020 | ||
|
||
import os | ||
|
||
from ..config import config | ||
from .datasource import DataSourceBase | ||
|
||
class UnexpectedDataSourceError(Exception): | ||
def __init__(self, value): | ||
super(UnexpectedDataSourceError, self).__init__() | ||
self.value = value | ||
|
||
def __str__(self): | ||
return "Invalid data source: \'%s\' in %s, use {%s}" % ( | ||
self.value, | ||
os.path.join(config.BITTYTAX_PATH, config.BITTYTAX_CONFIG), | ||
','.join([ds.__name__ for ds in DataSourceBase.__subclasses__()])) |
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