Files
flipper/packer/src/error.rs
Pascal Hartig b80766323f Upgrade packer
Summary:
This had collected a bit of dust and we will need to extend this a little for flipper-server.

- Update deps.
- Migrate away from deprecated clap2 model to derive (it's much shorter now and less imperative).
- ~~Some COW changes on how the progress bar crate handles strings.~~ (Reverted as this causes havvoc in `fbsource//third-party/rust`.)
- Upgraded to 2021 Edition.

Reviewed By: nikoant

Differential Revision: D35433571

fbshipit-source-id: ae0a91558610ae46069a5fc5162b524cde759454
2022-04-07 07:40:57 -07:00

38 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, 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
),
}
}
}