feat(lib/utils/errors): add getCurrentStack
This commit is contained in:
parent
ba835cdfbc
commit
b4923296e5
1 changed files with 5 additions and 0 deletions
|
|
@ -1,3 +1,8 @@
|
|||
export function getErrorStack(e: unknown) {
|
||||
return e instanceof Error ? e.stack : String(e)
|
||||
}
|
||||
|
||||
export function getCurrentStack() {
|
||||
const { stack } = new Error()
|
||||
return stack!.split('\n').slice(2).join('\n')
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue