本文整理汇总了C++中FatalException函数的典型用法代码示例。如果您正苦于以下问题:C++ FatalException函数的具体用法?C++ FatalException怎么用?C++ FatalException使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FatalException函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sqlite3_free
DAL::DataSet* SQLite::ExecuteQuery(const char* SqlStatement)
{
SQLite::SQLiteDataSet* returnValue = new SQLite::SQLiteDataSet();
Logger::GetInstance().Debug("SQLite::ExecuteQuery", SqlStatement);
try
{
char* error = NULL;
if (sqlite3_exec(this->database, SqlStatement, SQLite::ExecuteCallback, returnValue, &error) != SQLITE_OK)
{
std::string errorMsg = "SQLite::ExecuteQuery FATAL: Could not execute " + std::string(SqlStatement) + " : " + std::string(error);
sqlite3_free(error);
throw WarningException("SQLite::ExecuteQuery", errorMsg, HERE);
}
}
catch (WarningException& e)
{
throw WarningException(e, HERE);
}
catch (std::exception &e)
{
throw FatalException("DAL::ExecuteQuery", e.what(), HERE);
}
catch (...)
{
throw FatalException("DAL::ExecuteQuery", "Unspecified exception while executing an sql query.", HERE);
}
return returnValue;
}
示例2: FatalException
//-----------------------------------------------------------------------------
// Square()
// Constructor
// ClusterType type - the type to be used to define the cluster
// Square *squares[9] - An array of nine squares to define the cluster
Cluster::Cluster(ClusterType type, Square *squares[9])
{
int k = 0;
for (k = 0; k < 9; k++)
references[k] = 0; //tracks what numbers are used
//------------------------------------------------
// Check to see if **squares are null
//------------------------------------------------
if (!squares)
{
throw FatalException("Cluster::Cluster() null pointer in parameter");
}
cluster_type = type;
//------------------------------------------------
// Initialize the squares using the provided array
//------------------------------------------------
for (k = 0; k < 9; k++)
{
if (!squares[k])
{
throw FatalException("Cluster::Cluster() null pointer in parameter");
}
cluster_group[k] = squares[k];
}
for (k = 0; k < 9; k++)
cluster_group[k]->addCluster(this);
referenceCount++;
}
示例3: FatalException
void ZipFile::Work_AfterReadFile(uv_work_t* req) {
HandleScope scope;
closure_t *closure = static_cast<closure_t *>(req->data);
TryCatch try_catch;
if (closure->error) {
Local<Value> argv[1] = { Exception::Error(String::New(closure->error_name.c_str())) };
closure->cb->Call(Context::GetCurrent()->Global(), 1, argv);
} else {
node::Buffer *retbuf = Buffer::New(reinterpret_cast<char *>(&closure->data[0]), closure->data.size());
Local<Value> argv[2] = { Local<Value>::New(Null()), Local<Value>::New(retbuf->handle_) };
closure->cb->Call(Context::GetCurrent()->Global(), 2, argv);
}
if (try_catch.HasCaught()) {
FatalException(try_catch);
}
closure->zf->Unref();
uv_unref(uv_default_loop());
closure->cb.Dispose();
delete closure;
}
示例4: Undefined
/**
* @details This is set by `FromFileAsync` to run after `FromFileWork` has
* finished. It is passed the response generated by the latter and runs in the
* same thread as the former. It creates a `Map` instance and returns it
* to the caller via the callback they originally specified.
*
* @param req The asynchronous libuv request.
*/
void Map::FromFileAfter(uv_work_t *req) {
HandleScope scope;
MapfileBaton *baton = static_cast<MapfileBaton*>(req->data);
Handle<Value> argv[2];
if (baton->error) {
argv[0] = baton->error->toV8Error();
argv[1] = Undefined();
delete baton->error; // we've finished with it
} else {
Local<Value> mapObj = External::New(baton->map);
Persistent<Object> map = Persistent<Object>(map_template->GetFunction()->NewInstance(1, &mapObj));
argv[0] = Undefined();
argv[1] = scope.Close(map);
}
// pass the results to the user specified callback function
TryCatch try_catch;
baton->callback->Call(Context::GetCurrent()->Global(), 2, argv);
if (try_catch.HasCaught()) {
FatalException(try_catch);
}
// clean up
baton->callback.Dispose();
delete baton;
return;
}
示例5: FatalException
void Image::EIO_AfterComposite(uv_work_t* req)
{
HandleScope scope;
composite_image_baton_t *closure = static_cast<composite_image_baton_t *>(req->data);
TryCatch try_catch;
if (closure->error) {
Local<Value> argv[1] = { Exception::Error(String::New(closure->error_name.c_str())) };
closure->cb->Call(Context::GetCurrent()->Global(), 1, argv);
} else {
Local<Value> argv[2] = { Local<Value>::New(Null()), Local<Value>::New(closure->im1->handle_) };
closure->cb->Call(Context::GetCurrent()->Global(), 2, argv);
}
if (try_catch.HasCaught()) {
FatalException(try_catch);
}
closure->im1->Unref();
closure->im2->Unref();
closure->cb.Dispose();
delete closure;
}
示例6: msGetErrorObj
void MSMap::DrawMapAfter(uv_work_t *req) {
HandleScope scope;
// drawmap_baton *drawmap_req =(drawmap_baton *)req->data;
drawmap_baton *baton = static_cast<drawmap_baton *>(req->data);
baton->map->Unref();
TryCatch try_catch;
Local<Value> argv[2];
if (baton->data != NULL) {
Buffer * buffer = Buffer::New(baton->data, baton->size, FreeImageBuffer, NULL);
argv[0] = Local<Value>::New(Null());
argv[1] = Local<Value>::New(buffer->handle_);
} else {
Local<Value> _arg_ = External::New(baton->error);
// argv[0] = Local<Value>::New(ErrorObj::constructor_template->GetFunction()->NewInstance(1, &_arg_));
errorObj * err = msGetErrorObj();
argv[0] = Local<Value>::New(MSError::New(err));
argv[1] = Local<Value>::New(Null());
}
baton->cb->Call(Context::GetCurrent()->Global(), 2, argv);
if (try_catch.HasCaught()) {
FatalException(try_catch);
}
baton->cb.Dispose();
delete baton;
return;
}
示例7: ev_unref
int Zipper::EIO_AfterAddFile(eio_req *req)
{
HandleScope scope;
closure_t *closure = static_cast<closure_t *>(req->data);
ev_unref(EV_DEFAULT_UC);
TryCatch try_catch;
if (closure->error) {
Local<Value> argv[1] = { Exception::Error(String::New(closure->error_name.c_str())) };
closure->cb->Call(Context::GetCurrent()->Global(), 1, argv);
} else {
Local<Value> argv[1] = { Local<Value>::New(Null()) };
closure->cb->Call(Context::GetCurrent()->Global(), 1, argv);
}
if (try_catch.HasCaught()) {
FatalException(try_catch);
//try_catch.ReThrow();
}
closure->zf->Unref();
closure->cb.Dispose();
delete closure;
return 0;
}
示例8: NODE_VERSION_AT_LEAST
void ImageView::EIO_AfterEncode(uv_work_t* req)
{
HandleScope scope;
encode_image_baton_t *closure = static_cast<encode_image_baton_t *>(req->data);
TryCatch try_catch;
if (closure->error) {
Local<Value> argv[1] = { Exception::Error(String::New(closure->error_name.c_str())) };
closure->cb->Call(Context::GetCurrent()->Global(), 1, argv);
} else {
#if NODE_VERSION_AT_LEAST(0,3,0)
node::Buffer *retbuf = Buffer::New((char*)closure->result.data(),closure->result.size());
#else
node::Buffer *retbuf = Buffer::New(closure->result.size());
memcpy(retbuf->data(), closure->result.data(), closure->result.size());
#endif
Local<Value> argv[2] = { Local<Value>::New(Null()), Local<Value>::New(retbuf->handle_) };
closure->cb->Call(Context::GetCurrent()->Global(), 2, argv);
}
if (try_catch.HasCaught()) {
FatalException(try_catch);
}
//uv_unref(uv_default_loop());
closure->im->Unref();
closure->cb.Dispose();
delete closure;
}
示例9: FatalException
void SQLite::Open(std::string Location)
{
if (sqlite3_open(Location.c_str(), &this->database))
{
std::string errorMsg = "Database::Database FATAL: Could not create database: " + std::string(sqlite3_errmsg(this->database));
throw FatalException("SQLite::Open", errorMsg, HERE);
}
this->ExecuteNonQuery("PRAGMA foreign_keys = ON");
}
示例10: FatalException
void Grid::EIO_AfterEncode(uv_work_t* req)
{
HandleScope scope;
encode_grid_baton_t *closure = static_cast<encode_grid_baton_t *>(req->data);
TryCatch try_catch;
if (closure->error) {
Local<Value> argv[1] = { Exception::Error(String::New(closure->error_name.c_str())) };
closure->cb->Call(Context::GetCurrent()->Global(), 1, argv);
} else {
// convert key order to proper javascript array
Local<Array> keys_a = Array::New(closure->key_order.size());
std::vector<std::string>::iterator it;
unsigned int i;
for (it = closure->key_order.begin(), i = 0; it < closure->key_order.end(); ++it, ++i)
{
keys_a->Set(i, String::New((*it).c_str()));
}
mapnik::grid const& grid_type = *closure->g->get();
// gather feature data
Local<Object> feature_data = Object::New();
if (closure->add_features) {
node_mapnik::write_features<mapnik::grid>(grid_type,
feature_data,
closure->key_order);
}
// Create the return hash.
Local<Object> json = Object::New();
Local<Array> grid_array = Array::New(closure->lines.size());
unsigned array_size = static_cast<unsigned int>(grid_type.width()/closure->resolution);
for (unsigned j=0;j<closure->lines.size();++j)
{
grid_array->Set(j,String::New(&closure->lines[j],array_size));
}
json->Set(String::NewSymbol("grid"), grid_array);
json->Set(String::NewSymbol("keys"), keys_a);
json->Set(String::NewSymbol("data"), feature_data);
Local<Value> argv[2] = { Local<Value>::New(Null()), Local<Value>::New(json) };
closure->cb->Call(Context::GetCurrent()->Global(), 2, argv);
}
if (try_catch.HasCaught()) {
FatalException(try_catch);
}
uv_unref(uv_default_loop());
closure->g->Unref();
closure->cb.Dispose();
delete closure;
}
示例11: FatalException
void PlayerComponent::setQtQuickWindow(QQuickWindow* window)
{
PlayerQuickItem* video = window->findChild<PlayerQuickItem*>("video");
if (!video)
throw FatalException(tr("Failed to load video element."));
mpv_set_option_string(m_mpv, "vo", "opengl-cb");
video->initMpv(this);
}
示例12: C_DecryptInit
// Initialise decryption using the specified object
CK_RV C_DecryptInit(CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism, CK_OBJECT_HANDLE hObject)
{
try
{
return SoftHSM::i()->C_DecryptInit(hSession, pMechanism, hObject);
}
catch (...)
{
FatalException();
}
return CKR_FUNCTION_FAILED;
}
示例13: C_DecryptUpdate
// Feed data to the running decryption operation in a session
CK_RV C_DecryptUpdate(CK_SESSION_HANDLE hSession, CK_BYTE_PTR pEncryptedData, CK_ULONG ulEncryptedDataLen, CK_BYTE_PTR pData, CK_ULONG_PTR pDataLen)
{
try
{
return SoftHSM::i()->C_DecryptUpdate(hSession, pEncryptedData, ulEncryptedDataLen, pData, pDataLen);
}
catch (...)
{
FatalException();
}
return CKR_FUNCTION_FAILED;
}
示例14: C_DigestInit
// Initialise digesting using the specified mechanism in the specified session
CK_RV C_DigestInit(CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pMechanism)
{
try
{
return SoftHSM::i()->C_DigestInit(hSession, pMechanism);
}
catch (...)
{
FatalException();
}
return CKR_FUNCTION_FAILED;
}
示例15: C_DigestKey
// Update a running digest operation by digesting a secret key with the specified handle
CK_RV C_DigestKey(CK_SESSION_HANDLE hSession, CK_OBJECT_HANDLE hObject)
{
try
{
return SoftHSM::i()->C_DigestKey(hSession, hObject);
}
catch (...)
{
FatalException();
}
return CKR_FUNCTION_FAILED;
}