• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ set_error_message函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中set_error_message函数的典型用法代码示例。如果您正苦于以下问题:C++ set_error_message函数的具体用法?C++ set_error_message怎么用?C++ set_error_message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了set_error_message函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: parse_config

static struct patterns_data* parse_config(const char* line, struct plugin_handle* plugin)
{
	struct patterns_data* data = (struct patterns_data*) hub_malloc_zero(sizeof(struct patterns_data));
	struct cfg_tokens* tokens = cfg_tokenize(line);
	char* token = cfg_token_get_first(tokens);

	if (!data)
		return 0;
  
	while (token)
	{
		struct cfg_settings* setting = cfg_settings_split(token);

		if (!setting)
		{
			set_error_message(plugin, "Unable to parse startup parameters");
			cfg_tokens_free(tokens);
			hub_free(data);
			return 0;
		}

		if (strcmp(cfg_settings_get_key(setting), "file") == 0)
		{
			if (!data->db)
			{
				if (sqlite3_open(cfg_settings_get_value(setting), &data->db))
				{
					cfg_tokens_free(tokens);
					cfg_settings_free(setting);
					hub_free(data);
					set_error_message(plugin, "Unable to open database file");
					return 0;
				}
			}
		}
		else
		{
			set_error_message(plugin, "Unknown startup parameters given");
			cfg_tokens_free(tokens);
			cfg_settings_free(setting);
			hub_free(data);
			return 0;
		}

		cfg_settings_free(setting);
		token = cfg_token_get_next(tokens);
	}
	cfg_tokens_free(tokens);

	if (!data->db)
	{
	      set_error_message(plugin, "No database file is given, use file=<database>");
	      hub_free(data);
	      return 0;
	}
	return data;
}
开发者ID:mimicmod,项目名称:uhub,代码行数:57,代码来源:mod_patterns.c


示例2: parse_config

static struct log_data* parse_config(const char* line, struct plugin_handle* plugin)
{
	struct log_data* data = (struct log_data*) hub_malloc_zero(sizeof(struct log_data));
	struct cfg_tokens* tokens = cfg_tokenize(line);
	char* token = cfg_token_get_first(tokens);

	uhub_assert(data != NULL);

	data->srvtdiff = 0;

	while (token)
	{
		struct cfg_settings* setting = cfg_settings_split(token);

		if (!setting)
		{
			set_error_message(plugin, "Unable to parse startup parameters");
			cfg_tokens_free(tokens);
			hub_free(data);
			return 0;
		}

		if (strcmp(cfg_settings_get_key(setting), "file") == 0)
		{
			if (!data->db)
			{
				if (sqlite3_open(cfg_settings_get_value(setting), &data->db))
				{
					cfg_tokens_free(tokens);
					cfg_settings_free(setting);
					hub_free(data);
					set_error_message(plugin, "Unable to open database file");
					return 0;
				}
			}
		}
		else if (strcmp(cfg_settings_get_key(setting), "server_time_diff") == 0)
		{
			data->srvtdiff = uhub_atoi(cfg_settings_get_value(setting));
		}
		else
		{
			set_error_message(plugin, "Unknown startup parameters given");
			cfg_tokens_free(tokens);
			cfg_settings_free(setting);
			hub_free(data);
			return 0;
		}

		cfg_settings_free(setting);
		token = cfg_token_get_next(tokens);
	}
	cfg_tokens_free(tokens);

	return data;
}
开发者ID:mimicmod,项目名称:uhub,代码行数:56,代码来源:mod_logging_sqlite.c


示例3: parse_config

static struct chat_history_data* parse_config(const char* line, struct plugin_handle* plugin)
{
	struct chat_history_data* data = (struct chat_history_data*) hub_malloc_zero(sizeof(struct chat_history_data));
	struct cfg_tokens* tokens = cfg_tokenize(line);
	char* token = cfg_token_get_first(tokens);

	uhub_assert(data != NULL);

	data->history_max = 200;
	data->history_default = 25;
	data->history_connect = 5;
	data->chat_history = list_create();

	while (token)
	{
		struct cfg_settings* setting = cfg_settings_split(token);

		if (!setting)
		{
			set_error_message(plugin, "Unable to parse startup parameters");
			cfg_tokens_free(tokens);
			hub_free(data);
			return 0;
		}

		if (strcmp(cfg_settings_get_key(setting), "history_max") == 0)
		{
			data->history_max = (size_t) uhub_atoi(cfg_settings_get_value(setting));
		}
		else if (strcmp(cfg_settings_get_key(setting), "history_default") == 0)
		{
			data->history_default = (size_t) uhub_atoi(cfg_settings_get_value(setting));
		}
		else if (strcmp(cfg_settings_get_key(setting), "history_connect") == 0)
		{
			data->history_connect = (size_t) uhub_atoi(cfg_settings_get_value(setting));
		}
		else
		{
			set_error_message(plugin, "Unknown startup parameters given");
			cfg_tokens_free(tokens);
			cfg_settings_free(setting);
			hub_free(data);
			return 0;
		}

		cfg_settings_free(setting);
		token = cfg_token_get_next(tokens);
	}
	cfg_tokens_free(tokens);
	return data;
}
开发者ID:junaidk,项目名称:uhub,代码行数:52,代码来源:mod_chat_history.c


