mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-30 04:35:26 -05:00
Standardise on one Errors file
This commit is contained in:
parent
a95c941cb9
commit
ae5467894b
11 changed files with 7 additions and 20 deletions
|
@ -10,7 +10,6 @@ metrics = require("metrics-sharelatex")
|
||||||
metrics.initialize("web")
|
metrics.initialize("web")
|
||||||
metrics.memory.monitor(logger)
|
metrics.memory.monitor(logger)
|
||||||
Server = require("./app/js/infrastructure/Server")
|
Server = require("./app/js/infrastructure/Server")
|
||||||
Errors = require "./app/js/errors"
|
|
||||||
|
|
||||||
argv = require("optimist")
|
argv = require("optimist")
|
||||||
.options("user", {alias : "u", description : "Run the server with permissions of the specified user"})
|
.options("user", {alias : "u", description : "Run the server with permissions of the specified user"})
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
ProjectEntityHandler = require "../Project/ProjectEntityHandler"
|
ProjectEntityHandler = require "../Project/ProjectEntityHandler"
|
||||||
Errors = require "../../errors"
|
|
||||||
logger = require("logger-sharelatex")
|
logger = require("logger-sharelatex")
|
||||||
|
|
||||||
module.exports =
|
module.exports =
|
||||||
|
|
|
@ -14,7 +14,7 @@ module.exports = ErrorController =
|
||||||
|
|
||||||
handleError: (error, req, res, next) ->
|
handleError: (error, req, res, next) ->
|
||||||
if error?.code is 'EBADCSRFTOKEN'
|
if error?.code is 'EBADCSRFTOKEN'
|
||||||
logger.log err: error,url:req.url, method:req.method, user:req?.sesson?.user, "invalid csrf"
|
logger.warn err: error,url:req.url, method:req.method, user:req?.sesson?.user, "invalid csrf"
|
||||||
res.sendStatus(403)
|
res.sendStatus(403)
|
||||||
return
|
return
|
||||||
if error instanceof Errors.NotFoundError
|
if error instanceof Errors.NotFoundError
|
||||||
|
|
|
@ -4,7 +4,7 @@ Doc = require('../../models/Doc').Doc
|
||||||
Folder = require('../../models/Folder').Folder
|
Folder = require('../../models/Folder').Folder
|
||||||
File = require('../../models/File').File
|
File = require('../../models/File').File
|
||||||
FileStoreHandler = require("../FileStore/FileStoreHandler")
|
FileStoreHandler = require("../FileStore/FileStoreHandler")
|
||||||
Errors = require "../../errors"
|
Errors = require "../Errors/Errors"
|
||||||
tpdsUpdateSender = require('../ThirdPartyDataStore/TpdsUpdateSender')
|
tpdsUpdateSender = require('../ThirdPartyDataStore/TpdsUpdateSender')
|
||||||
projectLocator = require('./ProjectLocator')
|
projectLocator = require('./ProjectLocator')
|
||||||
path = require "path"
|
path = require "path"
|
||||||
|
|
|
@ -3,7 +3,6 @@ db = mongojs.db
|
||||||
ObjectId = mongojs.ObjectId
|
ObjectId = mongojs.ObjectId
|
||||||
async = require "async"
|
async = require "async"
|
||||||
Project = require("../../models/Project").Project
|
Project = require("../../models/Project").Project
|
||||||
Errors = require("../../errors")
|
|
||||||
logger = require("logger-sharelatex")
|
logger = require("logger-sharelatex")
|
||||||
|
|
||||||
module.exports = ProjectGetter =
|
module.exports = ProjectGetter =
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
Project = require('../../models/Project').Project
|
Project = require('../../models/Project').Project
|
||||||
ProjectGetter = require("./ProjectGetter")
|
ProjectGetter = require("./ProjectGetter")
|
||||||
Errors = require "../../errors"
|
Errors = require "../Errors/Errors"
|
||||||
_ = require('underscore')
|
_ = require('underscore')
|
||||||
logger = require('logger-sharelatex')
|
logger = require('logger-sharelatex')
|
||||||
async = require('async')
|
async = require('async')
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
NotFoundError = (message) ->
|
|
||||||
error = new Error(message)
|
|
||||||
error.name = "NotFoundError"
|
|
||||||
error.__proto__ = NotFoundError.prototype
|
|
||||||
return error
|
|
||||||
NotFoundError.prototype.__proto__ = Error.prototype
|
|
||||||
|
|
||||||
module.exports = Errors =
|
|
||||||
NotFoundError: NotFoundError
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ FolderSchema = require('./Folder.js').FolderSchema
|
||||||
logger = require('logger-sharelatex')
|
logger = require('logger-sharelatex')
|
||||||
sanitize = require('sanitizer')
|
sanitize = require('sanitizer')
|
||||||
concreteObjectId = require('mongoose').Types.ObjectId
|
concreteObjectId = require('mongoose').Types.ObjectId
|
||||||
Errors = require "../errors"
|
Errors = require "../Features/Errors/Errors"
|
||||||
|
|
||||||
|
|
||||||
Schema = mongoose.Schema
|
Schema = mongoose.Schema
|
||||||
|
|
|
@ -7,7 +7,7 @@ SandboxedModule = require('sandboxed-module')
|
||||||
events = require "events"
|
events = require "events"
|
||||||
MockRequest = require "../helpers/MockRequest"
|
MockRequest = require "../helpers/MockRequest"
|
||||||
MockResponse = require "../helpers/MockResponse"
|
MockResponse = require "../helpers/MockResponse"
|
||||||
Errors = require "../../../../app/js/errors"
|
Errors = require "../../../../app/js/Features/Errors/Errors"
|
||||||
|
|
||||||
describe "DocumentController", ->
|
describe "DocumentController", ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
|
|
|
@ -7,7 +7,7 @@ modulePath = "../../../../app/js/Features/Project/ProjectEntityHandler"
|
||||||
SandboxedModule = require('sandboxed-module')
|
SandboxedModule = require('sandboxed-module')
|
||||||
ObjectId = require("mongoose").Types.ObjectId
|
ObjectId = require("mongoose").Types.ObjectId
|
||||||
tk = require 'timekeeper'
|
tk = require 'timekeeper'
|
||||||
Errors = require "../../../../app/js/errors"
|
Errors = require "../../../../app/js/Features/Errors/Errors"
|
||||||
|
|
||||||
describe 'ProjectEntityHandler', ->
|
describe 'ProjectEntityHandler', ->
|
||||||
project_id = '4eecb1c1bffa66588e0000a1'
|
project_id = '4eecb1c1bffa66588e0000a1'
|
||||||
|
|
|
@ -5,7 +5,7 @@ should = chai.should()
|
||||||
modulePath = "../../../../app/js/Features/Project/ProjectLocator"
|
modulePath = "../../../../app/js/Features/Project/ProjectLocator"
|
||||||
SandboxedModule = require('sandboxed-module')
|
SandboxedModule = require('sandboxed-module')
|
||||||
sinon = require('sinon')
|
sinon = require('sinon')
|
||||||
Errors = require "../../../../app/js/errors"
|
Errors = require "../../../../app/js/Features/Errors/Errors"
|
||||||
expect = require("chai").expect
|
expect = require("chai").expect
|
||||||
Project = class Project
|
Project = class Project
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue