Reviewed By: zertosh, passy Differential Revision: D37579214 fbshipit-source-id: 0e52bd2b27abbbde32f77b073d3ed5ef33f4d318
39 lines
1.0 KiB
Rust
39 lines
1.0 KiB
Rust
/*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
use crate::types::PackType;
|
|
use crate::types::Platform;
|
|
use std::fmt;
|
|
use std::path::PathBuf;
|
|
|
|
#[derive(Debug)]
|
|
pub enum Error {
|
|
MissingPackFile(Platform, PackType, PathBuf),
|
|
MissingPlatformDefinition(Platform),
|
|
}
|
|
|
|
impl std::error::Error for Error {}
|
|
|
|
impl fmt::Display for Error {
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
match self {
|
|
Self::MissingPackFile(platform, pack_type, path) => write!(
|
|
f,
|
|
"Couldn't open file to pack for platform {:?} and type {:?}: {}",
|
|
platform,
|
|
pack_type,
|
|
path.to_string_lossy()
|
|
),
|
|
Self::MissingPlatformDefinition(platform) => write!(
|
|
f,
|
|
"Platform {:?} is not defined in the given packlist.",
|
|
platform
|
|
),
|
|
}
|
|
}
|
|
}
|