Include asset path in get_meta_path panic message (#11504)

# Objective

- Fixes a hurdle encountered when debugging a panic caused by the file
watcher loading a `.gitignore` file, which was hard to debug because
there was no file name in the report, only `asset paths must have
extensions`

## Solution

- Panic with a formatted message that includes the asset path, e.g.
`missing expected extension for asset path .gitignore`

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Doonv <58695417+doonv@users.noreply.github.com>
This commit is contained in:
Mark Nevill 2024-01-25 08:00:36 +00:00 committed by GitHub
parent 95b92307b4
commit d974b8210e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -269,7 +269,7 @@ pub(crate) fn get_meta_path(path: &Path) -> PathBuf {
let mut meta_path = path.to_path_buf();
let mut extension = path
.extension()
.expect("asset paths must have extensions")
.unwrap_or_else(|| panic!("missing extension for asset path {path:?}"))
.to_os_string();
extension.push(".meta");
meta_path.set_extension(extension);