php-doc-en/reference/mongo/mongoprotocolexception.xml
Hannes Magnusson 36c5526571 Document new exceptions
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@332960 c90b9560-bf6c-de11-be94-00142212c4b1
2014-03-11 21:45:16 +00:00

106 lines
2.9 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<phpdoc:classref xml:id="class.mongoprotocolexception" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>The MongoProtocolException class</title>
<titleabbrev>MongoProtocolException</titleabbrev>
<partintro>
<!-- {{{ MongoProtocolException intro -->
<section xml:id="mongoprotocolexception.intro">
&reftitle.intro;
<para>
When talking to MongoDB 2.6.0, and later, certain operations (such as writes) may throw MongoProtocolException when the response
from the server did not make sense - for example during network failure (we could read the entire response) or data corruption.
</para>
<para>
This exception is also thrown when attempting to talk newer protocols then the server supports, for example using the
<classname>MongoWriteBatch</classname> when talking to a MongoDB server prior to 2.6.0.
</para>
</section>
<!-- }}} -->
<section xml:id="mongoprotocolexception.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass><classname>MongoProtocolException</classname></ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<classname>MongoProtocolException</classname>
</ooclass>
<ooclass>
<modifier>extends</modifier>
<classname>MongoException</classname>
</ooclass>
</classsynopsisinfo>
<!-- }}} -->
<classsynopsisinfo role="comment">&InheritedProperties;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('exception.synopsis')/descendant::db:fieldsynopsis)" />
</classsynopsis>
<!-- }}} -->
</section>
<section xml:id="mongoprotocolexception.examples">
&reftitle.examples;
<example xml:id="mongoprotocolexception.example.catch">
<title>Catching MongoProtocolException</title>
<para>
Running the following example against MongoDB prior to 2.6.0 will throw an MongoProtocolException
</para>
<programlisting role="php">
<![CDATA[
<?php
$mc = new MongoClient("localhost");
$c = $mc->selectCollection("test", "test");
try {
$batch = new MongoInsertBatch($c);
} catch(MongoProtocolException $e) {
echo $e->getMessage();
}
?>
]]>
</programlisting>
&examples.outputs.similar;
<screen>
<![CDATA[
Current primary does not have a Write API
]]>
</screen>
</example>
</section>
</partintro>
</phpdoc:classref>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->