示例4: create_patterns_table

static int create_patterns_table(struct plugin_handle* plugin, struct patterns_data* data)
{
	sqlite3_stmt *res;
	int rc;
	int count = 0;
	
	const char* table_create_patterns = "CREATE TABLE patterns(id INTEGER PRIMARY KEY,regexp CHAR NOT NULL,type INT NOT NULL,min_cred_protect CHAR NOT NULL DEFAULT('user'),max_cred_protect CHAR NOT NULL DEFAULT('admin'));";
	const char* table_alter_patterns = "ALTER TABLE patterns ADD COLUMN max_cred_protect CHAR NOT NULL DEFAULT('admin');";

	rc = sqlite3_prepare_v2(data->db, "PRAGMA table_info(patterns);", 29, &res, NULL);
	
	if (rc == SQLITE_OK)
	{
		while (sqlite3_step(res) == SQLITE_ROW)
			count++;
	}
	
	sqlite3_finalize(res);
		
	if (count == 5)
		return 1; // New schema
	
	if (count == 0) // Table does not exist
	{
		rc = sqlite3_exec(data->db, table_create_patterns, NULL, NULL, NULL);

		if (rc != SQLITE_OK)
		{
			set_error_message(plugin, "Unable to create patterns table.");
			return 0;
		}
		else
		    return 1;
	}
	
	if (count > 0 && count < 5) // Table exists, but scheme is old
	{
		rc = sqlite3_exec(data->db, table_alter_patterns, NULL, NULL, NULL);

		if (rc != SQLITE_OK)
		{
			set_error_message(plugin, "Unable to alter patterns table.");
			return 0;
		}
		else
			return 1;
	}
	
	set_error_message(plugin, "Unable to create or alter patterns table (unknown reason).");
	return 0;
}
开发者ID:mimicmod,项目名称:uhub,代码行数:51,代码来源:mod_patterns.c


示例5: http_request_parse

bool http_request_parse(HttpRequest* request, const char* text) {
  // Clear the error buffer. If set during this function, there was an error.
  clear_error_message(request);

  // Clear any existing data and reset the object
  http_request_free(request);

  // Copy the text
  char* textcopy = strdup(text);
  char* textcopy_start = textcopy;

  // Parse the HTTP request line (the first line): HTTP method, URI, version
  char* curline = strsep(&textcopy, "\n");
  http_request_parse_request_line(request, curline);

  // Parse headers
  while(textcopy) {
    // Get next line. Break if "\r\n" is reached (or in our case, "\r\0").
    curline = strsep(&textcopy, "\n");
    if(!curline) {
      set_error_message(request, "Unexpected end of text while parsing HTTP request\n");
      break;
    }
    if(curline[0] == '\r' && curline[1] == '\0') {
      break;
    }

    // Store header key and value
    char* curline_orig = curline;
    if(!http_request_parse_header_line(request, curline)) {
      set_error_message(request, "Error parsing HTTP header line %s", curline_orig);
      continue;
    }
  }

  // Store the remaining text as the body
  if(textcopy && textcopy[0]) {
    const size_t textlen = strlen(textcopy);
    request->body = malloc(textlen + 1);
    memcpy(request->body, textcopy, textlen + 1);
    request->body[textlen] = 0;
  }

  // Clean up our copy of the text
  free(textcopy_start);

  // Return success if there was no error
  return !request->error;
}
开发者ID:EvanKuhn,项目名称:webserver,代码行数:49,代码来源:http_request.c


示例6: parse_config

static struct sql_data* parse_config(const char* line, struct plugin_handle* plugin)
{
	struct sql_data* data = (struct sql_data*) hub_malloc_zero(sizeof(struct sql_data));
	struct cfg_tokens* tokens = cfg_tokenize(line);
	char* token = cfg_token_get_first(tokens);

	if (!data)
		return 0;

