squareball  0.2.0.53-dd5b
A general-purpose library for C99
sb-strerror.h File Reference

String error object. More...

#include <stdarg.h>
#include "sb-error.h"

Go to the source code of this file.

Functions

sb_error_tsb_strerror_new (const char *msg)
 
sb_error_tsb_strerror_new_printf (const char *format,...)
 

Detailed Description

String error object.

This is an implementation of sb_error_t object, that only contains a string representing the error. Most of the internal squareball errors are reported using this error type.

It is based on Golang's errorString type, as implemented in the errors package: https://golang.org/pkg/errors/

Users wanting to include custom/non-string data in the error objects should implement a custom error type, as described in squareball/sb-error.h documentation.

Function Documentation

sb_error_t* sb_strerror_new ( const char *  msg)

Function that creates a new string error object.

Parameters
msgHuman-readable error message.
Returns
An error object.
sb_error_t* sb_strerror_new_printf ( const char *  format,
  ... 
)

Function that creates a new string error object, with printf(3)-like message formatting.

Parameters
formatFormat for human-readable error message.
...One or more printf(3)-like parameters.
Returns
An error object.