MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / execute

Method execute

subprojects/llama.cpp/common/jinja/runtime.cpp:54–81  ·  view source on GitHub ↗

execute with error handling

Source from the content-addressed store, hash-verified

52
53// execute with error handling
54value statement::execute(context & ctx) {
55 try {
56 return execute_impl(ctx);
57 } catch (const continue_statement::signal & /* ex */) {
58 throw;
59 } catch (const break_statement::signal & /* ex */) {
60 throw;
61 } catch (const rethrown_exception & /* ex */) {
62 throw;
63 } catch (const not_implemented_exception & /* ex */) {
64 throw;
65 } catch (const std::exception & e) {
66 const std::string & source = *ctx.src;
67 if (source.empty()) {
68 std::ostringstream oss;
69 oss << "\nError executing " << type() << " at position " << pos << ": " << e.what();
70 throw rethrown_exception(oss.str());
71 } else {
72 std::ostringstream oss;
73 oss << "\n------------\n";
74 oss << "While executing " << type() << " at " << get_line_col(source, pos) << " in source:\n";
75 oss << peak_source(source, pos) << "\n";
76 oss << "Error: " << e.what();
77 // throw as another exception to avoid repeated formatting
78 throw rethrown_exception(oss.str());
79 }
80 }
81}
82
83value identifier::execute_impl(context & ctx) {
84 auto it = ctx.get_val(val);

Callers 15

addUserServiceMethod · 0.45
benchmarkFunction · 0.45
__init__Method · 0.45
_builds_initMethod · 0.45
builds_timestampMethod · 0.45
_get_rows_llama_benchMethod · 0.45
__init__Method · 0.45
valid_formatMethod · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 7

typeEnum · 0.85
rethrown_exceptionClass · 0.85
get_line_colFunction · 0.85
peak_sourceFunction · 0.85
emptyMethod · 0.65
whatMethod · 0.45
strMethod · 0.45

Tested by 3

test_template_cppFunction · 0.36
fuzz_test_templateFunction · 0.36