This commit is contained in:
MomentQYC
2023-08-10 18:03:18 +08:00
parent 191c5f07a4
commit 6feda8469a
5 changed files with 15 additions and 15 deletions
+6 -6
View File
@@ -752,12 +752,12 @@ export class DriveService {
return; return;
} else { } else {
const error = new Error(`Failed to delete the file from the object storage with the given key: ${key}`); const error = new Error(`Failed to delete the file from the object storage with the given key: ${key}`);
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
Object.defineProperty(error, 'stack', { value: ''}); Object.defineProperty(error, 'stack', { value: '' });
Object.defineProperty(err, 'stack', { value: ''}); Object.defineProperty(err, 'stack', { value: '' });
} }
error['cause'] = err; error['cause'] = err;
throw error; throw error;
} }
} }
} }
@@ -438,7 +438,7 @@ export class NoteCreateService implements OnApplicationShutdown {
const err = new Error('Duplicated note'); const err = new Error('Duplicated note');
err.name = 'duplicated'; err.name = 'duplicated';
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
Object.defineProperty(err, 'stack', { value: ''}); Object.defineProperty(err, 'stack', { value: '' });
} }
throw err; throw err;
} }
@@ -83,26 +83,26 @@ export class ApNoteService {
if (!validPost.includes(getApType(object))) { if (!validPost.includes(getApType(object))) {
const error = new Error(`invalid Note: invalid object type ${getApType(object)}`); const error = new Error(`invalid Note: invalid object type ${getApType(object)}`);
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
Object.defineProperty(error, 'stack', { value: ''}); Object.defineProperty(error, 'stack', { value: '' });
} }
return error return error;
} }
if (object.id && this.utilityService.extractDbHost(object.id) !== expectHost) { if (object.id && this.utilityService.extractDbHost(object.id) !== expectHost) {
const error = new Error(`invalid Note: id has different host. expected: ${expectHost}, actual: ${this.utilityService.extractDbHost(object.id)}`); const error = new Error(`invalid Note: id has different host. expected: ${expectHost}, actual: ${this.utilityService.extractDbHost(object.id)}`);
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
Object.defineProperty(error, 'stack', { value: ''}); Object.defineProperty(error, 'stack', { value: '' });
} }
return error return error;
} }
const actualHost = object.attributedTo && this.utilityService.extractDbHost(getOneApId(object.attributedTo)); const actualHost = object.attributedTo && this.utilityService.extractDbHost(getOneApId(object.attributedTo));
if (object.attributedTo && actualHost !== expectHost) { if (object.attributedTo && actualHost !== expectHost) {
const error = new Error(`invalid Note: attributedTo has different host. expected: ${expectHost}, actual: ${actualHost}`); const error = new Error(`invalid Note: attributedTo has different host. expected: ${expectHost}, actual: ${actualHost}`);
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
Object.defineProperty(error, 'stack', { value: ''}); Object.defineProperty(error, 'stack', { value: '' });
} }
return error return error;
} }
return null; return null;
+1 -1
View File
@@ -4,4 +4,4 @@ export function ErrorHandling(message: string): Error {
error.stack = undefined; error.stack = undefined;
} }
return error; return error;
} }
+1 -1
View File
@@ -4,4 +4,4 @@ export function ErrorHandling(message: string): Error {
error.stack = undefined; error.stack = undefined;
} }
return error; return error;
} }