Custom Exceptions

Module containing custom exceptions.

exception reemission.exceptions.ConversionMethodUnknownException(conversion_method: str, available_methods: Iterable[str])[source]

Exception raised if a conversion of an object was not possible because the conversion method supplied is unknown.

conversion_method

Name of the conversion method.

Type:

str

exception reemission.exceptions.GasNotRecognizedException(permitted_gases: Tuple[str, ...], message: str = 'Gas not recognized.')[source]

Exception raised if attempting to select gas of unknown name/type.

permitted_gases

Names of recognized emission gases.

Type:

Tuple[str, …]

message

Explanation of the error.

Type:

str

exception reemission.exceptions.TableNotReadException(table: str | list)[source]

Exception raised if a configuration table is not found.

table

Name of the table or list of names of tables that are not found.

Type:

Union[str, list]

exception reemission.exceptions.WrongAreaFractionsException(number_of_fractions: int, number_of_landuses: int, message: str = '')[source]

Exception raised if the number of area fractions does not match the number of land uses.

number_of_fractions

Number of area fractions in a list.

Type:

int

number_of_landuses

Number of pre-defined land uses.

Type:

int

exception reemission.exceptions.WrongN2OModelError(permitted_models: Tuple[str, ...], message: str = 'Model not recognized.')[source]

Exception raised if attempting to calculate with N\(_2\)O emission model of unknown name/type.

permitted_models

Names of recognized N\(_2\)O emission models.

Type:

Tuple[str, …]

message

Explanation of the error.

Type:

str

exception reemission.exceptions.WrongSumOfAreasException(fractions: list, accuracy: float, message: str = '')[source]

Exception raised if area fractions in a supplied list do not sum to 1.

fractions

List of area fractions.

Type:

list

accuracy

Acceptable error in the sum of area fractions.

Type:

float

reemission.exceptions.append_message(exc: Exception, message: str) None[source]

Appends a message to the message text of the given exception.

Parameters:
  • exc (Exception) – The exception instance whose message will be appended.

  • message (str) – The string to append to the exception’s message.

reemission.exceptions.replace_message(exc: Exception, message: str) None[source]

Replaces the exception message with the given message.

Parameters:
  • exc (Exception) – The exception instance whose message will be replaced.

  • message (str) – The string to replace the exception’s message with.