mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
[monorepo] remove PII and variables from error messages (#31508)
* [monorepo] remove PII and variables from error messages Exclusions: - scripts - tests - fuzzing - SplitTestManager (messages are sent to admin frontend) - Group setup (we may want an error per unique tuple) - sharejs (unused types; text type errors are shadowed already) - history-v1 error messages that are used by the ErrorRecorder - errors that flag issues with configuration/call signatures I've used these search terms for finding unwanted error messages: - new Error(` - new Error\(\n\s+` (regex search) - new OError(` - new OError\(\n\s+` (regex search) * [web] throw NotFoundError from ProjectLocator * [github-sync] fix OError.tag call in script Co-authored-by: Jessica Lawshe <jessica.lawshe@overleaf.com> * [templates] revert changes to test client --------- Co-authored-by: Jessica Lawshe <jessica.lawshe@overleaf.com> GitOrigin-RevId: 736857a4fc5d9bfb0f8cb03e0f004eda87e5a220
This commit is contained in:
@@ -4,6 +4,7 @@ import { callbackify } from 'node:util'
|
||||
import { db, ObjectId } from '../../infrastructure/mongodb.mjs'
|
||||
import Errors from '../Errors/Errors.js'
|
||||
import mongodb from 'mongodb-legacy'
|
||||
import OError from '@overleaf/o-error'
|
||||
const safeCompilers = ['xelatex', 'pdflatex', 'latex', 'lualatex']
|
||||
|
||||
const { ReturnDocument } = mongodb
|
||||
@@ -16,7 +17,7 @@ const ProjectOptionsHandler = {
|
||||
normalizeCompiler(compiler) {
|
||||
compiler = compiler.toLowerCase()
|
||||
if (!safeCompilers.includes(compiler)) {
|
||||
throw new Error(`invalid compiler: ${compiler}`)
|
||||
throw new OError('invalid compiler', { compiler })
|
||||
}
|
||||
return compiler
|
||||
},
|
||||
@@ -44,7 +45,7 @@ const ProjectOptionsHandler = {
|
||||
allowed => imageName === allowed.imageName
|
||||
)
|
||||
if (!isAllowed) {
|
||||
throw new Error(`invalid imageName: ${imageName}`)
|
||||
throw new OError('invalid imageName', { imageName })
|
||||
}
|
||||
return settings.imageRoot + '/' + imageName
|
||||
},
|
||||
@@ -67,7 +68,7 @@ const ProjectOptionsHandler = {
|
||||
language => language.code === languageCode
|
||||
)
|
||||
if (languageCode && !language) {
|
||||
throw new Error(`invalid languageCode: ${languageCode}`)
|
||||
throw new OError('invalid languageCode', { languageCode })
|
||||
}
|
||||
const conditions = { _id: projectId }
|
||||
const update = { spellCheckLanguage: languageCode }
|
||||
|
||||
Reference in New Issue
Block a user