mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-01 19:58:15 +00:00
WIP error messages (#8764)
Co-authored-by: Wouter van Oortmerssen <aardappel@gmail.com>
This commit is contained in:
@@ -2903,19 +2903,19 @@ class PythonGenerator : public BaseGenerator {
|
||||
|
||||
} // namespace python
|
||||
|
||||
static bool GeneratePython(const Parser& parser, const std::string& path,
|
||||
static const char* GeneratePython(const Parser& parser, const std::string& path,
|
||||
const std::string& file_name) {
|
||||
python::Version version{parser.opts.python_version};
|
||||
if (!version.IsValid()) return false;
|
||||
if (!version.IsValid()) return "The provided Python version is not valid";
|
||||
|
||||
python::PythonGenerator generator(parser, path, file_name, version);
|
||||
if (!generator.generate()) return false;
|
||||
if (!generator.generate()) return "could not generate Python code";
|
||||
|
||||
if (parser.opts.python_typing) {
|
||||
python::PythonStubGenerator stub_generator(parser, path, version);
|
||||
if (!stub_generator.Generate()) return false;
|
||||
if (!stub_generator.Generate()) return "could not generate Python type stubs";
|
||||
}
|
||||
return true;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
namespace {
|
||||
@@ -2924,7 +2924,9 @@ class PythonCodeGenerator : public CodeGenerator {
|
||||
public:
|
||||
Status GenerateCode(const Parser& parser, const std::string& path,
|
||||
const std::string& filename) override {
|
||||
if (!GeneratePython(parser, path, filename)) {
|
||||
auto err = GeneratePython(parser, path, filename);
|
||||
if (err) {
|
||||
status_detail = " " + std::string(err);
|
||||
return Status::ERROR;
|
||||
}
|
||||
return Status::OK;
|
||||
@@ -2946,7 +2948,7 @@ class PythonCodeGenerator : public CodeGenerator {
|
||||
|
||||
Status GenerateGrpcCode(const Parser& parser, const std::string& path,
|
||||
const std::string& filename) override {
|
||||
if (!GeneratePythonGRPC(parser, path, filename)) {
|
||||
if (!GeneratePythonGRPC(parser, path, filename)) { // TODO add status GeneratePythonGRPC
|
||||
return Status::ERROR;
|
||||
}
|
||||
return Status::OK;
|
||||
|
||||
Reference in New Issue
Block a user