ssnail

crappy and opinionated static site generator
git clone https://git.e1e0.net/ssnail.git
Log | Files | Refs | README | LICENSE

ssnail_error.h (1488B)


      1 /*
      2  * Copyright (c) 2020 Paco Esteban <paco@e1e0.net>
      3  * Copyright (c) 2020 Tracey Emery <tracey@traceyemery.net>
      4  * Copyright (c) 2018, 2019, 2020 Stefan Sperling <stsp@openbsd.org>
      5  *
      6  * Permission to use, copy, modify, and distribute this software for any
      7  * purpose with or without fee is hereby granted, provided that the above
      8  * copyright notice and this permission notice appear in all copies.
      9  *
     10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
     11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
     12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
     13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
     14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
     15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
     16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
     17  */
     18 
     19 #ifndef SSNAIL_ERROR_H
     20 #define SSNAIL_ERROR_H
     21 
     22 /* Error codes */
     23 #define SSNAIL_ERR_OK		0
     24 #define SSNAIL_ERR_ERRNO	1
     25 #define SSNAIL_ERR_GENERIC	2
     26 
     27 static const struct ssnail_error {
     28 	int code;
     29 	const char *msg;
     30 } ssnail_errors[] = {
     31 	{ SSNAIL_ERR_OK,		"no error occured?!?" },
     32 	{ SSNAIL_ERR_ERRNO,		"see errno" },
     33 	{ SSNAIL_ERR_GENERIC,		"error" },
     34 };
     35 
     36 const struct ssnail_error *ssnail_error_msg(int, const char *);
     37 
     38 const struct ssnail_error *ssnail_error_from_errno(const char *);
     39 
     40 void *ssnail_error_fprintf(const struct ssnail_error *);
     41 
     42 #endif /* SSNAIL_ERROR_H */