1
0

More consise error messages

This commit is contained in:
Zef Hemel 2023-07-28 13:54:44 +02:00
parent f24fbbb472
commit 747e81e5da
2 changed files with 8 additions and 5 deletions

View File

@ -24,12 +24,12 @@ export class FallbackSpacePrimitives implements SpacePrimitives {
} catch (e) {
console.info(
`Could not read file ${name} from primary, trying fallback`,
e,
e.message,
);
try {
return await this.fallback.readFile(name);
} catch (fallbackError: any) {
console.error("Error during readFile fallback", fallbackError);
console.error("Error during readFile fallback", fallbackError.message);
// Fallback failed, so let's throw the original error
throw e;
}
@ -41,12 +41,15 @@ export class FallbackSpacePrimitives implements SpacePrimitives {
} catch (e) {
console.info(
`Could not fetch file ${name} metadata from primary, trying fallback`,
e,
e.message,
);
try {
return await this.fallback.getFileMeta(name);
} catch (fallbackError) {
console.error("Error during getFileMeta fallback", fallbackError);
console.error(
"Error during getFileMeta fallback",
fallbackError.message,
);
// Fallback failed, so let's throw the original error
throw e;
}

View File

@ -161,7 +161,7 @@ export class SyncService {
this.eventHook.dispatchEvent("sync:success", operations);
} catch (e: any) {
this.eventHook.dispatchEvent("sync:error", e.message);
console.error("Sync error", e);
console.error("Sync error", e.message);
}
await this.saveSnapshot(snapshot);
await this.registerSyncStop();