Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/shdwmtr/millennium
Browse files Browse the repository at this point in the history
shdwmtr committed Jan 4, 2025
2 parents f56c52b + aa4f054 commit a94d074
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/ffi/javascript.cc
Original file line number Diff line number Diff line change
@@ -146,10 +146,10 @@ PyObject* JavaScript::EvaluateFromSocket(std::string script)
std::string type = response.json["type"];

if (type == "string") return PyUnicode_FromString(response.json["value"].get<std::string>().c_str());
else if (type == "bool") return PyBool_FromLong(response.json["value"]);
else if (type == "int") return PyLong_FromLong(response.json["value"]);
else if (type == "boolean") return PyBool_FromLong(response.json["value"]);
else if (type == "number") return PyLong_FromLong(response.json["value"]);
else
return PyUnicode_FromString("Js function returned unaccepted type. accepted types [string, bool, int]");
return PyUnicode_FromString(fmt::format("Js function returned unaccepted type '{}'. Accepted types [string, boolean, number]", type).c_str());

}
catch (nlohmann::detail::exception& ex)

0 comments on commit a94d074

Please sign in to comment.