Put in console.errors on extension initialization.
This commit is contained in:
parent
338b219142
commit
0edd82479e
@ -48,11 +48,16 @@ export default class UWContent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
reloadSettings() {
|
reloadSettings() {
|
||||||
|
try {
|
||||||
this.logger.log('info', 'debug', 'Things happened in the popup. Will reload extension settings.');
|
this.logger.log('info', 'debug', 'Things happened in the popup. Will reload extension settings.');
|
||||||
this.init();
|
this.init();
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('Ultrawidify: settings reload failed. This probably shouldn\'t outright kill the extension, but page reload is recommended.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async init(){
|
async init(){
|
||||||
|
try {
|
||||||
if (Debug.debug) {
|
if (Debug.debug) {
|
||||||
console.log("[uw::main] loading configuration ...");
|
console.log("[uw::main] loading configuration ...");
|
||||||
}
|
}
|
||||||
@ -128,7 +133,11 @@ export default class UWContent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
console.error('Ultrawidify: failed to start extension. Error:', e)
|
||||||
this.logger.log('error', 'debug', "[uw::init] FAILED TO START EXTENSION. Error:", e);
|
this.logger.log('error', 'debug', "[uw::init] FAILED TO START EXTENSION. Error:", e);
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Ultrawidify initalization failed for some reason:', e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,8 +33,8 @@ export default class UWServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async setup() {
|
async setup() {
|
||||||
|
try {
|
||||||
// logger is the first thing that goes up
|
// logger is the first thing that goes up
|
||||||
|
|
||||||
const loggingOptions = {
|
const loggingOptions = {
|
||||||
isBackgroundScript: true,
|
isBackgroundScript: true,
|
||||||
allowLogging: false,
|
allowLogging: false,
|
||||||
@ -59,6 +59,9 @@ export default class UWServer {
|
|||||||
this.comms.subscribe('emit-logs', () => {}); // we don't need to do anything, this gets forwarded to UI content script as is
|
this.comms.subscribe('emit-logs', () => {}); // we don't need to do anything, this gets forwarded to UI content script as is
|
||||||
|
|
||||||
browser.tabs.onActivated.addListener((m) => {this.onTabSwitched(m)});
|
browser.tabs.onActivated.addListener((m) => {this.onTabSwitched(m)});
|
||||||
|
} catch (e) {
|
||||||
|
console.error(`Ultrawidify [server]: failed to start. Reason:`, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async _promisifyTabsGet(browserObj, tabId){
|
async _promisifyTabsGet(browserObj, tabId){
|
||||||
@ -215,11 +218,13 @@ export default class UWServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
console.warn('Ultrawidify [server]: UI setup failed. While problematic, this problem shouldn\'t completely crash the extension.');
|
||||||
this.logger.log('ERROR', 'uwbg', 'UI initialization failed. Reason:', e);
|
this.logger.log('ERROR', 'uwbg', 'UI initialization failed. Reason:', e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async initUiAndShowLogger() {
|
async initUiAndShowLogger() {
|
||||||
|
try {
|
||||||
// this implementation is less than optimal and very hacky, but it should work
|
// this implementation is less than optimal and very hacky, but it should work
|
||||||
// just fine for our use case.
|
// just fine for our use case.
|
||||||
this.uiLoggerInitialized = false;
|
this.uiLoggerInitialized = false;
|
||||||
@ -245,7 +250,10 @@ export default class UWServer {
|
|||||||
}
|
}
|
||||||
await sleep(100);
|
await sleep(100);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
} catch (e) {
|
||||||
|
console.warn('Ultrawidify [server]: failed to set up logger UI. While problematic, this problem shouldn\'t completely crash the extension.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getCurrentTab() {
|
async getCurrentTab() {
|
||||||
|
Loading…
Reference in New Issue
Block a user