Skip to content

Commit

Permalink
Complete the minimum manual
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuichiueda committed Apr 1, 2017
1 parent 60b0fb6 commit 93c54d5
Show file tree
Hide file tree
Showing 7 changed files with 158 additions and 29 deletions.
49 changes: 40 additions & 9 deletions docs/_sources/error.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,12 @@ The following table shows the list of exit statuses.
Error messages
========================================

When an error occurs, the script stop immediately and gives a message. Here is an example.
When an error occurs, the script stop immediately and gives a message form the standard error. Here is an example.

.. code-block:: bash
:linenos:

$ cat simple_error.glue
import PATH

diff

$ glue ./simple_error.glue
$ glue simple_error.glue
(snip)
Execution error at line 3, char 1
line3: diff
Expand All @@ -58,6 +54,41 @@ When an error occurs, the script stop immediately and gives a message. Here is a
Command error
process_level 0
exit_status 2
pid 90120
ERROR: 2
pid 95348
ERROR: 1

In the message, we can see the part where the error occurs, the cause of the error, the level of shells (how deep is the subshell is invoked), the exit status from the command or something that causes the error, and the process id. Finally, the script gives the exit status of the script with a red string.

When some subshells are invoked, the error message is given by each subshell. This is an example.

.. code-block:: bash
:linenos:

$ cat error_nest.glue
import PATH

proc f = diff

this.f

$ glue error_nest.glue
/usr/bin/diff: missing operand after `/usr/bin/diff'
/usr/bin/diff: Try `/usr/bin/diff --help' for more information.
Execution error at line 1, char 1
line1: diff
^

Command error
process_level 1
exit_status 2
pid 95768
Execution error at line 5, char 1
line5: this.f
^

Command error
process_level 0
exit_status 1
pid 95767
ERROR: 1

82 changes: 72 additions & 10 deletions docs/error.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,18 @@ <h2>8.1. Exit statuses<a class="headerlink" href="#exit-statuses" title="Permali
</div>
<div class="section" id="error-messages">
<h2>8.2. Error messages<a class="headerlink" href="#error-messages" title="Permalink to this headline"></a></h2>
<p>When an error occurs, the script stop immediately and gives a message. Here is an example.</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>cat simple_error.glue
import PATH

diff

<span class="nv">$ </span>glue ./simple_error.glue
<p>When an error occurs, the script stop immediately and gives a message form the standard error. Here is an example.</p>
<div class="highlight-bash"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
2
3
4
5
6
7
8
9
10
11</pre></div></td><td class="code"><div class="highlight"><pre><span class="nv">$ </span>glue simple_error.glue
<span class="o">(</span>snip<span class="o">)</span>
Execution error at line 3, char 1
line3: diff
Expand All @@ -105,10 +110,67 @@ <h2>8.2. Error messages<a class="headerlink" href="#error-messages" title="Perma
Command error
process_level 0
exit_status 2
pid 90120
ERROR: 2
pid 95348
ERROR: 1
</pre></div>
</div>
</td></tr></table></div>
<p>In the message, we can see the part where the error occurs, the cause of the error, the level of shells (how deep is the subshell is invoked), the exit status from the command or something that causes the error, and the process id. Finally, the script gives the exit status of the script with a red string.</p>
<p>When some subshells are invoked, the error message is given by each subshell. This is an example.</p>
<div class="highlight-bash"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27</pre></div></td><td class="code"><div class="highlight"><pre><span class="nv">$ </span>cat error_nest.glue
import PATH

proc <span class="nv">f</span> <span class="o">=</span> diff

this.f

<span class="nv">$ </span>glue error_nest.glue
/usr/bin/diff: missing operand after <span class="sb">`</span>/usr/bin/diff<span class="s1">&#39;</span>
<span class="s1">/usr/bin/diff: Try `/usr/bin/diff --help&#39;</span> <span class="k">for</span> more information.
Execution error at line 1, char 1
line1: diff
^

Command error
process_level 1
exit_status 2
pid 95768
Execution error at line 5, char 1
line5: this.f
^

Command error
process_level 0
exit_status 1
pid 95767
ERROR: 1
</pre></div>
</td></tr></table></div>
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion docs/searchindex.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions examples/error_nest.glue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import PATH

proc f = diff

this.f
Binary file modified manual_src/_build/doctrees/environment.pickle
Binary file not shown.
Binary file modified manual_src/_build/doctrees/error.doctree
Binary file not shown.
49 changes: 40 additions & 9 deletions manual_src/error.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,12 @@ The following table shows the list of exit statuses.
Error messages
========================================

When an error occurs, the script stop immediately and gives a message. Here is an example.
When an error occurs, the script stop immediately and gives a message form the standard error. Here is an example.

.. code-block:: bash
:linenos:
$ cat simple_error.glue
import PATH
diff
$ glue ./simple_error.glue
$ glue simple_error.glue
(snip)
Execution error at line 3, char 1
line3: diff
Expand All @@ -58,6 +54,41 @@ When an error occurs, the script stop immediately and gives a message. Here is a
Command error
process_level 0
exit_status 2
pid 90120
ERROR: 2
pid 95348
ERROR: 1
In the message, we can see the part where the error occurs, the cause of the error, the level of shells (how deep is the subshell is invoked), the exit status from the command or something that causes the error, and the process id. Finally, the script gives the exit status of the script with a red string.

When some subshells are invoked, the error message is given by each subshell. This is an example.

.. code-block:: bash
:linenos:
$ cat error_nest.glue
import PATH
proc f = diff
this.f
$ glue error_nest.glue
/usr/bin/diff: missing operand after `/usr/bin/diff'
/usr/bin/diff: Try `/usr/bin/diff --help' for more information.
Execution error at line 1, char 1
line1: diff
^
Command error
process_level 1
exit_status 2
pid 95768
Execution error at line 5, char 1
line5: this.f
^
Command error
process_level 0
exit_status 1
pid 95767
ERROR: 1

0 comments on commit 93c54d5

Please sign in to comment.