@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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/error-handling",
3
3
  "type": "module",
4
- "version": "0.63.1",
4
+ "version": "0.64.0",
5
5
  "description": "Type safe error handling.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
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 errorsLogFilePath = path.logsPath('errors.log')
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(errorsLogFilePath), { recursive: true })
41
+ await fs.mkdir(path.dirname(logFilePath), { recursive: true })
42
42
  // Append the message to the log file
43
- await fs.appendFile(errorsLogFilePath, formattedError)
43
+ await fs.appendFile(logFilePath, formattedError)
44
44
  } catch (error) {
45
45
  console.error('Failed to write to error file:', error)
46
46
  }