1
0
Fork 0
cl-sites/guile.html_node/Error-Reporting.html

118 lines
7 KiB
HTML
Raw Normal View History

2024-12-17 12:49:28 +01:00
<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- This manual documents Guile version 3.0.10.
Copyright (C) 1996-1997, 2000-2005, 2009-2023 Free Software Foundation,
Inc.
Copyright (C) 2021 Maxime Devos
Copyright (C) 2024 Tomas Volf
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
copy of the license is included in the section entitled "GNU Free
Documentation License." -->
<title>Error Reporting (Guile Reference Manual)</title>
<meta name="description" content="Error Reporting (Guile Reference Manual)">
<meta name="keywords" content="Error Reporting (Guile Reference Manual)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content=".texi2any-real">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link href="index.html" rel="start" title="Top">
<link href="Concept-Index.html" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Control-Mechanisms.html" rel="up" title="Control Mechanisms">
<link href="Dynamic-Wind.html" rel="next" title="Dynamic Wind">
<link href="Exceptions.html" rel="prev" title="Exceptions">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
span:hover a.copiable-link {visibility: visible}
strong.def-name {font-family: monospace; font-weight: bold; font-size: larger}
-->
</style>
<link rel="stylesheet" type="text/css" href="https://www.gnu.org/software/gnulib/manual.css">
</head>
<body lang="en">
<div class="subsection-level-extent" id="Error-Reporting">
<div class="nav-panel">
<p>
Next: <a href="Dynamic-Wind.html" accesskey="n" rel="next">Dynamic Wind</a>, Previous: <a href="Exceptions.html" accesskey="p" rel="prev">Exceptions</a>, Up: <a href="Control-Mechanisms.html" accesskey="u" rel="up">Controlling the Flow of Program Execution</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h4 class="subsection" id="Procedures-for-Signaling-Errors"><span>6.11.9 Procedures for Signaling Errors<a class="copiable-link" href="#Procedures-for-Signaling-Errors"> &para;</a></span></h4>
<p>Guile provides a set of convenience procedures for signaling error
conditions that are implemented on top of the exception primitives just
described.
</p>
<dl class="first-deffn">
<dt class="deffn" id="index-error-1"><span class="category-def">Scheme Procedure: </span><span><strong class="def-name">error</strong> <var class="def-var-arguments">msg arg &hellip;</var><a class="copiable-link" href="#index-error-1"> &para;</a></span></dt>
<dd><p>Raise an error with key <code class="code">misc-error</code> and a message constructed by
displaying <var class="var">msg</var> and writing <var class="var">arg</var> <small class="enddots">...</small>.
</p></dd></dl>
<dl class="first-deffn">
<dt class="deffn" id="index-scm_002derror"><span class="category-def">Scheme Procedure: </span><span><strong class="def-name">scm-error</strong> <var class="def-var-arguments">key subr message args data</var><a class="copiable-link" href="#index-scm_002derror"> &para;</a></span></dt>
<dt class="deffnx def-cmd-deffn" id="index-scm_005ferror_005fscm"><span class="category-def">C Function: </span><span><strong class="def-name">scm_error_scm</strong> <var class="def-var-arguments">(key, subr, message, args, data)</var><a class="copiable-link" href="#index-scm_005ferror_005fscm"> &para;</a></span></dt>
<dd><p>Raise an error with key <var class="var">key</var>. <var class="var">subr</var> can be a string
naming the procedure associated with the error, or <code class="code">#f</code>.
<var class="var">message</var> is the error message string, possibly containing
<code class="code">~S</code> and <code class="code">~A</code> escapes. When an error is reported,
these are replaced by formatting the corresponding members of
<var class="var">args</var>: <code class="code">~A</code> (was <code class="code">%s</code> in older versions of
Guile) formats using <code class="code">display</code> and <code class="code">~S</code> (was
<code class="code">%S</code>) formats using <code class="code">write</code>. <var class="var">data</var> is a list or
<code class="code">#f</code> depending on <var class="var">key</var>: if <var class="var">key</var> is
<code class="code">system-error</code> then it should be a list containing the
Unix <code class="code">errno</code> value; If <var class="var">key</var> is <code class="code">signal</code> then it
should be a list containing the Unix signal number; If
<var class="var">key</var> is <code class="code">out-of-range</code>, <code class="code">wrong-type-arg</code>,
or <code class="code">keyword-argument-error</code>,
it is a list containing the bad value; otherwise
it will usually be <code class="code">#f</code>.
</p></dd></dl>
<dl class="first-deffn">
<dt class="deffn" id="index-strerror"><span class="category-def">Scheme Procedure: </span><span><strong class="def-name">strerror</strong> <var class="def-var-arguments">err</var><a class="copiable-link" href="#index-strerror"> &para;</a></span></dt>
<dt class="deffnx def-cmd-deffn" id="index-scm_005fstrerror"><span class="category-def">C Function: </span><span><strong class="def-name">scm_strerror</strong> <var class="def-var-arguments">(err)</var><a class="copiable-link" href="#index-scm_005fstrerror"> &para;</a></span></dt>
<dd><p>Return the Unix error message corresponding to <var class="var">err</var>, an integer
<code class="code">errno</code> value.
</p>
<p>When <code class="code">setlocale</code> has been called (see <a class="pxref" href="Locales.html">Locales</a>), the message
is in the language and charset of <code class="code">LC_MESSAGES</code>. (This is done
by the C library.)
</p></dd></dl>
<dl class="first-deffn">
<dt class="deffn" id="index-false_002dif_002dexception"><span class="category-def">syntax: </span><span><strong class="def-name">false-if-exception</strong> <var class="def-var-arguments">expr</var><a class="copiable-link" href="#index-false_002dif_002dexception"> &para;</a></span></dt>
<dd><p>Returns the result of evaluating its argument; however
if an exception occurs then <code class="code">#f</code> is returned instead.
</p></dd></dl>
</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="Dynamic-Wind.html">Dynamic Wind</a>, Previous: <a href="Exceptions.html">Exceptions</a>, Up: <a href="Control-Mechanisms.html">Controlling the Flow of Program Execution</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Concept-Index.html" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>