Errors¶
The exceptions dexpp raises when it cannot use a file or a model. They all
derive from dexpp.Error, and dexpp.Error is a ValueError. See
errors in Concepts and
errors in the editing guide.
A file problem is not one of these. A path that does not exist raises the
built-in FileNotFoundError. A path that exists but cannot be read (a
directory, a file without read permission) and a file that cannot be written
raise OSError.
Error
¶
Bases: ValueError
The base class of the errors dexpp raises when it cannot use its input.
Catch it to handle every such error in one place. It is a ValueError, so code
that catches ValueError works too.
A path that cannot be opened is not a dexpp.Error. It raises the built-in
FileNotFoundError, or OSError for other file problems.
UnsupportedDexError
¶
Bases: Error
A DEX file uses a format the editable model does not support, such as the version 41 container format.
ModelError
¶
Bases: Error
An operation on a Model failed.
It is the base class of the errors Model.write raises. Model.copy_class and
Model.move_class raise it directly.
InvalidModelError
¶
Bases: ModelError
A Model breaks rules of the DEX format, so it cannot be written.
problems lists every broken rule. Model.validate returns the same list
without raising.
PoolOverflowError
¶
Bases: ModelError
A table of the written DEX file would have more entries than the format allows, for example more than 65,536 methods.
Move classes to another model and write two files. Model.pool_stats() gives the
table sizes before writing.
VersionTooLowError
¶
Bases: ModelError
The Model uses a feature that its DEX version does not have.
Set Model.version to Model.required_version(), or higher, and write again.