mirror of
https://github.com/overleaf/overleaf.git
synced 2025-03-20 19:02:25 +00:00
Merge pull request #7123 from overleaf/jk-logging-catch-folder-error
[web] Add logging around crash site in `ProjectEntityHandler` GitOrigin-RevId: 73ae00c10dba3783417d88785427c77c59faf57b
This commit is contained in:
parent
da3b5b76c4
commit
ebec861562
1 changed files with 15 additions and 8 deletions
|
@ -3,6 +3,7 @@ const DocstoreManager = require('../Docstore/DocstoreManager')
|
|||
const Errors = require('../Errors/Errors')
|
||||
const ProjectGetter = require('./ProjectGetter')
|
||||
const { promisifyAll } = require('../../util/promises')
|
||||
const OError = require('@overleaf/o-error')
|
||||
|
||||
const ProjectEntityHandler = {
|
||||
getAllDocs(projectId, callback) {
|
||||
|
@ -206,17 +207,23 @@ const ProjectEntityHandler = {
|
|||
|
||||
_getAllFoldersFromProject(project) {
|
||||
const folders = []
|
||||
function processFolder(basePath, folder) {
|
||||
folders.push({ path: basePath, folder })
|
||||
for (const childFolder of folder.folders || []) {
|
||||
if (childFolder.name != null) {
|
||||
processFolder(path.join(basePath, childFolder.name), childFolder)
|
||||
try {
|
||||
const processFolder = (basePath, folder) => {
|
||||
folders.push({ path: basePath, folder })
|
||||
if (folder.folders) {
|
||||
for (const childFolder of folder.folders) {
|
||||
if (childFolder.name != null) {
|
||||
const childPath = path.join(basePath, childFolder.name)
|
||||
processFolder(childPath, childFolder)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
processFolder('/', project.rootFolder[0])
|
||||
return folders
|
||||
} catch (err) {
|
||||
throw OError.tag(err, 'Error getting folders', { projectId: project._id })
|
||||
}
|
||||
|
||||
processFolder('/', project.rootFolder[0])
|
||||
return folders
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue