minor bugfixes
This commit is contained in:
parent
8236d151ed
commit
be25b9e068
@ -66,14 +66,11 @@ export class RenderingMWs {
|
|||||||
if (err.details) {
|
if (err.details) {
|
||||||
Logger.warn('Handled error:');
|
Logger.warn('Handled error:');
|
||||||
console.log(err);
|
console.log(err);
|
||||||
|
delete (err.details); // do not send back error object to the client side
|
||||||
|
|
||||||
|
// hide error details for non developers
|
||||||
if (!(req.session.user && req.session.user.role >= UserRoles.Developer)) {
|
if (!(req.session.user && req.session.user.role >= UserRoles.Developer)) {
|
||||||
delete (err.details);
|
delete (err.detailsStr);
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
err.details = err.details.toString() || err.details;
|
|
||||||
} catch (err) {
|
|
||||||
console.error(err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const message = new Message<any>(err, null);
|
const message = new Message<any>(err, null);
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import {MediaDTO} from '../../../../common/entities/MediaDTO';
|
|||||||
import {ProjectPath} from '../../../ProjectPath';
|
import {ProjectPath} from '../../../ProjectPath';
|
||||||
import {ThumbnailGeneratorMWs} from '../../../middlewares/thumbnail/ThumbnailGeneratorMWs';
|
import {ThumbnailGeneratorMWs} from '../../../middlewares/thumbnail/ThumbnailGeneratorMWs';
|
||||||
import {Task} from './Task';
|
import {Task} from './Task';
|
||||||
import {ConfigTemplateEntry, DefaultsTasks, TaskDTO} from '../../../../common/entities/task/TaskDTO';
|
import {ConfigTemplateEntry, DefaultsTasks} from '../../../../common/entities/task/TaskDTO';
|
||||||
import {ServerConfig} from '../../../../common/config/private/IPrivateConfig';
|
import {ServerConfig} from '../../../../common/config/private/IPrivateConfig';
|
||||||
|
|
||||||
declare const global: any;
|
declare const global: any;
|
||||||
|
|||||||
@ -23,10 +23,13 @@ export enum ErrorCodes {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class ErrorDTO {
|
export class ErrorDTO {
|
||||||
|
public detailsStr: string;
|
||||||
|
|
||||||
constructor(public code: ErrorCodes, public message?: string, public details?: any) {
|
constructor(public code: ErrorCodes, public message?: string, public details?: any) {
|
||||||
|
this.detailsStr = (this.details ? this.details.toString() : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
toString(): string {
|
toString(): string {
|
||||||
return '[' + ErrorCodes[this.code] + '] ' + this.message + (this.details ? this.details.toString() : '');
|
return '[' + ErrorCodes[this.code] + '] ' + this.message + this.detailsStr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,25 +32,33 @@ export class NotificationService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get Toastr(): ToastrService {
|
||||||
|
return this._toastr;
|
||||||
|
}
|
||||||
|
|
||||||
async getServerNotifications() {
|
async getServerNotifications() {
|
||||||
this.notifications = await this._networkService.getJson<NotificationDTO[]>('/notifications');
|
try {
|
||||||
this.notifications.forEach((noti) => {
|
this.notifications = (await this._networkService.getJson<NotificationDTO[]>('/notifications')) || [];
|
||||||
let msg = noti.message;
|
this.notifications.forEach((noti) => {
|
||||||
if (noti.details) {
|
let msg = noti.message;
|
||||||
msg += ' Details: ' + JSON.stringify(noti.details);
|
if (noti.details) {
|
||||||
}
|
msg += ' Details: ' + JSON.stringify(noti.details);
|
||||||
switch (noti.type) {
|
}
|
||||||
case NotificationType.error:
|
switch (noti.type) {
|
||||||
this.error(msg, this.i18n('Server error'));
|
case NotificationType.error:
|
||||||
break;
|
this.error(msg, this.i18n('Server error'));
|
||||||
case NotificationType.warning:
|
break;
|
||||||
this.warning(msg, this.i18n('Server error'));
|
case NotificationType.warning:
|
||||||
break;
|
this.warning(msg, this.i18n('Server error'));
|
||||||
case NotificationType.info:
|
break;
|
||||||
this.info(msg, this.i18n('Server info'));
|
case NotificationType.info:
|
||||||
break;
|
this.info(msg, this.i18n('Server info'));
|
||||||
}
|
break;
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
success(text: string, title: string = null): void {
|
success(text: string, title: string = null): void {
|
||||||
@ -68,9 +76,4 @@ export class NotificationService {
|
|||||||
info(text: string, title: string = null): void {
|
info(text: string, title: string = null): void {
|
||||||
this._toastr.info(text, title, this.options);
|
this._toastr.info(text, title, this.options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
get Toastr(): ToastrService {
|
|
||||||
return this._toastr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user