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 {
2727 . packages
2828 . iter ( )
2929 . 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+ } ) ?;
3133
3234 let bootloader_pkg = bootloader_package ( project_metadata, kernel_pkg) ?;
3335 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 } ;
22use thiserror:: Error ;
33
44/// Represents an error that occurred while creating a new `Builder`.
@@ -93,9 +93,20 @@ pub enum BootloaderError {
9393 You need to add a dependency on a crate named `bootloader` in your Cargo.toml."
9494 ) ]
9595 BootloaderNotFound ,
96+
9697 /// Bootloader dependency has not the right format
9798 #[ error( "The `bootloader` dependency has not the right format: {0}" ) ]
9899 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+
99110 /// Could not find some required information in the `cargo metadata` output
100111 #[ error( "Could not find required key `{key}` in cargo metadata output" ) ]
101112 CargoMetadataIncomplete {
You can’t perform that action at this time.
0 commit comments