qapi-domain.rst 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670
  1. ======================
  2. The Sphinx QAPI Domain
  3. ======================
  4. An extension to the `rST syntax
  5. <https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html>`_
  6. in Sphinx is provided by the QAPI Domain, located in
  7. ``docs/sphinx/qapi_domain.py``. This extension is analogous to the
  8. `Python Domain
  9. <https://www.sphinx-doc.org/en/master/usage/domains/python.html>`_
  10. included with Sphinx, but provides special directives and roles
  11. speciically for annotating and documenting QAPI definitions
  12. specifically.
  13. A `Domain
  14. <https://www.sphinx-doc.org/en/master/usage/domains/index.html>`_
  15. provides a set of special rST directives and cross-referencing roles to
  16. Sphinx for understanding rST markup written to document a specific
  17. language. By itself, this QAPI extension is only sufficient to parse rST
  18. markup written by hand; the `autodoc
  19. <https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html>`_
  20. functionality is provided elsewhere, in ``docs/sphinx/qapidoc.py``, by
  21. the "Transmogrifier".
  22. It is not expected that any developer nor documentation writer would
  23. never need to write *nor* read these special rST forms. However, in the
  24. event that something needs to be debugged, knowing the syntax of the
  25. domain is quite handy. This reference may also be useful as a guide for
  26. understanding the QAPI Domain extension code itself. Although most of
  27. these forms will not be needed for documentation writing purposes,
  28. understanding the cross-referencing syntax *will* be helpful when
  29. writing rST documentation elsewhere, or for enriching the body of
  30. QAPIDoc blocks themselves.
  31. Concepts
  32. ========
  33. The QAPI Domain itself provides no mechanisms for reading the QAPI
  34. Schema or generating documentation from code that exists. It is merely
  35. the rST syntax used to describe things. For instance, the Sphinx Python
  36. domain adds syntax like ``:py:func:`` for describing Python functions in
  37. documentation, but it's the autodoc module that is responsible for
  38. reading python code and generating such syntax. QAPI is analagous here:
  39. qapidoc.py is responsible for reading the QAPI Schema and generating rST
  40. syntax, and qapi_domain.py is responsible for translating that special
  41. syntax and providing APIs for Sphinx internals.
  42. In other words:
  43. qapi_domain.py adds syntax like ``.. qapi:command::`` to Sphinx, and
  44. qapidoc.py transforms the documentation in ``qapi/*.json`` into rST
  45. using directives defined by the domain.
  46. Or even shorter:
  47. ``:py:`` is to ``:qapi:`` as *autodoc* is to *qapidoc*.
  48. Info Field Lists
  49. ================
  50. `Field lists
  51. <https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#field-lists>`_
  52. are a standard syntax in reStructuredText. Sphinx `extends that syntax
  53. <https://www.sphinx-doc.org/en/master/usage/domains/python.html#info-field-lists>`_
  54. to give certain field list entries special meaning and parsing to, for
  55. example, add cross-references. The QAPI Domain takes advantage of this
  56. field list extension to document things like Arguments, Members, Values,
  57. and so on.
  58. The special parsing and handling of info field lists in Sphinx is provided by
  59. three main classes; Field, GroupedField, and TypedField. The behavior
  60. and formatting for each configured field list entry in the domain
  61. changes depending on which class is used.
  62. Field:
  63. * Creates an ungrouped field: i.e., each entry will create its own
  64. section and they will not be combined.
  65. * May *optionally* support an argument.
  66. * May apply cross-reference roles to *either* the argument *or* the
  67. content body, both, or neither.
  68. This is used primarily for entries which are not expected to be
  69. repeated, i.e., items that may only show up at most once. The QAPI
  70. domain uses this class for "Errors" section.
  71. GroupedField:
  72. * Creates a grouped field: i.e. multiple adjacent entries will be
  73. merged into one section, and the content will form a bulleted list.
  74. * *Must* take an argument.
  75. * May optionally apply a cross-reference role to the argument, but not
  76. the body.
  77. * Can be configured to remove the bulleted list if there is only a
  78. single entry.
  79. * All items will be generated with the form: "argument -- body"
  80. This is used for entries which are expected to be repeated, but aren't
  81. expected to have two arguments, i.e. types without names, or names
  82. without types. The QAPI domain uses this class for features, returns,
  83. and enum values.
  84. TypedField:
  85. * Creates a grouped, typed field. Multiple adjacent entres will be
  86. merged into one section, and the content will form a bulleted list.
  87. * *Must* take at least one argument, but supports up to two -
  88. nominally, a name and a type.
  89. * May optionally apply a cross-reference role to the type or the name
  90. argument, but not the body.
  91. * Can be configured to remove the bulleted list if there is only a
  92. single entry.
  93. * All items will be generated with the form "name (type) -- body"
  94. This is used for entries that are expected to be repeated and will have
  95. a name, a type, and a description. The QAPI domain uses this class for
  96. arguments, alternatives, and members. Wherever type names are referenced
  97. below, They must be a valid, documented type that will be
  98. cross-referenced in the HTML output; or one of the built-in JSON types
  99. (string, number, int, boolean, null, value, q_empty).
  100. ``:feat:``
  101. ----------
  102. Document a feature attached to a QAPI definition.
  103. :availability: This field list is available in the body of Command,
  104. Event, Enum, Object and Alternate directives.
  105. :syntax: ``:feat name: Lorem ipsum, dolor sit amet...``
  106. :type: `sphinx.util.docfields.GroupedField
  107. <https://pydoc.dev/sphinx/latest/sphinx.util.docfields.GroupedField.html?private=1>`_
  108. Example::
  109. .. qapi:object:: BlockdevOptionsVirtioBlkVhostVdpa
  110. :since: 7.2
  111. :ifcond: CONFIG_BLKIO
  112. Driver specific block device options for the virtio-blk-vhost-vdpa
  113. backend.
  114. :memb string path: path to the vhost-vdpa character device.
  115. :feat fdset: Member ``path`` supports the special "/dev/fdset/N" path
  116. (since 8.1)
  117. ``:arg:``
  118. ---------
  119. Document an argument to a QAPI command.
  120. :availability: This field list is only available in the body of the
  121. Command directive.
  122. :syntax: ``:arg type name: description``
  123. :type: `sphinx.util.docfields.TypedField
  124. <https://pydoc.dev/sphinx/latest/sphinx.util.docfields.TypedField.html?private=1>`_
  125. Example::
  126. .. qapi:command:: job-pause
  127. :since: 3.0
  128. Pause an active job.
  129. This command returns immediately after marking the active job for
  130. pausing. Pausing an already paused job is an error.
  131. The job will pause as soon as possible, which means transitioning
  132. into the PAUSED state if it was RUNNING, or into STANDBY if it was
  133. READY. The corresponding JOB_STATUS_CHANGE event will be emitted.
  134. Cancelling a paused job automatically resumes it.
  135. :arg string id: The job identifier.
  136. ``:error:``
  137. -----------
  138. Document the error condition(s) of a QAPI command.
  139. :availability: This field list is only available in the body of the
  140. Command directive.
  141. :syntax: ``:error: Lorem ipsum dolor sit amet ...``
  142. :type: `sphinx.util.docfields.Field
  143. <https://pydoc.dev/sphinx/latest/sphinx.util.docfields.Field.html?private=1>`_
  144. The format of the :errors: field list description is free-form rST. The
  145. alternative spelling ":errors:" is also permitted, but strictly
  146. analogous.
  147. Example::
  148. .. qapi:command:: block-job-set-speed
  149. :since: 1.1
  150. Set maximum speed for a background block operation.
  151. This command can only be issued when there is an active block job.
  152. Throttling can be disabled by setting the speed to 0.
  153. :arg string device: The job identifier. This used to be a device
  154. name (hence the name of the parameter), but since QEMU 2.7 it
  155. can have other values.
  156. :arg int speed: the maximum speed, in bytes per second, or 0 for
  157. unlimited. Defaults to 0.
  158. :error:
  159. - If no background operation is active on this device,
  160. DeviceNotActive
  161. ``:return:``
  162. -------------
  163. Document the return type(s) and value(s) of a QAPI command.
  164. :availability: This field list is only available in the body of the
  165. Command directive.
  166. :syntax: ``:return type: Lorem ipsum dolor sit amet ...``
  167. :type: `sphinx.util.docfields.GroupedField
  168. <https://pydoc.dev/sphinx/latest/sphinx.util.docfields.GroupedField.html?private=1>`_
  169. Example::
  170. .. qapi:command:: query-replay
  171. :since: 5.2
  172. Retrieve the record/replay information. It includes current
  173. instruction count which may be used for ``replay-break`` and
  174. ``replay-seek`` commands.
  175. :return ReplayInfo: record/replay information.
  176. .. qmp-example::
  177. -> { "execute": "query-replay" }
  178. <- { "return": {
  179. "mode": "play", "filename": "log.rr", "icount": 220414 }
  180. }
  181. ``:value:``
  182. -----------
  183. Document a possible value for a QAPI enum.
  184. :availability: This field list is only available in the body of the Enum
  185. directive.
  186. :syntax: ``:value name: Lorem ipsum, dolor sit amet ...``
  187. :type: `sphinx.util.docfields.GroupedField
  188. <https://pydoc.dev/sphinx/latest/sphinx.util.docfields.GroupedField.html?private=1>`_
  189. Example::
  190. .. qapi:enum:: QapiErrorClass
  191. :since: 1.2
  192. QEMU error classes
  193. :value GenericError: this is used for errors that don't require a specific
  194. error class. This should be the default case for most errors
  195. :value CommandNotFound: the requested command has not been found
  196. :value DeviceNotActive: a device has failed to be become active
  197. :value DeviceNotFound: the requested device has not been found
  198. :value KVMMissingCap: the requested operation can't be fulfilled because a
  199. required KVM capability is missing
  200. ``:alt:``
  201. ------------
  202. Document a possible branch for a QAPI alternate.
  203. :availability: This field list is only available in the body of the
  204. Alternate directive.
  205. :syntax: ``:alt type name: Lorem ipsum, dolor sit amet ...``
  206. :type: `sphinx.util.docfields.TypedField
  207. <https://pydoc.dev/sphinx/latest/sphinx.util.docfields.TypedField.html?private=1>`_
  208. As a limitation of Sphinx, we must document the "name" of the branch in
  209. addition to the type, even though this information is not visible on the
  210. wire in the QMP protocol format. This limitation *may* be lifted at a
  211. future date.
  212. Example::
  213. .. qapi:alternate:: StrOrNull
  214. :since: 2.10
  215. This is a string value or the explicit lack of a string (null
  216. pointer in C). Intended for cases when 'optional absent' already
  217. has a different meaning.
  218. :alt string s: the string value
  219. :alt null n: no string value
  220. ``:memb:``
  221. ----------
  222. Document a member of an Event or Object.
  223. :availability: This field list is available in the body of Event or
  224. Object directives.
  225. :syntax: ``:memb type name: Lorem ipsum, dolor sit amet ...``
  226. :type: `sphinx.util.docfields.TypedField
  227. <https://pydoc.dev/sphinx/latest/sphinx.util.docfields.TypedField.html?private=1>`_
  228. This is fundamentally the same as ``:arg:`` and ``:alt:``, but uses the
  229. "Members" phrasing for Events and Objects (Structs and Unions).
  230. Example::
  231. .. qapi:event:: JOB_STATUS_CHANGE
  232. :since: 3.0
  233. Emitted when a job transitions to a different status.
  234. :memb string id: The job identifier
  235. :memb JobStatus status: The new job status
  236. Arbitrary field lists
  237. ---------------------
  238. Other field list names, while valid rST syntax, are prohibited inside of
  239. QAPI directives to help prevent accidental misspellings of info field
  240. list names. If you want to add a new arbitrary "non-value-added" field
  241. list to QAPI documentation, you must add the field name to the allow
  242. list in ``docs/conf.py``
  243. For example::
  244. qapi_allowed_fields = {
  245. "see also",
  246. }
  247. Will allow you to add arbitrary field lists in QAPI directives::
  248. .. qapi:command:: x-fake-command
  249. :see also: Lorem ipsum, dolor sit amet ...
  250. Cross-references
  251. ================
  252. Cross-reference `roles
  253. <https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html>`_
  254. in the QAPI domain are modeled closely after the `Python
  255. cross-referencing syntax
  256. <https://www.sphinx-doc.org/en/master/usage/domains/python.html#cross-referencing-python-objects>`_.
  257. QAPI definitions can be referenced using the standard `any
  258. <https://www.sphinx-doc.org/en/master/usage/referencing.html#role-any>`_
  259. role cross-reference syntax, such as with ```query-blockstats```. In
  260. the event that disambiguation is needed, cross-references can also be
  261. written using a number of explicit cross-reference roles:
  262. * ``:qapi:mod:`block-core``` -- Reference a QAPI module. The link will
  263. take you to the beginning of that section in the documentation.
  264. * ``:qapi:cmd:`query-block``` -- Reference a QAPI command.
  265. * ``:qapi:event:`JOB_STATUS_CHANGE``` -- Reference a QAPI event.
  266. * ``:qapi:enum:`QapiErrorClass``` -- Reference a QAPI enum.
  267. * ``:qapi:obj:`BlockdevOptionsVirtioBlkVhostVdpa`` -- Reference a QAPI
  268. object (struct or union)
  269. * ``:qapi:alt:`StrOrNull``` -- Reference a QAPI alternate.
  270. * ``:qapi:type:`BlockDirtyInfo``` -- Reference *any* QAPI type; this
  271. excludes modules, commands, and events.
  272. * ``:qapi:any:`block-job-set-speed``` -- Reference absolutely any QAPI entity.
  273. Type arguments in info field lists are converted into references as if
  274. you had used the ``:qapi:type:`` role. All of the special syntax below
  275. applies to both info field lists and standalone explicit
  276. cross-references.
  277. Type decorations
  278. ----------------
  279. Type names in references can be surrounded by brackets, like
  280. ``[typename]``, to indicate an array of that type. The cross-reference
  281. will apply only to the type name between the brackets. For example;
  282. ``:qapi:type:`[Qcow2BitmapInfoFlags]``` renders to:
  283. :qapi:type:`[Qcow2BitmapInfoFlags]`
  284. To indicate an optional argument/member in a field list, the type name
  285. can be suffixed with ``?``. The cross-reference will be transformed to
  286. "type, Optional" with the link applying only to the type name. For
  287. example; ``:qapi:type:`BitmapSyncMode?``` renders to:
  288. :qapi:type:`BitmapSyncMode?`
  289. Namespaces
  290. ----------
  291. Mimicking the `Python domain target specification syntax
  292. <https://www.sphinx-doc.org/en/master/usage/domains/python.html#target-specification>`_,
  293. QAPI allows you to specify the fully qualified path for a data
  294. type. QAPI enforces globally unique names, so it's unlikely you'll need
  295. this specific feature, but it may be extended in the near future to
  296. allow referencing identically named commands and data types from
  297. different utilities; i.e. QEMU Storage Daemon vs QMP.
  298. * A module can be explicitly provided;
  299. ``:qapi:type:`block-core.BitmapSyncMode``` will render to:
  300. :qapi:type:`block-core.BitmapSyncMode`
  301. * If you don't want to display the "fully qualified" name, it can be
  302. prefixed with a tilde; ``:qapi:type:`~block-core.BitmapSyncMode```
  303. will render to: :qapi:type:`~block-core.BitmapSyncMode`
  304. Custom link text
  305. ----------------
  306. The name of a cross-reference link can be explicitly overridden like
  307. `most stock Sphinx references
  308. <https://www.sphinx-doc.org/en/master/usage/referencing.html#syntax>`_
  309. using the ``custom text <target>`` syntax.
  310. For example, ``:qapi:cmd:`Merge dirty bitmaps
  311. <block-dirty-bitmap-merge>``` will render as: :qapi:cmd:`Merge dirty
  312. bitmaps <block-dirty-bitmap-merge>`
  313. Directives
  314. ==========
  315. The QAPI domain adds a number of custom directives for documenting
  316. various QAPI/QMP entities. The syntax is plain rST, and follows this
  317. general format::
  318. .. qapi:directive:: argument
  319. :option:
  320. :another-option: with an argument
  321. Content body, arbitrary rST is allowed here.
  322. Sphinx standard options
  323. -----------------------
  324. All QAPI directives inherit a number of `standard options
  325. <https://www.sphinx-doc.org/en/master/usage/domains/index.html#basic-markup>`_
  326. from Sphinx's ObjectDescription class.
  327. The dashed spellings of the below options were added in Sphinx 7.2, the
  328. undashed spellings are currently retained as aliases, but will be
  329. removed in a future version.
  330. * ``:no-index:`` and ``:noindex:`` -- Do not add this item into the
  331. Index, and do not make it available for cross-referencing.
  332. * ``no-index-entry:`` and ``:noindexentry:`` -- Do not add this item
  333. into the Index, but allow it to be cross-referenced.
  334. * ``no-contents-entry`` and ``:nocontentsentry:`` -- Exclude this item
  335. from the Table of Contents.
  336. * ``no-typesetting`` -- Create TOC, Index and cross-referencing
  337. entities, but don't actually display the content.
  338. QAPI standard options
  339. ---------------------
  340. All QAPI directives -- *except* for module -- support these common options.
  341. * ``:module: modname`` -- Borrowed from the Python domain, this option allows
  342. you to override the module association of a given definition.
  343. * ``:since: x.y`` -- Allows the documenting of "Since" information, which is
  344. displayed in the signature bar.
  345. * ``:ifcond: CONDITION`` -- Allows the documenting of conditional availability
  346. information, which is displayed in an eyecatch just below the
  347. signature bar.
  348. * ``:deprecated:`` -- Adds an eyecatch just below the signature bar that
  349. advertises that this definition is deprecated and should be avoided.
  350. * ``:unstable:`` -- Adds an eyecatch just below the signature bar that
  351. advertises that this definition is unstable and should not be used in
  352. production code.
  353. qapi:module
  354. -----------
  355. The ``qapi:module`` directive marks the start of a QAPI module. It may have
  356. a content body, but it can be omitted. All subsequent QAPI directives
  357. are associated with the most recent module; this effects their "fully
  358. qualified" name, but has no other effect.
  359. Example::
  360. .. qapi:module:: block-core
  361. Welcome to the block-core module!
  362. Will be rendered as:
  363. .. qapi:module:: block-core
  364. :noindex:
  365. Welcome to the block-core module!
  366. qapi:command
  367. ------------
  368. This directive documents a QMP command. It may use any of the standard
  369. Sphinx or QAPI options, and the documentation body may contain
  370. ``:arg:``, ``:feat:``, ``:error:``, or ``:return:`` info field list
  371. entries.
  372. Example::
  373. .. qapi:command:: x-fake-command
  374. :since: 42.0
  375. :unstable:
  376. This command is fake, so it can't hurt you!
  377. :arg int foo: Your favorite number.
  378. :arg string? bar: Your favorite season.
  379. :return [string]: A lovely computer-written poem for you.
  380. Will be rendered as:
  381. .. qapi:command:: x-fake-command
  382. :noindex:
  383. :since: 42.0
  384. :unstable:
  385. This command is fake, so it can't hurt you!
  386. :arg int foo: Your favorite number.
  387. :arg string? bar: Your favorite season.
  388. :return [string]: A lovely computer-written poem for you.
  389. qapi:event
  390. ----------
  391. This directive documents a QMP event. It may use any of the standard
  392. Sphinx or QAPI options, and the documentation body may contain
  393. ``:memb:`` or ``:feat:`` info field list entries.
  394. Example::
  395. .. qapi:event:: COMPUTER_IS_RUINED
  396. :since: 0.1
  397. :deprecated:
  398. This event is emitted when your computer is *extremely* ruined.
  399. :memb string reason: Diagnostics as to what caused your computer to
  400. be ruined.
  401. :feat sadness: When present, the diagnostic message will also
  402. explain how sad the computer is as a result of your wrongdoings.
  403. Will be rendered as:
  404. .. qapi:event:: COMPUTER_IS_RUINED
  405. :noindex:
  406. :since: 0.1
  407. :deprecated:
  408. This event is emitted when your computer is *extremely* ruined.
  409. :memb string reason: Diagnostics as to what caused your computer to
  410. be ruined.
  411. :feat sadness: When present, the diagnostic message will also explain
  412. how sad the computer is as a result of your wrongdoings.
  413. qapi:enum
  414. ---------
  415. This directive documents a QAPI enum. It may use any of the standard
  416. Sphinx or QAPI options, and the documentation body may contain
  417. ``:value:`` or ``:feat:`` info field list entries.
  418. Example::
  419. .. qapi:enum:: Mood
  420. :ifcond: LIB_PERSONALITY
  421. This enum represents your virtual machine's current mood!
  422. :value Happy: Your VM is content and well-fed.
  423. :value Hungry: Your VM needs food.
  424. :value Melancholic: Your VM is experiencing existential angst.
  425. :value Petulant: Your VM is throwing a temper tantrum.
  426. Will be rendered as:
  427. .. qapi:enum:: Mood
  428. :noindex:
  429. :ifcond: LIB_PERSONALITY
  430. This enum represents your virtual machine's current mood!
  431. :value Happy: Your VM is content and well-fed.
  432. :value Hungry: Your VM needs food.
  433. :value Melancholic: Your VM is experiencing existential angst.
  434. :value Petulant: Your VM is throwing a temper tantrum.
  435. qapi:object
  436. -----------
  437. This directive documents a QAPI structure or union and represents a QMP
  438. object. It may use any of the standard Sphinx or QAPI options, and the
  439. documentation body may contain ``:memb:`` or ``:feat:`` info field list
  440. entries.
  441. Example::
  442. .. qapi:object:: BigBlobOfStuff
  443. This object has a bunch of disparate and unrelated things in it.
  444. :memb int Birthday: Your birthday, represented in seconds since the
  445. UNIX epoch.
  446. :memb [string] Fav-Foods: A list of your favorite foods.
  447. :memb boolean? Bizarre-Docs: True if the documentation reference
  448. should be strange.
  449. Will be rendered as:
  450. .. qapi:object:: BigBlobOfStuff
  451. :noindex:
  452. This object has a bunch of disparate and unrelated things in it.
  453. :memb int Birthday: Your birthday, represented in seconds since the
  454. UNIX epoch.
  455. :memb [string] Fav-Foods: A list of your favorite foods.
  456. :memb boolean? Bizarre-Docs: True if the documentation reference
  457. should be strange.
  458. qapi:alternate
  459. --------------
  460. This directive documents a QAPI alternate. It may use any of the
  461. standard Sphinx or QAPI options, and the documentation body may contain
  462. ``:alt:`` or ``:feat:`` info field list entries.
  463. Example::
  464. .. qapi:alternate:: ErrorCode
  465. This alternate represents an Error Code from the VM.
  466. :alt int ec: An error code, like the type you're used to.
  467. :alt string em: An expletive-laced error message, if your
  468. computer is feeling particularly cranky and tired of your
  469. antics.
  470. Will be rendered as:
  471. .. qapi:alternate:: ErrorCode
  472. :noindex:
  473. This alternate represents an Error Code from the VM.
  474. :alt int ec: An error code, like the type you're used to.
  475. :alt string em: An expletive-laced error message, if your
  476. computer is feeling particularly cranky and tired of your
  477. antics.