This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
phptsmadmin/includes/jpgraph/docs/chunkhtml/ch06s02.html

79 lines
8.3 KiB
HTML
Raw Normal View History

2011-05-28 09:51:52 +00:00
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Available error messages</title><link rel="stylesheet" type="text/css" href="manual.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.0"><link rel="home" href="index.html" title="JpGraph Manual"><link rel="up" href="ch06.html" title="Chapter 6. Error handling"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Available error messages</th></tr><tr><td width="20%" align="left"> </td><th width="60%" align="center">Chapter 6. Error handling</th><td width="20%" align="right"> </td></tr></table><hr></div><div class="sect1" title="Available error messages"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="id2495499"></a>Available error messages</h2></div></div></div>
<p>All error messages that can be generated by the library are listed in <a class="xref" href="aph.html" title="Appendix H. Error messages">Appendix H. <i>Error messages</i></a></p>
<div class="sect2" title="Localizing error messages"><div class="titlepage"><div><div><h3 class="title"><a name="sec2.localizing-errmsg"></a>Localizing error messages</h3></div></div></div>
<p>The library includes two (actually two and one pseudo) localizations of the
error messages. As of version 2.5 the library supports English and German error
messages. The choice of which localization of error messages that should be used
can be done in two ways; either by specifying a global define in
jpg-config.inc.php or</p>
<p>As of version 2.5 there are three localization options</p>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<p>English error messages ("en")</p>
</li><li class="listitem">
<p>German error messages ("de")</p>
</li><li class="listitem">
<p>Production error messages. This is not really a localization but a
different set of error messages which does not give detailed error
messages but a generic message suitable for a production server
where the end user is not helped by detailed graph script errors.
Instead a generic message is shown together with an error code that
corresponds to the detailed error. ("prod")</p>
</li></ol></div><p>In order to specify the error message localization the following
define in <code class="filename">jpg-config.inc.php</code> must be set the </p>
<p><code class="code">define('DEFAULT_ERR_LOCALE','en');</code></p>
<p>The possible (string) options are</p>
<div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
<p>"en", English locale</p>
</li><li class="listitem">
<p>"de", German locale</p>
</li><li class="listitem">
<p>"prod", The production version of the error messages.</p>
</li></ol></div><p>It is also possible to dynamically set the localization of error
messages by calling the static method
<code class="code">JpGraphErr::SetErrLocale($aLocaleString)</code> .For example, in order
to dynamically change to German locale the following method call would be
used:</p>
<p><code class="code">JpGraphErr::SetErrLocale('de');</code></p>
<p>As an example of the German locale the "<span class="italic">Header Already Sent</span>" error message localized in
German are shown in <a class="xref" href="ch06s02.html#fig.errmsg-de-headers-sent" title='Figure 6.3. The "Header already sent" error message using German locale'>Figure 6.3. The "Header already sent" error message using German locale</a></p>
<div class="figure"><a name="fig.errmsg-de-headers-sent"></a><p class="title"><b>Figure 6.3. The "Header already sent" error message using German locale</b></p><div class="figure-contents">
<div class="mediaobject"><img src="images/errmsg-headersent-de.png" alt='The "Header already sent" error message using German locale'></div>
</div></div><br class="figure-break">
<div class="note" title="Note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3>
<p>There is one potential issue with specifying the locale dynamically. Since
the call to set the locale happens in the script at a certain point this
means that if the error occur before that point the locale change has not
yet happened and the default locale specified in
<code class="filename">jpg-config.inc.php</code> will be used.</p>
</div>
</div>
<div class="sect2" title="Error messages on a production server"><div class="titlepage"><div><div><h3 class="title"><a name="id2495515"></a>Error messages on a production server</h3></div></div></div>
<p>On a production server it is common not to show detailed specific error
messages to the public which could potentially give a away security
vulnerabilities. For this purpose there is a "pseudo" locale of the error
messages. This is specified by setting the locale (as described above) to the
string "prod". If this is done a generic error message with an error code will
be shown instead. The custom support receiving information on this error can
then pass on the detailed error code to the development team for further
investigation. In <a class="xref" href="ch06s02.html#fig.pseudo-locale" title='Figure 6.4. Using the production "pseudo" locale'>Figure 6.4. Using the production "pseudo" locale</a> the same error as is shown in <a class="xref" href="ch06.html#fig.errmsg-ex1" title="Figure 6.1. Typical image error message">Figure 6.1. Typical image error message</a> is displayed using the "prod" locale. As you
can see in this case only a more end-user appropriate message together with the
error code is displayed.</p>
<div class="figure"><a name="fig.pseudo-locale"></a><p class="title"><b>Figure 6.4. Using the production "pseudo" locale</b></p><div class="figure-contents">
<div class="mediaobject"><img src="images/errmsg-prod.png" alt='Using the production "pseudo" locale'></div>
</div></div><br class="figure-break">
<p>The problem number corresponds to the error codes that are listed in <a class="xref" href="aph.html" title="Appendix H. Error messages">Appendix H. <i>Error messages</i></a></p>
<p>
</p><div class="tip" title="Tip" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Tip</h3>
<p>It is possible to customize this "production" error message by
changing the actual text in the file
"<code class="filename">lang/prod.inc.php</code>"</p>
</div><p>
</p>
</div>
</div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"> </td><td width="20%" align="center"><a accesskey="u" href="ch06.html">Up</a></td><td width="40%" align="right"> </td></tr><tr><td width="40%" align="left" valign="top"> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> </td></tr></table></div></body></html>