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
60
use crate::data::buildpack::StackIdError;
use crate::data::launch::ProcessTypeError;
use crate::layer::HandleLayerError;
use crate::toml_file::TomlFileError;
use std::fmt::Debug;
pub type Result<T, E> = std::result::Result<T, Error<E>>;
#[derive(thiserror::Error, Debug)]
pub enum Error<E: Debug> {
#[error("HandleLayer error: {0}")]
HandleLayerError(#[from] HandleLayerError),
#[error("Process type error: {0}")]
ProcessTypeError(#[from] ProcessTypeError),
#[error("Stack ID error: {0}")]
StackIdError(#[from] StackIdError),
#[error("Could not determine app directory: {0}")]
CannotDetermineAppDirectory(std::io::Error),
#[error("Could not determine buildpack directory: {0}")]
CannotDetermineBuildpackDirectory(std::env::VarError),
#[error("Could not determine stack id: {0}")]
CannotDetermineStackId(std::env::VarError),
#[error("Cannot create platform from platform path: {0}")]
CannotCreatePlatformFromPath(std::io::Error),
#[error("Cannot read buildpack plan: {0}")]
CannotReadBuildpackPlan(TomlFileError),
#[error("Cannot read buildpack descriptor (buildpack.toml): {0}")]
CannotReadBuildpackDescriptor(TomlFileError),
#[error("Cannot write build plan: {0}")]
CannotWriteBuildPlan(TomlFileError),
#[error("Cannot write launch.toml: {0}")]
CannotWriteLaunch(TomlFileError),
#[error("Cannot write store.toml: {0}")]
CannotWriteStore(TomlFileError),
#[error("Buildpack error: {0:?}")]
BuildpackError(E),
}
#[cfg(feature = "anyhow")]
impl From<anyhow::Error> for Error<anyhow::Error> {
fn from(error: anyhow::Error) -> Self {
Error::BuildpackError(error)
}
}