-
Notifications
You must be signed in to change notification settings - Fork 526
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation of exception types #750
Comments
While looking for this info recently; I found that I was able to inspect the subclasses fairly easily with IPython, which looks like so: In [1]: import yaml
In [2]: { YamlErrorSubclass: YamlErrorSubclass.__subclasses__() for YamlErrorSubclass in yaml.error.YAMLError.__subclasses__()}
Out[2]:
{yaml.error.MarkedYAMLError: [yaml.scanner.ScannerError,
yaml.parser.ParserError,
yaml.composer.ComposerError,
yaml.constructor.ConstructorError],
yaml.reader.ReaderError: [],
yaml.resolver.ResolverError: [],
yaml.emitter.EmitterError: [],
yaml.serializer.SerializerError: [],
yaml.representer.RepresenterError: []} Think of it like this: graph TD
yaml.scanner.ScannerError --> yaml.error.MarkedYAMLError --> yaml.error.YAMLError --> Exception
yaml.parser.ParserError --> yaml.error.MarkedYAMLError
yaml.composer.ComposerError --> yaml.error.MarkedYAMLError
yaml.constructor.ConstructorError-->yaml.error.MarkedYAMLError
yaml.reader.ReaderError --> yaml.error.YAMLError;
yaml.resolver.ResolverError --> yaml.error.YAMLError;
yaml.emitter.EmitterError --> yaml.error.YAMLError;
yaml.serializer.SerializerError --> yaml.error.YAMLError;
yaml.representer.RepresenterError --> yaml.error.YAMLError;
I also took a look at the class definitions for each exception and I think I can break it down some more: All exception types in pyyaml are type of
As you have probably already noticed, some exceptions are subclasses of I hope this information is useful and accurate. Apologies if I haven't understood something correctly :o <3 mikey |
I’m looking for a documentation of exception types.
The web documentation only briefly mentions “instance of YAMLError or of its subclass” without further details.
In the source I could so far only find yaml/_yaml.pyx lines 14–23, which appears to be a list of the possible exception classes, but without an explanation of what they mean.
Does such a documentation exist (specifically for/within the Python package or somewhere else)?
Thanks. :)
The text was updated successfully, but these errors were encountered: