mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-03 12:53:34 -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.memory.monitor(logger)
|
||||
Server = require("./app/js/infrastructure/Server")
|
||||
Errors = require "./app/js/errors"
|
||||
|
||||
argv = require("optimist")
|
||||
.options("user", {alias : "u", description : "Run the server with permissions of the specified user"})
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
ProjectEntityHandler = require "../Project/ProjectEntityHandler"
|
||||
Errors = require "../../errors"
|
||||
logger = require("logger-sharelatex")
|
||||
|
||||
module.exports =
|
||||
|
|
|
@ -14,7 +14,7 @@ module.exports = ErrorController =
|
|||
|
||||
handleError: (error, req, res, next) ->
|
||||
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)
|
||||
return
|
||||
if error instanceof Errors.NotFoundError
|
||||
|
|
|
@ -4,7 +4,7 @@ Doc = require('../../models/Doc').Doc
|
|||
Folder = require('../../models/Folder').Folder
|
||||
File = require('../../models/File').File
|
||||
FileStoreHandler = require("../FileStore/FileStoreHandler")
|
||||
Errors = require "../../errors"
|
||||
Errors = require "../Errors/Errors"
|
||||
tpdsUpdateSender = require('../ThirdPartyDataStore/TpdsUpdateSender')
|
||||
projectLocator = require('./ProjectLocator')
|
||||
path = require "path"
|
||||
|
|
|
@ -3,7 +3,6 @@ db = mongojs.db
|
|||
ObjectId = mongojs.ObjectId
|
||||
async = require "async"
|
||||
Project = require("../../models/Project").Project
|
||||
Errors = require("../../errors")
|
||||
logger = require("logger-sharelatex")
|
||||
|
||||
module.exports = ProjectGetter =
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Project = require('../../models/Project').Project
|
||||
ProjectGetter = require("./ProjectGetter")
|
||||
Errors = require "../../errors"
|
||||
Errors = require "../Errors/Errors"
|
||||
_ = require('underscore')
|
||||
logger = require('logger-sharelatex')
|
||||
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')
|
||||
sanitize = require('sanitizer')
|
||||
concreteObjectId = require('mongoose').Types.ObjectId
|
||||
Errors = require "../errors"
|
||||
Errors = require "../Features/Errors/Errors"
|
||||
|
||||
|
||||
Schema = mongoose.Schema
|
||||
|
|
|
@ -7,7 +7,7 @@ SandboxedModule = require('sandboxed-module')
|
|||
events = require "events"
|
||||
MockRequest = require "../helpers/MockRequest"
|
||||
MockResponse = require "../helpers/MockResponse"
|
||||
Errors = require "../../../../app/js/errors"
|
||||
Errors = require "../../../../app/js/Features/Errors/Errors"
|
||||
|
||||
describe "DocumentController", ->
|
||||
beforeEach ->
|
||||
|
|
|
@ -7,7 +7,7 @@ modulePath = "../../../../app/js/Features/Project/ProjectEntityHandler"
|
|||
SandboxedModule = require('sandboxed-module')
|
||||
ObjectId = require("mongoose").Types.ObjectId
|
||||
tk = require 'timekeeper'
|
||||
Errors = require "../../../../app/js/errors"
|
||||
Errors = require "../../../../app/js/Features/Errors/Errors"
|
||||
|
||||
describe 'ProjectEntityHandler', ->
|
||||
project_id = '4eecb1c1bffa66588e0000a1'
|
||||
|
|
|
@ -5,7 +5,7 @@ should = chai.should()
|
|||
modulePath = "../../../../app/js/Features/Project/ProjectLocator"
|
||||
SandboxedModule = require('sandboxed-module')
|
||||
sinon = require('sinon')
|
||||
Errors = require "../../../../app/js/errors"
|
||||
Errors = require "../../../../app/js/Features/Errors/Errors"
|
||||
expect = require("chai").expect
|
||||
Project = class Project
|
||||
|
||||
|
|
Loading…
Reference in a new issue