	while (token)
	{
		char* split = strchr(token, '=');
		size_t len = strlen(token);
		size_t key = split ? (split - token) : len;
		if (key == 4 && strncmp(token, "file", 4) == 0 && data->db == 0)
		{
			if (sqlite3_open(split + 1, &data->db))
			{
				cfg_tokens_free(tokens);
				hub_free(data);
				set_error_message(plugin, "Unable to open database file");
				return 0;
			}
		}
		else if (key == 9 && strncmp(token, "exclusive", 9) == 0)
		{
			if (!string_to_boolean(split + 1, &data->exclusive))
				data->exclusive = 1;
		}
		else
		{
			set_error_message(plugin, "Unable to parse startup parameters");
			cfg_tokens_free(tokens);
			hub_free(data);
			return 0;
		}
		token = cfg_token_get_next(tokens);
	}
	cfg_tokens_free(tokens);

	if (!data->db)
	{
	      set_error_message(plugin, "No database file is given, use file=<database>");
	      hub_free(data);
	      return 0;
	}
	return data;
}
开发者ID:Nyogtha,项目名称:uhub,代码行数:48,代码来源:mod_auth_sqlite.c


示例7: error_message

Exception::Exception(uint32_t error_code, const char* error_message)
  : error_message(NULL) {
  set_error_code(error_code);
  if (error_message != NULL) {
    set_error_message(error_message);
  }
}
开发者ID:glycerine,项目名称:yield,代码行数:7,代码来源:exception.cpp


示例8: plugin_unregister

int plugin_unregister(struct plugin_handle* plugin)
{
	struct patterns_data* pdata;
	set_error_message(plugin, 0);
	pdata = (struct patterns_data*) plugin->ptr;

	if (pdata)
	{
		plugin->hub.command_del(plugin, pdata->command_patternadd_handle);
		plugin->hub.command_del(plugin, pdata->command_patterndel_handle);
		plugin->hub.command_del(plugin, pdata->command_patternlist_handle);
		plugin->hub.command_del(plugin, pdata->command_patterntest_handle);
		plugin->hub.command_del(plugin, pdata->command_patternexadd_handle);
		plugin->hub.command_del(plugin, pdata->command_patternexdel_handle);
		plugin->hub.command_del(plugin, pdata->command_patternexlist_handle);
		hub_free(pdata->command_patternadd_handle);
		hub_free(pdata->command_patterndel_handle);
		hub_free(pdata->command_patternlist_handle);
		hub_free(pdata->command_patterntest_handle);
		hub_free(pdata->command_patternexadd_handle);
		hub_free(pdata->command_patternexdel_handle);
		hub_free(pdata->command_patternexlist_handle);
		sqlite3_close(pdata->db);
	}
    
	hub_free(pdata);
	return 0;
}
开发者ID:mimicmod,项目名称:uhub,代码行数:28,代码来源:mod_patterns.c


示例9: plugin_unregister

int plugin_unregister(struct plugin_handle* plugin)
{
	struct extras_data* extrasdata;
	set_error_message(plugin, 0);
	extrasdata = (struct extras_data*) plugin->ptr;

	if (extrasdata)
	{
		plugin->hub.command_del(plugin, extrasdata->command_hubadd_handle);
		plugin->hub.command_del(plugin, extrasdata->command_hubdel_handle);
		plugin->hub.command_del(plugin, extrasdata->command_hublist_handle);
		plugin->hub.command_del(plugin, extrasdata->command_newsadd_handle);
		plugin->hub.command_del(plugin, extrasdata->command_newsdel_handle);
		plugin->hub.command_del(plugin, extrasdata->command_news_handle);
		plugin->hub.command_del(plugin, extrasdata->command_releaseadd_handle);
		plugin->hub.command_del(plugin, extrasdata->command_releasedel_handle);
		plugin->hub.command_del(plugin, extrasdata->command_releases_handle);
		
		hub_free(extrasdata->command_hubadd_handle);
		hub_free(extrasdata->command_hubdel_handle);
		hub_free(extrasdata->command_hublist_handle);
		hub_free(extrasdata->command_newsadd_handle);
		hub_free(extrasdata->command_newsdel_handle);
		hub_free(extrasdata->command_news_handle);
		hub_free(extrasdata->command_releaseadd_handle);
		hub_free(extrasdata->command_releasedel_handle);
		hub_free(extrasdata->command_releases_handle);

		sqlite3_close(extrasdata->db);
	}
  
	hub_free(extrasdata);
	return 0;
}
开发者ID:mimicmod,项目名称:uhub,代码行数:34,代码来源:mod_extras.c


示例10: plugin_unregister

int plugin_unregister(struct plugin_handle* plugin)
{
	set_error_message(plugin, 0);
	struct sql_data* sql = (struct sql_data*) plugin->ptr;
	sqlite3_close(sql->db);
	hub_free(sql);
	return 0;
}
开发者ID:Nyogtha,项目名称:uhub,代码行数:8,代码来源:mod_auth_sqlite.c


示例11: Exception

