Name

error — Optional

Synopsis

<message to='piers@pipetree.com/Home' from='qmacro@jaber.org' type='error'>
  <body>Are you there?</body>
  <error code='502'>Unable to resolve hostname.</error>
</message>

The <error> subelement is for carrying error information in a problem situation. In this example, the original message sent by piers@pipetree.com was a simple “Are you there?” to what he thought was qmacro’s JID on the Jabber server at jabber.org. However, the to attribute was specified incorrectly (jaber.org), and the Jabber server on pipetree.com wasn’t able to resolve the hostname. So Piers receives his message back with an additional <error/> subelement, and the message type has been switched to error (the type='error' attribute).

The <error/> subelement carries two pieces of related information: an error number, specified in the code attribute, and the error text. Table 5-3 lists standard error codes and texts. The entity generating the error can specify a custom error text to go with the error code; if none is specified, the standard text as shown is used.

Table 5-3. Standard error codes and texts

Code

Text

400

Bad Request

401

Unauthorized

402

Payment Required

403

Forbidden

404

Not Found

405

Not Allowed

406

Not Acceptable

407

Registration Required

408

Request Timeout

409

Conflict

500

Internal Server Error

501

Not Implemented

502

Remove Server Error

503

Service Unavailable

504

Remove Server Timeout

510

Disconnected

Get Programming Jabber now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.