Private
Public Access
1
0
Files
u-desk/internal/filesystem/errors.go

30 lines
587 B
Go

package filesystem
import (
"fmt"
"os"
"runtime"
)
// DeleteRestrictionWarning 删除限制警告
// 用于在删除受限文件时提供详细的警告信息
type DeleteRestrictionWarning struct {
Path string
Details string
Info os.FileInfo
}
func (w *DeleteRestrictionWarning) Error() string {
return fmt.Sprintf("删除限制警告: %s\n%s", w.Path, w.Details)
}
// GetStackTrace 获取堆栈跟踪(用于调试)
func GetStackTrace(skip int) string {
buf := make([]byte, 4096)
n := runtime.Stack(buf, false)
if n > 0 {
return string(buf[:n])
}
return ""
}