mirror of
https://github.com/Permissionless-Software-Foundation/bch-dex.git
synced 2026-09-22 17:12:03 -07:00
Merge pull request #66 from christroutner/err-log
fix(err on no log): Returns an message indicating no log file available
This commit is contained in:
@@ -60,6 +60,16 @@ class LogsApi {
|
||||
// Generate the full path and file name for the current log file.
|
||||
const fullPath = _this.generateFileName()
|
||||
|
||||
// Throw an error if the file does not exist.
|
||||
fs.sts(fullPath, (err, stat) => {
|
||||
if (err) {
|
||||
ctx.body = {
|
||||
success: false,
|
||||
data: 'file does not exist'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// Read in the data from the log file.
|
||||
const data = await _this.readLines(fullPath)
|
||||
// console.log(`data: ${JSON.stringify(data, null, 2)}`)
|
||||
|
||||
Reference in New Issue
Block a user