SSLException::SSLException()
    : Exception(ERR_peek_error()) {
    SSL_load_error_strings();

    char error_message[256];
    ERR_error_string_n(ERR_peek_error(), error_message, 256);
    set_error_message(error_message);
}
开发者ID:glycerine,项目名称:yield,代码行数:8,代码来源:ssl_exception.cpp


示例12: mono_error_set_error

void
mono_error_set_error (MonoError *oerror, int error_code, const char *msg_format, ...)
{
	MonoErrorInternal *error = (MonoErrorInternal*)oerror;
	mono_error_prepare (error);

	error->error_code = error_code;
	set_error_message ();
}
开发者ID:Appercode,项目名称:mono,代码行数:9,代码来源:mono-error.c


示例13: mono_error_set_invalid_program

void
mono_error_set_invalid_program (MonoError *oerror, const char *msg_format, ...)
{
	MonoErrorInternal *error = (MonoErrorInternal*)oerror;

	mono_error_prepare (error);
	error->error_code = MONO_ERROR_INVALID_PROGRAM;

	set_error_message ();
}
开发者ID:Appercode,项目名称:mono,代码行数:10,代码来源:mono-error.c


示例14: mono_error_set_bad_image

void
mono_error_set_bad_image (MonoError *oerror, MonoImage *image, const char *msg_format, ...)
{
	MonoErrorInternal *error = (MonoErrorInternal*)oerror;
	mono_error_prepare (error);

	error->error_code = MONO_ERROR_BAD_IMAGE;
	error->assembly_name = image ? mono_image_get_name (image) : "<no_image>";
	set_error_message ();
}
开发者ID:Appercode,项目名称:mono,代码行数:10,代码来源:mono-error.c


示例15: mono_error_set_generic_error

void
mono_error_set_generic_error (MonoError *oerror, const char * name_space, const char *name, const char *msg_format, ...)
{
	MonoErrorInternal *error = (MonoErrorInternal*)oerror;
	mono_error_prepare (error);

	error->error_code = MONO_ERROR_GENERIC;
	mono_error_set_corlib_exception (oerror, name_space, name);
	set_error_message ();
}
开发者ID:ymnl007,项目名称:mono,代码行数:10,代码来源:mono-error.c


示例16: mono_error_set_member_access

void
mono_error_set_member_access (MonoError *oerror, const char *msg_format, ...)
{
	MonoErrorInternal *error = (MonoErrorInternal*)oerror;

	mono_error_prepare (error);
	error->error_code = MONO_ERROR_MEMBER_ACCESS;

	set_error_message ();
}
开发者ID:mono,项目名称:mono,代码行数:10,代码来源:mono-error.c


示例17: mono_error_set_bad_image_name

void
mono_error_set_bad_image_name (MonoError *oerror, const char *assembly_name, const char *msg_format, ...)
{
	MonoErrorInternal *error = (MonoErrorInternal*)oerror;
	mono_error_prepare (error);

	error->error_code = MONO_ERROR_BAD_IMAGE;
	mono_error_set_assembly_name (oerror, assembly_name);
	set_error_message ();
}
开发者ID:Appercode,项目名称:mono,代码行数:10,代码来源:mono-error.c


示例18: mono_error_set_type_load_class

void
mono_error_set_type_load_class (MonoError *oerror, MonoClass *klass, const char *msg_format, ...)
{
	MonoErrorInternal *error = (MonoErrorInternal*)oerror;
	mono_error_prepare (error);

	error->error_code = MONO_ERROR_TYPE_LOAD;
	mono_error_set_class (oerror, klass);
	set_error_message ();
}
开发者ID:Appercode,项目名称:mono,代码行数:10,代码来源:mono-error.c


示例19: mono_error_set_out_of_memory

void
mono_error_set_out_of_memory (MonoError *oerror, const char *msg_format, ...)
{
	MonoErrorInternal *error = (MonoErrorInternal*)oerror;
	mono_error_prepare (error);

	error->error_code = MONO_ERROR_OUT_OF_MEMORY;

	set_error_message ();
}
开发者ID:Appercode,项目名称:mono,代码行数:10,代码来源:mono-error.c


示例20: mono_error_set_field_load

void
mono_error_set_field_load (MonoError *oerror, MonoClass *klass, const char *field_name, const char *msg_format, ...)
{
	MonoErrorInternal *error = (MonoErrorInternal*)oerror;
	mono_error_prepare (error);

	error->error_code = MONO_ERROR_MISSING_FIELD;
	mono_error_set_class (oerror, klass);
	mono_error_set_member_name (oerror, field_name);
	set_error_message ();	
}
开发者ID:Appercode,项目名称:mono,代码行数:11,代码来源:mono-error.c



注:本文中的set_error_message函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ set_except_vector函数代码示例发布时间:2022-05-30
下一篇:
C++ set_errno函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap