Move error event struct
This commit is contained in:
parent
1bded3121e
commit
79af725f7f
|
@ -12,7 +12,7 @@ import Globals from './globals';
|
|||
import { FileUtils, ClientLogger as Logger } from 'common';
|
||||
import path from 'path';
|
||||
import { Events } from 'modules';
|
||||
import { Error } from 'structs';
|
||||
import { ErrorEvent } from 'structs';
|
||||
import { Modals } from 'ui';
|
||||
|
||||
export default class {
|
||||
|
@ -38,7 +38,7 @@ export default class {
|
|||
try {
|
||||
await this.preloadContent(dir);
|
||||
} catch (err) {
|
||||
this.errors.push(new Error({
|
||||
this.errors.push(new ErrorEvent({
|
||||
module: this.moduleName,
|
||||
message: `Failed to load ${dir}`,
|
||||
err
|
||||
|
|
|
@ -8,10 +8,12 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
export class Error {
|
||||
import Event from './event';
|
||||
|
||||
export default class ErrorEvent extends Event {
|
||||
|
||||
constructor(args) {
|
||||
this.args = args;
|
||||
super(args);
|
||||
this.showStack = false; // For error modal
|
||||
}
|
||||
|
||||
|
@ -31,8 +33,8 @@ export class Error {
|
|||
return this.err.stack;
|
||||
}
|
||||
|
||||
get _type() {
|
||||
return 'err';
|
||||
get __eventType() {
|
||||
return 'error';
|
||||
}
|
||||
|
||||
}
|
|
@ -11,8 +11,6 @@
|
|||
export default class Event {
|
||||
|
||||
constructor(args) {
|
||||
this.args = args;
|
||||
|
||||
this.__eventInfo = {
|
||||
args: arguments,
|
||||
type: this.__eventType
|
||||
|
@ -23,6 +21,10 @@ export default class Event {
|
|||
return this.__eventInfo;
|
||||
}
|
||||
|
||||
get args() {
|
||||
return this.event.args[0];
|
||||
}
|
||||
|
||||
get __eventType() { return null; }
|
||||
|
||||
}
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
export { default as SettingUpdatedEvent } from './settingupdated';
|
||||
export { default as ErrorEvent } from './error';
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
export * from './error';
|
||||
export * from './events/index';
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<MiError v-if="modal.event.type === 'err'" slot="icon" size="20"/>
|
||||
<div slot="body">
|
||||
<div v-for="(content, index) in modal.event.content">
|
||||
<div v-if="content._type === 'err'" class="bd-modal-error" :class="{'bd-open': content.showStack}">
|
||||
<div class="bd-modal-error" :class="{'bd-open': content.showStack}">
|
||||
<div class="bd-modal-error-title bd-flex">
|
||||
<span class="bd-modal-title-text bd-flex-grow">{{content.message}}</span>
|
||||
<span class="bd-modal-titlelink" v-if="content.showStack" @click="() => { content.showStack = false; $forceUpdate(); }">Hide Stacktrace</span>
|
||||
|
|
Loading…
Reference in New Issue