# coding: utf-8


class ParseError(ValueError):
    exitcode = 2


class SourcesError(IOError):
    exitcode = 3


class ForecastError(ValueError):
    pass


def get_error_code(err):

    if isinstance(err, MemoryError):
        return 1

    return getattr(err, 'exitcode', -1)
