source: sasmodels/api/exception.html @ 68532f3

gh-pages
Last change on this file since 68532f3 was 68532f3, checked in by ajj, 8 years ago

Adding docs

  • Property mode set to 100644
File size: 5.5 KB
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
4
5<html xmlns="http://www.w3.org/1999/xhtml">
6  <head>
7    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8   
9    <title>3.5. Annotate exceptions &mdash; Sasmodels</title>
10   
11    <link rel="stylesheet" href="../_static/haiku-site.css" type="text/css" />
12    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
13   
14    <script type="text/javascript">
15      var DOCUMENTATION_OPTIONS = {
16        URL_ROOT:    '../',
17        VERSION:     '0.9',
18        COLLAPSE_INDEX: false,
19        FILE_SUFFIX: '.html',
20        HAS_SOURCE:  true
21      };
22    </script>
23    <script type="text/javascript" src="../_static/jquery.js"></script>
24    <script type="text/javascript" src="../_static/underscore.js"></script>
25    <script type="text/javascript" src="../_static/doctools.js"></script>
26    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
27    <link rel="top" title="Sasmodels" href="../index.html" />
28    <link rel="up" title="3. Reference" href="index.html" />
29    <link rel="next" title="3.6. Model parser" href="generate.html" />
30    <link rel="prev" title="3.4. Simple interface" href="direct_model.html" /> 
31  </head>
32  <body>
33      <div class="header"><h1 class="heading"><a href="../index.html">
34          <span>Home</span></a></h1>
35        <h2 class="heading"><span>3.5. Annotate exceptions</span></h2>
36      </div>
37      <div class="topnav">
38     
39        <p>
40        «&#160;&#160;<a href="direct_model.html">3.4. Simple interface</a>
41        &#160;&#160;::&#160;&#160;
42        <a class="uplink" href="../index.html">Contents</a>
43        &#160;&#160;::&#160;&#160;
44        <a href="generate.html">3.6. Model parser</a>&#160;&#160;»
45        </p>
46
47      </div>
48      <div class="content">
49       
50       
51  <div class="section" id="annotate-exceptions">
52<h1>3.5. Annotate exceptions<a class="headerlink" href="#annotate-exceptions" title="Permalink to this headline">¶</a></h1>
53<div class="section" id="module-sasmodels.exception">
54<span id="sasmodels-exception"></span><h2>3.5.1. <a class="reference internal" href="#module-sasmodels.exception" title="sasmodels.exception"><tt class="xref py py-mod docutils literal"><span class="pre">sasmodels.exception</span></tt></a><a class="headerlink" href="#module-sasmodels.exception" title="Permalink to this headline">¶</a></h2>
55<p>Utility to add annotations to python exceptions.</p>
56<dl class="exception">
57<dt id="sasmodels.exception.WindowsError">
58<em class="property">exception </em><tt class="descclassname">sasmodels.exception.</tt><tt class="descname">WindowsError</tt><a class="headerlink" href="#sasmodels.exception.WindowsError" title="Permalink to this definition">¶</a></dt>
59<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">exceptions.Exception</span></tt></p>
60<dl class="attribute">
61<dt id="sasmodels.exception.WindowsError.args">
62<tt class="descname">args</tt><a class="headerlink" href="#sasmodels.exception.WindowsError.args" title="Permalink to this definition">¶</a></dt>
63<dd></dd></dl>
64
65<dl class="attribute">
66<dt id="sasmodels.exception.WindowsError.message">
67<tt class="descname">message</tt><a class="headerlink" href="#sasmodels.exception.WindowsError.message" title="Permalink to this definition">¶</a></dt>
68<dd></dd></dl>
69
70</dd></dl>
71
72<dl class="function">
73<dt id="sasmodels.exception.annotate_exception">
74<tt class="descclassname">sasmodels.exception.</tt><tt class="descname">annotate_exception</tt><big>(</big><em>exc</em>, <em>msg</em><big>)</big><a class="headerlink" href="#sasmodels.exception.annotate_exception" title="Permalink to this definition">¶</a></dt>
75<dd><p>Add an annotation to the current exception, which can then be forwarded
76to the caller using a bare &#8220;raise&#8221; statement to reraise the annotated
77exception.
78Example:</p>
79<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">D</span> <span class="o">=</span> <span class="p">{}</span>
80<span class="gp">&gt;&gt;&gt; </span><span class="k">try</span><span class="p">:</span>
81<span class="gp">... </span>   <span class="k">print</span> <span class="n">D</span><span class="p">[</span><span class="s">&#39;hello&#39;</span><span class="p">]</span>
82<span class="gp">... </span><span class="k">except</span> <span class="ne">Exception</span><span class="p">,</span><span class="n">exc</span><span class="p">:</span>
83<span class="gp">... </span>   <span class="n">annotate_exception</span><span class="p">(</span><span class="n">exc</span><span class="p">,</span> <span class="s">&quot;while accessing &#39;D&#39;&quot;</span><span class="p">)</span>
84<span class="gp">... </span>   <span class="k">raise</span>
85<span class="gt">Traceback (most recent call last):</span>
86    <span class="o">...</span>
87<span class="gr">KeyError</span>: <span class="n">&quot;hello while accessing &#39;D&#39;&quot;</span>
88</pre></div>
89</div>
90</dd></dl>
91
92</div>
93</div>
94
95
96      </div>
97      <div class="bottomnav">
98     
99        <p>
100        «&#160;&#160;<a href="direct_model.html">3.4. Simple interface</a>
101        &#160;&#160;::&#160;&#160;
102        <a class="uplink" href="../index.html">Contents</a>
103        &#160;&#160;::&#160;&#160;
104        <a href="generate.html">3.6. Model parser</a>&#160;&#160;»
105        </p>
106
107      </div>
108
109    <div class="footer">
110        &copy; Copyright 2014, sasview team.
111      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
112    </div>
113  </body>
114</html>
Note: See TracBrowser for help on using the repository browser.