[code quality] fix async without wait, fix error typing

This commit is contained in:
everoddandeven 2024-10-18 16:29:44 +02:00
parent 33edf603dc
commit ed245953d1

View file

@ -229,14 +229,14 @@ export class DaemonService {
this.onDaemonStopEnd.emit(); this.onDaemonStopEnd.emit();
} }
private async openDatabase(): Promise<IDBPDatabase> { private async openDatabase(): Promise<IDBPDatabase<any>> {
return openDB(this.dbName, 1, { return await openDB<any>(this.dbName, 1, {
upgrade(db) { upgrade(db) {
// Crea un archivio (store) per i settings se non esiste già // Crea un archivio (store) per i settings se non esiste già
if (!db.objectStoreNames.contains('settingsStore')) { if (!db.objectStoreNames.contains('settingsStore')) {
db.createObjectStore('settingsStore', { db.createObjectStore('settingsStore', {
keyPath: 'id', keyPath: 'id',
autoIncrement: true, autoIncrement: true
}); });
} }
}, },
@ -257,7 +257,7 @@ export class DaemonService {
try { try {
await this.restartDaemon(); await this.restartDaemon();
} }
catch(error) { catch(error: any) {
console.error(error); console.error(error);
} }
} }
@ -324,7 +324,7 @@ export class DaemonService {
return response; return response;
} }
catch (error) { catch (error: any) {
if (error instanceof HttpErrorResponse) { if (error instanceof HttpErrorResponse) {
if (error.status == 0) { if (error.status == 0) {
const wasRunning = this.daemonRunning; const wasRunning = this.daemonRunning;
@ -405,7 +405,7 @@ export class DaemonService {
try { try {
await startPromise; await startPromise;
} }
catch(error) { catch(error: any) {
console.error(error); console.error(error);
} }
@ -426,7 +426,7 @@ export class DaemonService {
await this.startDaemon(); await this.startDaemon();
} }
} }
catch(error) { catch(error: any) {
console.error(error); console.error(error);
err = error; err = error;
} }
@ -442,7 +442,7 @@ export class DaemonService {
try { try {
await this.callRpc(new EmptyRpcRequest()); await this.callRpc(new EmptyRpcRequest());
} }
catch(error) { catch(error: any) {
if (error instanceof MethodNotFoundError) { if (error instanceof MethodNotFoundError) {
return true; return true;
} }