|
@@ -14,7 +14,6 @@ import RequestParser from './RequestParser.js'
|
|
|
import { pipeline } from 'node:stream/promises'
|
|
import { pipeline } from 'node:stream/promises'
|
|
|
import Settings from '@overleaf/settings'
|
|
import Settings from '@overleaf/settings'
|
|
|
import Path from 'node:path'
|
|
import Path from 'node:path'
|
|
|
-import { ConversionError } from './Errors.js'
|
|
|
|
|
|
|
|
|
|
const CONVERSION_CONFIGS = {
|
|
const CONVERSION_CONFIGS = {
|
|
|
docx: { extension: 'docx' },
|
|
docx: { extension: 'docx' },
|
|
@@ -42,7 +41,7 @@ async function convertDocumentToLaTeX(req, res) {
|
|
|
conversionType
|
|
conversionType
|
|
|
)
|
|
)
|
|
|
} catch (err) {
|
|
} catch (err) {
|
|
|
- if (err instanceof ConversionError) {
|
|
|
|
|
|
|
+ if (err instanceof Errors.ConversionError) {
|
|
|
if (err.isUserFacing) {
|
|
if (err.isUserFacing) {
|
|
|
return res.status(422).json({
|
|
return res.status(422).json({
|
|
|
error: err.stderr,
|
|
error: err.stderr,
|
|
@@ -178,7 +177,7 @@ async function convertProjectToDocument(req, res) {
|
|
|
await pipeline(readStream, res)
|
|
await pipeline(readStream, res)
|
|
|
}
|
|
}
|
|
|
} catch (err) {
|
|
} catch (err) {
|
|
|
- if (err instanceof ConversionError) {
|
|
|
|
|
|
|
+ if (err instanceof Errors.ConversionError) {
|
|
|
if (err.isUserFacing) {
|
|
if (err.isUserFacing) {
|
|
|
return res.status(422).json({
|
|
return res.status(422).json({
|
|
|
error: err.stderr,
|
|
error: err.stderr,
|