Scott Baker | 86e132c | 2015-02-11 21:38:09 -0800 | [diff] [blame] | 1 | from xos.config import Config |
Sapan Bhatia | eba0843 | 2014-04-28 23:58:36 -0400 | [diff] [blame] | 2 | from util.logger import Logger, logging, logger |
| 3 | |
| 4 | class ErrorMapper: |
| 5 | def __init__(self, error_map_file): |
| 6 | self.error_map = {} |
| 7 | try: |
| 8 | error_map_lines = open(error_map_file).read().splitlines() |
| 9 | for l in error_map_lines: |
| 10 | if (not l.startswith('#')): |
| 11 | splits = l.split('->') |
| 12 | k,v = map(lambda i:i.rstrip(),splits) |
| 13 | self.error_map[k]=v |
| 14 | except: |
| 15 | logging.info('Could not read error map') |
| 16 | |
| 17 | |
| 18 | def map(self, error): |
| 19 | return self.error_map[error] |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |