error.h (3138B)
1/* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 20 21#ifndef _GUAC_ERROR_H 22#define _GUAC_ERROR_H 23 24/** 25 * Provides functions and structures required for handling return values and 26 * errors. 27 * 28 * @file error.h 29 */ 30 31#include "error-types.h" 32 33/** 34 * Returns a human-readable explanation of the status code given. 35 */ 36const char* guac_status_string(guac_status status); 37 38/** 39 * Returns the status code associated with the error which occurred during the 40 * last function call. This value will only be set by functions documented to 41 * use it (most libguac functions), and is undefined if no error occurred. 42 * 43 * The storage of this value is thread-local. Assignment of a status code to 44 * guac_error in one thread will not affect its value in another thread. 45 */ 46#define guac_error (*__guac_error()) 47 48guac_status* __guac_error(); 49 50/** 51 * Returns a message describing the error which occurred during the last 52 * function call. If an error occurred, but no message is associated with it, 53 * NULL is returned. This value is undefined if no error occurred. 54 * 55 * The storage of this value is thread-local. Assignment of a message to 56 * guac_error_message in one thread will not affect its value in another 57 * thread. 58 */ 59#define guac_error_message (*__guac_error_message()) 60 61const char** __guac_error_message(); 62 63/** 64 * Returns a human-readable explanation of the status code given. 65 */ 66const char* guac_status_string(guac_status status); 67 68/** 69 * Returns the status code associated with the error which occurred during the 70 * last function call. This value will only be set by functions documented to 71 * use it (most libguac functions), and is undefined if no error occurred. 72 * 73 * The storage of this value is thread-local. Assignment of a status code to 74 * guac_error in one thread will not affect its value in another thread. 75 */ 76#define guac_error (*__guac_error()) 77 78guac_status* __guac_error(); 79 80/** 81 * Returns a message describing the error which occurred during the last 82 * function call. If an error occurred, but no message is associated with it, 83 * NULL is returned. This value is undefined if no error occurred. 84 * 85 * The storage of this value is thread-local. Assignment of a message to 86 * guac_error_message in one thread will not affect its value in another 87 * thread. 88 */ 89#define guac_error_message (*__guac_error_message()) 90 91const char** __guac_error_message(); 92 93#endif 94