2017-12-13 11:32:28 -08:00
|
|
|
/* Copyright (c) 2009, 2010, 2011, 2016, 2017 Nicira, Inc.
|
2009-11-04 15:11:44 -08:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at:
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OVSDB_ERROR_H
|
|
|
|
#define OVSDB_ERROR_H 1
|
|
|
|
|
|
|
|
#include "compiler.h"
|
|
|
|
|
|
|
|
struct json;
|
|
|
|
|
|
|
|
struct ovsdb_error *ovsdb_error(const char *tag, const char *details, ...)
|
2014-12-15 14:10:38 +01:00
|
|
|
OVS_PRINTF_FORMAT(2, 3)
|
2024-09-09 00:54:58 -04:00
|
|
|
OVS_WARN_UNUSED_RESULT
|
|
|
|
OVS_RETURNS_NONNULL;
|
2009-11-04 15:11:44 -08:00
|
|
|
struct ovsdb_error *ovsdb_io_error(int error, const char *details, ...)
|
2014-12-15 14:10:38 +01:00
|
|
|
OVS_PRINTF_FORMAT(2, 3)
|
2024-09-09 00:54:58 -04:00
|
|
|
OVS_WARN_UNUSED_RESULT
|
|
|
|
OVS_RETURNS_NONNULL;
|
2009-11-04 15:11:44 -08:00
|
|
|
struct ovsdb_error *ovsdb_syntax_error(const struct json *, const char *tag,
|
|
|
|
const char *details, ...)
|
2014-12-15 14:10:38 +01:00
|
|
|
OVS_PRINTF_FORMAT(3, 4)
|
2024-09-09 00:54:58 -04:00
|
|
|
OVS_WARN_UNUSED_RESULT
|
|
|
|
OVS_RETURNS_NONNULL;
|
2009-11-04 15:11:44 -08:00
|
|
|
|
|
|
|
struct ovsdb_error *ovsdb_wrap_error(struct ovsdb_error *error,
|
|
|
|
const char *details, ...)
|
2014-12-15 14:10:38 +01:00
|
|
|
OVS_PRINTF_FORMAT(2, 3);
|
2009-11-04 15:11:44 -08:00
|
|
|
|
2011-03-09 12:41:37 -08:00
|
|
|
struct ovsdb_error *ovsdb_internal_error(struct ovsdb_error *error,
|
|
|
|
const char *file, int line,
|
2009-11-04 15:11:44 -08:00
|
|
|
const char *details, ...)
|
2014-12-15 14:10:38 +01:00
|
|
|
OVS_PRINTF_FORMAT(4, 5)
|
2024-09-09 00:54:58 -04:00
|
|
|
OVS_WARN_UNUSED_RESULT
|
|
|
|
OVS_RETURNS_NONNULL;
|
2011-03-09 12:41:37 -08:00
|
|
|
|
2017-05-31 19:04:32 -04:00
|
|
|
struct ovsdb_error *ovsdb_perm_error(const char *details, ...)
|
|
|
|
OVS_PRINTF_FORMAT(1, 2)
|
2024-09-09 00:54:58 -04:00
|
|
|
OVS_WARN_UNUSED_RESULT
|
|
|
|
OVS_RETURNS_NONNULL;
|
2017-05-31 19:04:32 -04:00
|
|
|
|
2011-03-09 12:41:37 -08:00
|
|
|
/* Returns a pointer to an ovsdb_error that represents an internal error for
|
|
|
|
* the current file name and line number with MSG as the associated message.
|
|
|
|
* The caller is responsible for freeing the internal error. */
|
|
|
|
#define OVSDB_BUG(MSG) \
|
|
|
|
ovsdb_internal_error(NULL, __FILE__, __LINE__, "%s", MSG)
|
|
|
|
|
|
|
|
/* Returns a pointer to an ovsdb_error that represents an internal error for
|
|
|
|
* the current file name and line number, with MSG as the associated message.
|
|
|
|
* If ERROR is nonnull then the internal error is wrapped around ERROR. Takes
|
|
|
|
* ownership of ERROR. The caller is responsible for freeing the returned
|
|
|
|
* error. */
|
|
|
|
#define OVSDB_WRAP_BUG(MSG, ERROR) \
|
|
|
|
ovsdb_internal_error(ERROR, __FILE__, __LINE__, "%s", MSG)
|
2009-11-04 15:11:44 -08:00
|
|
|
|
|
|
|
void ovsdb_error_destroy(struct ovsdb_error *);
|
|
|
|
struct ovsdb_error *ovsdb_error_clone(const struct ovsdb_error *)
|
2014-12-15 14:10:38 +01:00
|
|
|
OVS_WARN_UNUSED_RESULT;
|
2009-11-04 15:11:44 -08:00
|
|
|
|
|
|
|
char *ovsdb_error_to_string(const struct ovsdb_error *);
|
2017-12-13 11:32:28 -08:00
|
|
|
char *ovsdb_error_to_string_free(struct ovsdb_error *);
|
2009-11-04 15:11:44 -08:00
|
|
|
struct json *ovsdb_error_to_json(const struct ovsdb_error *);
|
2017-09-13 14:13:37 -07:00
|
|
|
struct json *ovsdb_error_to_json_free(struct ovsdb_error *);
|
2009-11-04 15:11:44 -08:00
|
|
|
|
|
|
|
const char *ovsdb_error_get_tag(const struct ovsdb_error *);
|
|
|
|
|
2010-03-12 10:27:33 -08:00
|
|
|
void ovsdb_error_assert(struct ovsdb_error *);
|
|
|
|
|
2009-11-04 15:11:44 -08:00
|
|
|
#endif /* ovsdb-error.h */
|