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
use thiserror::Error;
mod api;
mod api_generator;
mod exporter;
mod internal;
pub use api::load_api;
pub use api_generator::ApiGenerator;
pub use exporter::FactorioExporter;
#[derive(Error, Debug)]
pub enum FactorioExporterError {
#[error("API definition file (runtime-api.json) not found")]
ApiDefinitionNotFound(),
#[error("I/O error")]
IoError(#[from] std::io::Error),
#[error("failed to parse JSON")]
JsonParsingError(#[from] serde_json::Error),
#[error("failed to parse YAML")]
YamlParsingError(#[from] serde_yaml::Error),
#[error("error while executing Factorio")]
FactorioExecutionError { stdout: String, stderr: String },
}
pub type Result<T> = std::result::Result<T, FactorioExporterError>;