You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I missed in the docs (if it's there at all) that plugin names can't have underscores in them. I would have figured this out pretty quickly had the error message for serializing capabilities/default.json been more specific. However, all I got from the build script was
thread 'main' panicked at trellis/src-tauri/build.rs:14:6:
failed to run tauri-build: failed to parse JSON: data did not match any variant of untagged enum CapabilityFile
I spun up a quick-and-dirty implementation for only /core/tauri-utils/src/acl/capability.rs. I'll open a PR for it in a moment, but it obviously needs work. Before it's merged (if it is going in the right direction), we would need to find all similar instances present in other files.
The result is an error like this:
thread 'main' panicked at build.rs:11:6:
failed to run tauri-build: failed to parse JSON: identifiers can only include lowercase ASCII, hyphens which are not leading or trailing, and a single colon if using a prefix at line 16 column 23
It's not perfect; it would also be nice to wrap this error with some information about which file is throwing the error.
Also, it would be nice if the "no underscore" requirement for plugin names is stated in the docs. I think it might go nicely here: https://v2.tauri.app/develop/plugins/, but I don't have time to make another PR.
Alternatives considered
Besides writing our own deserializer without serde_untagged, I don't know of any other options.
Additional context
No response
The text was updated successfully, but these errors were encountered:
jsimonrichard
changed the title
[feat] Better errors when deserializing capabilities (among other things)
[feat] Better errors when deserializing capabilities
Jun 3, 2024
Describe the problem
I missed in the docs (if it's there at all) that plugin names can't have underscores in them. I would have figured this out pretty quickly had the error message for serializing capabilities/default.json been more specific. However, all I got from the build script was
Describe the solution you'd like
Normally, serde would give a more specific error, but it can't because it doesn't know which variant of the untagged enum to compare the file to. Based on serde-rs/serde#2157 (comment), this could be mitigated by using https://docs.rs/serde-untagged/latest/serde_untagged/index.html.
I spun up a quick-and-dirty implementation for only
/core/tauri-utils/src/acl/capability.rs
. I'll open a PR for it in a moment, but it obviously needs work. Before it's merged (if it is going in the right direction), we would need to find all similar instances present in other files.The result is an error like this:
It's not perfect; it would also be nice to wrap this error with some information about which file is throwing the error.
Also, it would be nice if the "no underscore" requirement for plugin names is stated in the docs. I think it might go nicely here: https://v2.tauri.app/develop/plugins/, but I don't have time to make another PR.
Alternatives considered
Besides writing our own deserializer without
serde_untagged
, I don't know of any other options.Additional context
No response
The text was updated successfully, but these errors were encountered: