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
use thiserror::Error;
use crate::support::SupportReport;
/// Errors that can occur while parsing, validating, or rendering Lottie content.
#[derive(Debug, Error)]
#[non_exhaustive]
pub enum RasterlottieError {
/// The input JSON could not be deserialized into the library model.
#[error("failed to parse Lottie JSON: {0}")]
Parse(#[from] serde_json::Error),
/// GIF encoding failed after raster frames had been rendered.
#[cfg(feature = "gif")]
#[error("failed to encode GIF: {0}")]
GifEncoding(#[from] gif::EncodingError),
/// The animation uses features that the configured support profile rejects.
#[error("animation contains unsupported features: {report}")]
UnsupportedFeatures {
/// Report that describes the rejected features.
report: SupportReport,
},
/// The requested output canvas size was zero or otherwise invalid.
#[error("invalid canvas size {width}x{height}")]
InvalidCanvasSize {
/// Requested width in pixels.
width: u32,
/// Requested height in pixels.
height: u32,
},
/// An image asset was malformed or could not be decoded.
#[error("invalid image asset `{id}`: {detail}")]
InvalidImageAsset {
/// Asset identifier.
id: String,
/// Human-readable validation or decode failure reason.
detail: String,
},
/// A text layer could not be interpreted by the text renderer.
#[error("invalid text layer `{layer}`: {detail}")]
InvalidTextLayer {
/// Layer name or identifier.
layer: String,
/// Human-readable validation or shaping failure reason.
detail: String,
},
}