File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,9 @@ impl BuildConfig {
27
27
. packages
28
28
. iter ( )
29
29
. find ( |p| p. manifest_path == kernel_manifest_path)
30
- . unwrap ( ) ;
30
+ . ok_or_else ( || BootloaderError :: KernelPackageNotFound {
31
+ manifest_path : kernel_manifest_path. to_owned ( ) ,
32
+ } ) ?;
31
33
32
34
let bootloader_pkg = bootloader_package ( project_metadata, kernel_pkg) ?;
33
35
let bootloader_root = bootloader_pkg. manifest_path . parent ( ) . ok_or_else ( || {
Original file line number Diff line number Diff line change 1
- use std:: io ;
1
+ use std:: { io , path :: PathBuf } ;
2
2
use thiserror:: Error ;
3
3
4
4
/// Represents an error that occurred while creating a new `Builder`.
@@ -93,9 +93,20 @@ pub enum BootloaderError {
93
93
You need to add a dependency on a crate named `bootloader` in your Cargo.toml."
94
94
) ]
95
95
BootloaderNotFound ,
96
+
96
97
/// Bootloader dependency has not the right format
97
98
#[ error( "The `bootloader` dependency has not the right format: {0}" ) ]
98
99
BootloaderInvalid ( String ) ,
100
+
101
+ /// Could not find kernel package in cargo metadata
102
+ #[ error(
103
+ "Could not find package with manifest path `{manifest_path}` in cargo metadata output"
104
+ ) ]
105
+ KernelPackageNotFound {
106
+ /// The manifest path of the kernel package
107
+ manifest_path : PathBuf ,
108
+ } ,
109
+
99
110
/// Could not find some required information in the `cargo metadata` output
100
111
#[ error( "Could not find required key `{key}` in cargo metadata output" ) ]
101
112
CargoMetadataIncomplete {
You can’t perform that action at this time.
0 commit comments