docs: add errors to API docs, add links in docstrings

This commit is contained in:
Andrew Halberstadt 2020-04-07 09:31:36 -04:00
Родитель fa35e9cb85
Коммит 6dedf82d78
4 изменённых файлов: 20 добавлений и 8 удалений

8
docs/api/errors.rst Normal file
Просмотреть файл

@ -0,0 +1,8 @@
Errors
======
Custom exceptions raised by ``mozci``.
.. automodule:: mozci.errors
:members:
:show-inheritance:

Просмотреть файл

@ -6,3 +6,4 @@ API
push
task
errors

Просмотреть файл

@ -140,7 +140,8 @@ class Push:
Push: A `Push` instance representing the parent push.
Raises:
ParentPushNotFound: when no suitable parent push can be detected.
:class:`~mozci.errors.ParentPushNotFound`: When no suitable parent
push can be detected.
"""
# Mozilla-unified and try allow multiple heads, so we can't rely on
# `self.id - 1` to be the parent.
@ -201,7 +202,8 @@ class Push:
Push: A `Push` instance representing the child push.
Raises:
ChildPushNotFound: when no suitable child push can be detected.
:class:`~mozci.errors.ChildPushNotFound`: When no suitable child
push can be detected.
"""
if self.branch not in ("mozilla-unified", "try"):
try:
@ -623,9 +625,10 @@ class Push:
"""The revision of the commit which 'bustage fixes' this one or None.
We detect if a push was 'bustage fixed' with a simple heuristic:
- there is a close enough child push where the task/group passes;
- the child push where the task/group passes is associated to the same bug
as the push of interest.
- there is a close enough child push where the task/group passes;
- the child push where the task/group passes is associated to the same bug
as the push of interest.
Returns:
str or None: The commit revision which 'bustage fixes' this push (or None).

Просмотреть файл

@ -81,7 +81,7 @@ class Task:
Raises:
:class:`~mozci.errors.TaskNotFound`: when the task identified by
specified index or task id could not be found.
specified index or task id could not be found.
"""
if index and "id" not in kwargs:
try:
@ -116,8 +116,8 @@ class Task:
Contents of the artifact.
Raises:
mozci.errors.ArtifactNotFound: When the requested artifact does not
exist.
:class:`~mozci.errors.ArtifactNotFound`: When the requested
artifact does not exist.
"""
try:
data = get_artifact(self.id, path)