tgstation / rust-g

Rust based libraries for tgstation
MIT License
28 stars 100 forks source link

toml to json now returns error reasons to byond + rust-analyzer.cargo.target gnu > msvc #98

Closed tralezab closed 2 years ago

tralezab commented 2 years ago

toml to json: One half of better error reporting for things like banned word filters in game, the other half has to be displaying the error on DM side.

rust-analyzer.cargo.target: fixes #86 and let me say holy shit that was one hellish part of getting the analyzer working

BLAZING LY FAST

Mothblocks commented 2 years ago

Right now this is going to cause a backwards incompatibility issue where rustg_read_toml_file does something different now

I think you should change dmsrc to be like this:

#define rustg_read_toml_file_result(path) json_decode(call(RUST_G, "toml_file_to_json")(path) || "null")

/proc/rustg_read_toml_file(path)
    var/output = rustg_read_toml_file_result(path)
    if (output["success"])
        return output["content"]
    else
        CRASH(output["content"])

That way existing consumers and consumers that just want to runtime instead of need to manage it can use the existing thing, and anything that wants to especially handle the error case can use rustg_read_toml_file_result

tralezab commented 2 years ago

Aye aye, cap'n!

Mothblocks commented 2 years ago

@tralezab Needs to be in dmsrc

AffectedArc07 commented 2 years ago

Right now this is going to cause a backwards incompatibility issue where rustg_read_toml_file does something different now

I think you should change dmsrc to be like this:

#define rustg_read_toml_file_result(path) json_decode(call(RUST_G, "toml_file_to_json")(path) || "null")

/proc/rustg_read_toml_file(path)
    var/output = rustg_read_toml_file_result(path)
    if (output["success"])
        return output["content"]
    else
        CRASH(output["content"])

That way existing consumers and consumers that just want to runtime instead of need to manage it can use the existing thing, and anything that wants to especially handle the error case can use rustg_read_toml_file_result

Make it rustg_raw_read_toml_file(), result is questionable.

tralezab commented 2 years ago

👍

tralezab commented 2 years ago

I don't know what's up with the linux build...

willox commented 2 years ago

Looks like it is ~encoding~ expected to encode the enabled field as 1 instead of true.

optimumtact commented 2 years ago

you need to fix the unit tests to expect the backtrace

/test/proc/check_toml_file2json ------------------------------------------

Mothblocks commented 2 years ago

@tralezab 🥺

tralezab commented 2 years ago

Now I understand what's up I got it