summaryrefslogtreecommitdiff
path: root/guile/src/errors.c
blob: fdc46c4a9b8502fa8717978288b261d7ff07210f (plain)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/* GNUTLS --- Guile bindings for GnuTLS.
   Copyright (C) 2007  Free Software Foundation

   GNUTLS is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   GNUTLS is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with GNUTLS; if not, write to the Free Software
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA  */

/* Written by Ludovic Courtès <ludo@chbouib.org>.  */

#include <libguile.h>
#include <gnutls/gnutls.h>

#include "errors.h"
#include "enums.h"

SCM_SYMBOL (gnutls_error_key, "gnutls-error");

void
scm_gnutls_error (int c_err, const char *c_func)
{
  SCM err, func;

  /* Note: If error code C_ERR is unknown, then ERR will be `#f'.  */
  err = scm_from_gnutls_error (c_err);
  func = scm_from_locale_symbol (c_func);

  (void) scm_throw (gnutls_error_key, scm_list_2 (err, func));

  /* XXX: This is actually never reached, but since the Guile headers don't
     declare `scm_throw ()' as `noreturn', we must add this to avoid GCC's
     complaints.  */
  abort ();
}


void
scm_init_gnutls_error (void)
{
#include "errors.c.x"
}

/* arch-tag: 48f07ecf-65c4-480c-b043-a51eab592d6b
 */