@stacksjs/error-handling 0.63.1 → 0.64.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -41
- package/dist/index.js.map +4 -10
- package/package.json +1 -1
- package/src/handler.ts +3 -3
package/package.json
CHANGED
package/src/handler.ts
CHANGED
|
@@ -34,13 +34,13 @@ export class ErrorHandler {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
const formattedError = `[${new Date().toISOString()}] ${err.name}: ${err.message}\n`
|
|
37
|
-
const
|
|
37
|
+
const logFilePath = path.logsPath('stacks.log') ?? path.logsPath('errors.log')
|
|
38
38
|
|
|
39
39
|
try {
|
|
40
40
|
// Ensure the directory exists
|
|
41
|
-
await fs.mkdir(path.dirname(
|
|
41
|
+
await fs.mkdir(path.dirname(logFilePath), { recursive: true })
|
|
42
42
|
// Append the message to the log file
|
|
43
|
-
await fs.appendFile(
|
|
43
|
+
await fs.appendFile(logFilePath, formattedError)
|
|
44
44
|
} catch (error) {
|
|
45
45
|
console.error('Failed to write to error file:', error)
|
|
46
46
|
}
|