这篇教程C++ throw_exception函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中throw_exception函数的典型用法代码示例。如果您正苦于以下问题:C++ throw_exception函数的具体用法?C++ throw_exception怎么用?C++ throw_exception使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了throw_exception函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: sr_set_itemvoid Session::set_item(const char *xpath, S_Val value, const sr_edit_options_t opts){ sr_val_t *val = value ? value->_val : nullptr; int ret = sr_set_item(_sess, xpath, val, opts); if (ret != SR_ERR_OK) { throw_exception(ret); }}
开发者ID:qmm161,项目名称:sysrepo,代码行数:9,
示例2: throw_osxkeychainexception/* Shorthand for throwing an OSXKeychainException from an OSStatus. * * Parameters: * env The JNI environment. * status The non-error status returned from a keychain call. */void throw_osxkeychainexception(JNIEnv* env, OSStatus status) { CFStringRef errorMessage = SecCopyErrorMessageString(status, NULL); throw_exception( env, OSXKeychainException, CFStringGetCStringPtr(errorMessage, kCFStringEncodingMacRoman) ); CFRelease(errorMessage);}
开发者ID:PowerOlive,项目名称:osx-keychain-java,代码行数:15,
示例3: throw_exceptionvoid Mesh_File_Reader::open(){ // Checking the mesh path if (!boost::filesystem::is_directory(_mesh_path)) { throw_exception(IO_Error("Bad mesh path: '" + _mesh_path.string() + "'"), FATAL_LEVEL, __FILE__, __LINE__); } }
开发者ID:yonggang985,项目名称:Touch,代码行数:9,
示例4: throw_exceptionbool expression_parser::is_name(any_regular_t& result) { if (!is_token(at_k)) return false; if (!is_token(keyword_k, result) && !is_token(identifier_k, result)) throw_exception("identifier or keyword required."); return true;}
开发者ID:NextGenIntelligence,项目名称:adobe_source_libraries,代码行数:9,
示例5: resultvoid binspector_parser_t::require_identifier(adobe::name_t& name_result){ const adobe::stream_lex_token_t& result (get_token()); if (result.first != adobe::identifier_k) throw_exception(adobe::identifier_k, result.first); name_result = result.second.cast<adobe::name_t>();}
开发者ID:JamesLinus,项目名称:binspector,代码行数:9,
示例6: malloc/* Edge "constructor". Constructs an edge from 2 vertices with a given weight. @param v1 First vertex this edge connects. @param v2 Second vertex this edge connects. @param weight Weight of the edge. */edge_s *edge_s_ (vertex_s *v1, vertex_s *v2, double weight){ edge_s *edge; edge = malloc(sizeof(*edge)); if (!edge) throw_exception(); if (!(addedge(v1,edge) && addedge(v2,edge))) throw_exception(); edge->v1 = v1; edge->v2 = v2; edge->weight = weight; return edge; exception_: perror("Heap Allocation Error"); exit(EXIT_FAILURE);}
开发者ID:jonathanhamm,项目名称:mincut,代码行数:26,
示例7: throwbool Compartment_Report_HDF5_File_Reader::load_next_frame_impl(float * buffer) /* throw (IO_Error) */{ // /bug No overflow check is performed Frame_Number next_frame = (Frame_Number)_sequence_start_frame + (Frame_Number) round(_frame_counter * _frame_skip); // Checking if we have reached the end bool attribute_found = false; Frame_Number last_frame = UNDEFINED_FRAME_NUMBER; // To silent warning. Cell_Target::iterator cell_ID = _current_cell_target.begin(); do { H5ID file, dataset; open_data_set(*cell_ID, "data", file, dataset); float start_time = 0.0f, end_time = 0.0f, delta_time = 0.0f; if (!read_attribute("tstart", dataset, start_time) || !read_attribute("tstop", dataset, end_time) || !read_attribute("Dt", dataset, delta_time)) { std::string name = "a" + boost::lexical_cast<std::string>(*cell_ID); std::string filename = (_path / (name + ".h5")).string(); throw_exception( File_Parse_Error("Compartment_Report_HDF5_File_Reader: " "Error reading report time attributes " "from file:" + filename), FATAL_LEVEL, __FILE__, __LINE__); }#ifdef WIN32#pragma warning( push )#pragma warning( disable : 4701 ) last_frame = (Frame_Number) round((end_time - start_time) / delta_time) - 1;#pragma warning ( pop )#endif attribute_found = true; ++cell_ID; } while (!attribute_found && cell_ID != _current_cell_target.end()); if (!attribute_found || last_frame < next_frame) { // End of report reached return false; } else { load_frames_impl(buffer, next_frame, next_frame); _current_framestamp = next_frame; ++_frame_counter; return true; }}
开发者ID:yonggang985,项目名称:Touch,代码行数:57,
示例8: sr_unsubscribevoid Subscribe::unsubscribe(){ int ret = sr_unsubscribe(_sess->_sess, _sub); if (SR_ERR_OK != ret) { throw_exception(ret); } _sub = nullptr;}
开发者ID:qmm161,项目名称:sysrepo,代码行数:9,
示例9: get type get() { fibers::detail::spinlock splk; unique_lock< fibers::detail::spinlock > lk( splk); boost::fibers::detail::scheduler::instance()->wait(lk); if ( ! out_ec_ && ec_) throw_exception( boost::system::system_error( ec_) ); return value_; }
开发者ID:eyakubovich,项目名称:boost-fiber,代码行数:9,
示例10: sr_event_notif_subscribe_treevoid Subscribe::event_notif_subscribe_tree(const char *xpath, S_Callback callback, void *private_ctx, sr_subscr_options_t opts){ callback->private_ctx["event_notif_tree"] = private_ctx; cb_list.push_back(callback); int ret = sr_event_notif_subscribe_tree(_sess->_sess, xpath, event_notif_tree_cb, callback->get(), opts, &_sub); if (SR_ERR_OK != ret) { throw_exception(ret); }}
开发者ID:qmm161,项目名称:sysrepo,代码行数:10,
示例11: sr_feature_enable_subscribevoid Subscribe::feature_enable_subscribe(S_Callback callback, void *private_ctx, sr_subscr_options_t opts){ callback->private_ctx["module_install"] = private_ctx; cb_list.push_back(callback); int ret = sr_feature_enable_subscribe(_sess->_sess, feature_enable_cb, callback->get(), opts, &_sub); if (SR_ERR_OK != ret) { throw_exception(ret); }}
开发者ID:qmm161,项目名称:sysrepo,代码行数:10,
示例12: throw_exceptionJNIEXPORT jint JNICALLJava_com_redhat_et_libguestfs_GuestFS__1set_1event_1callback (JNIEnv *env, jobject obj, jlong jg, jobject jcallback, jlong jevents){ guestfs_h *g = (guestfs_h *) (long) jg; int r; struct callback_data *data; jclass callback_class; jmethodID method; char key[64]; callback_class = (*env)->GetObjectClass (env, jcallback); method = (*env)->GetMethodID (env, callback_class, METHOD_NAME, METHOD_SIGNATURE); if (method == 0) { throw_exception (env, "GuestFS.set_event_callback: callback class does not implement the EventCallback interface"); return -1; } data = malloc (sizeof *data); if (data == NULL) { throw_out_of_memory (env, "malloc"); return -1; } (*env)->GetJavaVM (env, &data->jvm); data->method = method; r = guestfs_set_event_callback (g, java_callback, (uint64_t) jevents, 0, data); if (r == -1) { free (data); throw_exception (env, guestfs_last_error (g)); return -1; } /* Register jcallback as a global reference so the GC won't free it. */ data->callback = (*env)->NewGlobalRef (env, jcallback); /* Store 'data' in the handle, so we can free it at some point. */ snprintf (key, sizeof key, "_java_event_%d", r); guestfs_set_private (g, key, data); return (jint) r;}
开发者ID:libguestfs,项目名称:libguestfs,代码行数:43,
示例13: Java_galapi_Atomic_nativeSerializeJNIEXPORT jstring JNICALLJava_galapi_Atomic_nativeSerialize (JNIEnv *jne, jclass jc, jint ji) { char *s; galax_err err = galax_string_of_atomicValue ((atomicValue) ji, &s); if (0 != err) throw_exception (jne, "java/lang/RuntimeException", galax_error_string, err); return (*jne)->NewStringUTF(jne, s);}// Java_Atomic_nativeSerialize()
开发者ID:HanumathRao,项目名称:Galax,代码行数:10,
示例14: throw_galapi_exceptionvoidthrow_galapi_exception (JNIEnv *env, char *message, int err) {#ifdef DEBUG fprintf(stderr,"Throwing Java exception with message: %s/n", message);#endif // why doesn't this work ??? : throw_exception (env, "galapi/GalapiException", message, err); // throw_exception (env, "java/lang/Exception", message, err);}
开发者ID:HanumathRao,项目名称:Galax,代码行数:10,
示例15: gdb_rl_callback_read_char_wrapperstatic voidgdb_rl_callback_read_char_wrapper (gdb_client_data client_data){ struct gdb_exception gdb_expt = gdb_rl_callback_read_char_wrapper_noexcept (); /* Rethrow using the normal EH mechanism. */ if (gdb_expt.reason < 0) throw_exception (gdb_expt);}
开发者ID:jon-turney,项目名称:binutils-gdb,代码行数:10,
示例16: BENCHMARK_RELATIVEBENCHMARK_RELATIVE(exception_wrapper_create_and_throw, iters) { std::runtime_error e("payload"); for (size_t i = 0; i < iters; ++i) { auto ew = folly::make_exception_wrapper<std::runtime_error>(e); try { ew.throw_exception(); } catch (std::runtime_error&) { } }}
开发者ID:SocialExplorerFork,项目名称:folly,代码行数:10,
示例17: switchint testSimObject::call_function( Trick::JobData * curr_job ) { int trick_ret = 0 ; switch (curr_job->id) { case 0: trick_ret = default_data_1() ; break ; case 1: trick_ret = input_processor_1() ; break ; case 2: trick_ret = initialization_1() ; break ; case 3: trick_ret = top_of_frame_1() ; break ; case 4: case 5: case 6: case 7: case 8: trick_ret = scheduled_1() ; break ; case 9: trick_ret = end_of_frame_1() ; break ; case 10: trick_ret = shutdown_1() ; break ; case 11: trick_ret = freeze_init_1() ; break ; case 12: trick_ret = freeze_1() ; break ; case 13: trick_ret = freeze_scheduled_1() ; break ; case 14: trick_ret = unfreeze_1() ; break ; case 15: trick_ret = time_tic_changed_1() ; break ; case 101: trick_ret = return_error() ; break ; case 102: trick_ret = throw_exception() ; break ; default: trick_ret = -1 ; break ; } return trick_ret ;} ;
开发者ID:Arafatk,项目名称:trick,代码行数:55,
示例18: sr_subtree_change_subscribevoid Subscribe::subtree_change_subscribe(const char *xpath, S_Callback callback, void *private_ctx, / uint32_t priority, sr_subscr_options_t opts){ callback->private_ctx["subtree_change"] = private_ctx; cb_list.push_back(callback); int ret = sr_subtree_change_subscribe(_sess->_sess, xpath, subtree_change_cb, callback->get(), priority, opts, &_sub); if (SR_ERR_OK != ret) { throw_exception(ret); }}
开发者ID:qmm161,项目名称:sysrepo,代码行数:11,
示例19: require_token// update_decl = "update" "(" identifier "," dictionary ")".bool adam_test_parser::is_update_decl() { if (is_keyword(update_k)) { require_token(open_parenthesis_k); name_t name; if (!is_identifier(name)) throw_exception("sheet name expected"); queryable_sheet_t& qs(sheet_from_name(name)); require_token(comma_k); array_t expression; if (!is_dictionary(expression)) throw_exception("dictionary expected"); require_token(close_parenthesis_k); any_regular_t dict(qs.inspect(expression)); dictionary_t d(dict.cast<adobe::dictionary_t>()); qs.set(d); qs.update(); return true; } return false;}
开发者ID:BobArcher,项目名称:adobe_source_libraries,代码行数:21,
示例20: INSTANCE_METHOD_INJECTION_BUILTIN/* SRC: classes/directoryiterator.php line 14 */void c_DirectoryIterator::t___construct(Variant v_path) { INSTANCE_METHOD_INJECTION_BUILTIN(DirectoryIterator, DirectoryIterator::__construct); if (!(x_hphp_directoryiterator___construct(GET_THIS_TYPED(DirectoryIterator), toString(v_path)))) { { { p_UnexpectedValueException tmp0 = coo_UnexpectedValueException(); throw_exception(((c_UnexpectedValueException*)tmp0.get()->create(concat3(NAMSTR(s_sys_ss19fa93f0, "DirectoryIterator::__construct("), toString(v_path), NAMSTR(s_sys_ss4e2ff123, "): failed to open dir"))), tmp0)); } } }}
开发者ID:BauerBox,项目名称:hiphop-php,代码行数:12,
示例21: catch_exceptions_with_msgintcatch_exceptions_with_msg (struct ui_out *func_uiout, catch_exceptions_ftype *func, void *func_args, char **gdberrmsg, return_mask mask){ struct gdb_exception exception = exception_none; volatile int val = 0; struct ui_out *saved_uiout; /* Save and override the global ``struct ui_out'' builder. */ saved_uiout = current_uiout; current_uiout = func_uiout; TRY { val = (*func) (current_uiout, func_args); } CATCH (ex, RETURN_MASK_ALL) { exception = ex; } END_CATCH /* Restore the global builder. */ current_uiout = saved_uiout; if (exception.reason < 0 && (mask & RETURN_MASK (exception.reason)) == 0) { /* The caller didn't request that the event be caught. Rethrow. */ throw_exception (exception); } exception_print (gdb_stderr, exception); gdb_assert (val >= 0); gdb_assert (exception.reason <= 0); if (exception.reason < 0) { /* If caller wants a copy of the low-level error message, make one. This is used in the case of a silent error whereby the caller may optionally want to issue the message. */ if (gdberrmsg != NULL) { if (exception.message != NULL) *gdberrmsg = xstrdup (exception.message); else *gdberrmsg = NULL; } return exception.reason; } return val;}
开发者ID:ChrisG0x20,项目名称:gdb,代码行数:54,
示例22: enduse_initint enduse_init(enduse *e){#ifdef _DEBUG if (e->magic!=enduse_magic) throw_exception("enduse '%s' magic number bad", e->name);#endif e->t_last = TS_ZERO; return 0;}
开发者ID:project-hephaestus,项目名称:electric_train,代码行数:11,
示例23: ACE_DEBUGvoidtest_i::unknown_exception_in_method (void){ ACE_DEBUG ((LM_DEBUG, "test_i::unknown_exception_in_method() called/n")); ACE_DEBUG ((LM_DEBUG, "Unknown exception being generated: should be propagated to the client/n")); throw_exception ();}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:11,
示例24: throw_exceptionJNIEXPORT jboolean JNICALL Java_org_xerial_snappy_SnappyNative_isValidCompressedBuffer__Ljava_nio_ByteBuffer_2II (JNIEnv * env, jobject self, jobject compressed, jint cpos, jint clen){ char* compressedBuffer = (char*) env->GetDirectBufferAddress(compressed); if(compressedBuffer == 0) { throw_exception(env, self, 3); return (jint) 0; } bool ret = snappy::IsValidCompressedBuffer(compressedBuffer + cpos, (size_t) clen); return ret;}
开发者ID:phrocker,项目名称:hadoop-core-mod,代码行数:11,
示例25: sr_dp_get_items_subscribevoid Subscribe::dp_get_items_subscribe(const char *xpath, S_Callback callback, void *private_ctx,/ sr_subscr_options_t opts){ callback->private_ctx["dp_get_items"] = private_ctx; cb_list.push_back(callback); int ret = sr_dp_get_items_subscribe(_sess->_sess, xpath, dp_get_items_cb, callback->get(), opts, &_sub); if (SR_ERR_OK != ret) { throw_exception(ret); }}
开发者ID:qmm161,项目名称:sysrepo,代码行数:11,
示例26: throw_exception_ void throw_exception_( E const & x, char const * current_function, char const * file, int line ) { throw_exception( set_info( set_info( set_info( enable_error_info(x), throw_function(current_function)), throw_file(file)), throw_line(line))); }
开发者ID:Nanonid,项目名称:Javolution,代码行数:12,
示例27: jba_to_bigintint jba_to_bigint(JNIEnv *env, BIGNUM **out, jbyteArray jba) { jsize len; len = (*env)->GetArrayLength(env, jba); if (!len) { throw_exception(env, "java/lang/RuntimeException", "Could not convert BIGNUM"); return (0); }// LOGD("BigInt Size is: %d/n", len); jbyte buff[len]; (*env)->GetByteArrayRegion(env, jba, 0, len, buff); *out = BN_bin2bn(buff, len, NULL); if (*out == NULL) { throw_exception(env, "java/lang/RuntimeException", "Could not convert BIGNUM"); return (0); } return (1);}
开发者ID:grandamp,项目名称:card-read,代码行数:21,
注:本文中的throw_exception函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ throw_if_disposed函数代码示例 C++ throw_error_already_set函数代码示例 |