---
name: "globus_error_generic.h"
section: "3"
platform: "linux"
package: "libglobus-common-doc"
version: "18.14-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/globus_error_generic.h"
---

# globus\_error\_generic.h(3)

Globus Error API.

## NAME

globus\_error\_generic.h - Globus Error API.

## SYNOPSIS

`#include 'globus_object.h'`\
 `#include 'globus_module.h'`\
 `#include <stdarg.h>`\

### Macros

\#define **GLOBUS\_ERROR\_TYPE\_GLOBUS**\

### Typedefs

typedef char \*(\* **globus\_error\_print\_friendly\_t**) (globus\_object\_t \*error, const globus\_object\_type\_t \*type)\

### Functions

**globus\_module\_descriptor\_t** \* **globus\_error\_get\_source** (globus\_object\_t \*error)\
 void **globus\_error\_set\_source** (globus\_object\_t \*error, **globus\_module\_descriptor\_t** \*source\_module)\
 globus\_object\_t \* **globus\_error\_get\_cause** (globus\_object\_t \*error)\
 void **globus\_error\_set\_cause** (globus\_object\_t \*error, globus\_object\_t \*causal\_error)\
 int **globus\_error\_get\_type** (globus\_object\_t \*error)\
 void **globus\_error\_set\_type** (globus\_object\_t \*error, const int type)\
 char \* **globus\_error\_get\_short\_desc** (globus\_object\_t \*error)\
 void **globus\_error\_set\_short\_desc** (globus\_object\_t \*error, const char \*short\_desc\_format,...)\
 char \* **globus\_error\_get\_long\_desc** (globus\_object\_t \*error)\
 void **globus\_error\_set\_long\_desc** (globus\_object\_t \*error, const char \*long\_desc\_format,...)\
 **globus\_bool\_t** **globus\_error\_match** (globus\_object\_t \*error, **globus\_module\_descriptor\_t** \*module, int type)\
 char \* **globus\_error\_print\_chain** (globus\_object\_t \*error)\
 char \* **globus\_error\_print\_friendly** (globus\_object\_t \*error)\
 globus\_object\_t \* **globus\_error\_construct\_multiple** (**globus\_module\_descriptor\_t** \*base\_source, int type, const char \*fmt,...)\
 void **globus\_error\_mutliple\_add\_chain** (globus\_object\_t \*multiple\_error, globus\_object\_t \*chain, const char \*fmt,...)\
 globus\_object\_t \* **globus\_error\_multiple\_remove\_chain** (globus\_object\_t \*multiple\_error)\

## Detailed Description

Globus Error API.

## Typedef Documentation

### typedef char \*(\* globus\_error\_print\_friendly\_t) (globus\_object\_t \*error, const globus\_object\_type\_t \*type)

If registered with a module's descriptor, this handler will be called on behalf of **globus\_error\_print\_friendly()**

**Parameters**

*error* The error chain that originated from this module. The top error object in the chain will be one created by this module and have a type of 'type'; The remaining objects are the same as the cause chain used at creation time. The user can use globus\_error\_get\_type(error) to get the error code (for GLOBUS\_ERROR\_TYPE\_GLOBUS objects)\
 *type* The error object type for the top object in the error chain (e.g. GLOBUS\_ERROR\_TYPE\_GLOBUS, GLOBUS\_ERROR\_TYPE\_ERRNO)

**Returns**

The function should return a newly allocated string with a friendly error message explaining the error in more detail. This string should be considered the only message a user will see. If the module has nothing nice to say, it should return NULL so the next module in the error chain can be tried.

If you think a friendly error from causes beneath you should be included, you may use globus\_error\_print\_friendly(globus\_error\_get\_cause(error)) within this handler to append to your message.

## Function Documentation

### globus\_object\_t \* globus\_error\_construct\_multiple (globus\_module\_descriptor\_t \* base\_source, int type, const char \* fmt, ...)

Multiple error type stuff Construct a container object for multiple error chains. Useful when an application tries many things (and each fails) before finally giving up;

Use globus\_error\_mutliple\_add\_chain() to add error objects/chains to this object.

**Parameters**

*base\_source* Pointer to the originating module. \
 *type* The error type. We may reserve part of this namespace for common errors. Errors not in this space are assumed to be local to the originating module. **globus\_error\_match()** will match against this type, but not of the contained chains. \
 *fmt* a printf style format string describing the multiple errors

**Returns**

The resulting error object. It is the user's responsibility to eventually free this object using globus\_object\_free(). A globus\_result\_t may be obtained by calling globus\_error\_put() on this object. \

### globus\_object\_t \* globus\_error\_multiple\_remove\_chain (globus\_object\_t \* multiple\_error)

Remove an error chain from a multiple error object.

**Parameters**

*multiple\_error* The error from which to remove a chain. Must have been created with globus\_error\_construct\_multiple()

**Returns**

The removed error chain, or NULL if none found.

### void globus\_error\_mutliple\_add\_chain (globus\_object\_t \* multiple\_error, globus\_object\_t \* chain, const char \* fmt, ...)

Add an error chain to a multiple error object.

**Parameters**

*multiple\_error* The error to add the chain to. Must have been created with globus\_error\_construct\_multiple() \
 *chain* The chain to add to this error. This error object assumes control over 'chain''s memory after this call. \
 *fmt* a printf style format string describing this chain

**Returns**

void

## Author

Generated automatically by Doxygen for globus\_common from the source code.
