1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
use std::path::PathBuf;
/// Errors raised while loading and parsing a VRM 1.0 avatar.
#[derive(Debug, thiserror::Error)]
pub enum LoadError {
/// Reading a file or an external buffer/image URI failed.
#[error("failed to read `{path}`: {source}")]
Io {
/// Path that could not be read.
path: PathBuf,
/// Underlying file-system error.
#[source]
source: std::io::Error,
},
/// The glTF container or core document is malformed.
#[error("glTF parse error: {0}")]
Gltf(#[from] gltf::Error),
/// A VRM extension payload could not be decoded as JSON.
#[error("JSON deserialize error: {0}")]
Json(#[from] serde_json::Error),
/// The document declares the unsupported VRM 0.x format.
#[error("VRM 0.x specification is not supported. Please use VRM 1.0 (VRMC_VRM) models.")]
UnsupportedVrmVersion,
/// The required top-level `VRMC_vrm` extension is absent.
#[error("VRMC_VRM extension missing")]
MissingVrmExtension,
/// The document violates a VRM or supported glTF semantic requirement.
#[error("invalid VRM document: {0}")]
InvalidVrm(String),
/// The document requires an extension that this crate cannot evaluate.
#[error("required extension `{0}` is not supported")]
UnsupportedRequiredExtension(String),
/// A supported extension object is malformed at a known document location.
#[error("invalid `{extension}` extension at {location}: {source}")]
InvalidExtension {
/// Extension identifier whose payload failed to decode.
extension: &'static str,
/// JSON-style path to the malformed extension object.
location: String,
/// Underlying JSON decoding error.
#[source]
source: serde_json::Error,
},
}
/// Errors raised when a programmatically assembled asset is finalized.
#[derive(Debug, thiserror::Error)]
pub enum BuildError {
/// The assembled object graph violates an asset invariant.
#[error("invalid avatar asset: {0}")]
InvalidAsset(String),
}