Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to document an exception using Sphinx?

I can't seem to figure out how to document exceptions using Sphinx.

I've tried the following:

def some_funct():     """     :raises: ExceptionType: Some multi-line         exception description.     """   def some_funct():     """     :raises: ExceptionType, Some multi-line         exception description.     """   def some_funct():     """     :raises ExceptionType: Some multi-line         exception description.     """   def some_funct():     """     :raises:         ExceptionType: Some multi-line             exception description.     """ 

Sphinx keeps saying:

"Field list ends without a blank line; unexpected unindent."

So how do I get rid of the message and what is the proper way to document possibly multiple exceptions with multiple-line documentation?

like image 875
siebz0r Avatar asked Apr 12 '13 13:04

siebz0r


People also ask

Does Sphinx support markdown?

To support Markdown-based documentation, Sphinx can use MyST-Parser. MyST-Parser is a Docutils bridge to markdown-it-py, a Python package for parsing the CommonMark Markdown flavor.


1 Answers

You can use a backslash for line continuation:

def some_funct():     """     :raises ExceptionType: Some multi-line \         exception description.     """ 

Update:

Indenting seems to work instead of escaping the newline:

def some_funct():     """     :raises ExceptionType: Some multi-line         exception description.     """ 
like image 124
ecatmur Avatar answered Sep 20 '22 23:09

ecatmur