mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-09-22 21:30:44 +02:00
fix(log): prevent thowing on failed to get caller location (#2157)
* Fix failed to get caller location throws * Add change file * typo * build * Bump log rs * typo * early return instead of using ?
This commit is contained in:
@@ -60,7 +60,10 @@ function getCallerLocation(stack?: string) {
|
||||
|
||||
const lines = stack.split('\n')
|
||||
// Find the third line (caller's caller of the current location)
|
||||
const callerLine = lines[3].trim()
|
||||
const callerLine = lines[3]?.trim()
|
||||
if (!callerLine) {
|
||||
return
|
||||
}
|
||||
|
||||
const regex =
|
||||
/at\s+(?<functionName>.*?)\s+\((?<fileName>.*?):(?<lineNumber>\d+):(?<columnNumber>\d+)\)/
|
||||
@@ -103,7 +106,7 @@ function getCallerLocation(stack?: string) {
|
||||
return name.length > 0 && location !== '[native code]'
|
||||
})
|
||||
// Find the third line (caller's caller of the current location)
|
||||
return filtered[2].filter((v) => v.length > 0).join('@')
|
||||
return filtered[2]?.filter((v) => v.length > 0).join('@')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user