Skip to content

Commit 766a7bf

Browse files
authored
feat(core): print the module identifier if not founded (#2731)
feat(core): print the module identifier if not finded
1 parent aa91ce7 commit 766a7bf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

crates/rspack_core/src/chunk_graph.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl ChunkGraph {
6868
self
6969
.chunk_graph_module_by_module_identifier
7070
.get_mut(&module_identifier)
71-
.expect("Module should be added before")
71+
.unwrap_or_else(|| panic!("Module({}) should be added before using", module_identifier))
7272
}
7373

7474
pub(crate) fn get_chunk_graph_module(
@@ -78,7 +78,7 @@ impl ChunkGraph {
7878
self
7979
.chunk_graph_module_by_module_identifier
8080
.get(&module_identifier)
81-
.expect("Module should be added before")
81+
.unwrap_or_else(|| panic!("Module({}) should be added before using", module_identifier))
8282
}
8383

8484
pub(crate) fn get_chunk_graph_chunk_mut(
@@ -155,7 +155,7 @@ impl ChunkGraph {
155155
let chunk_graph_module = self
156156
.chunk_graph_module_by_module_identifier
157157
.get(&module_identifier)
158-
.expect("Module should be added before");
158+
.unwrap_or_else(|| panic!("Module({}) should be added before using", module_identifier));
159159
&chunk_graph_module.chunks
160160
}
161161

0 commit comments

Comments
 (0)