Update database schema and synchronization logic
- Add `useEffect` in `ScribeLeftBar` for handling book state changes. - Extend `BooksSyncContext` with new properties and stricter typings. - Refine `Repositories` to include `lastUpdate` handling for synchronization processes. - Add comprehensive `fetchComplete*` repository methods for retrieving entity-specific sync data. - Enhance offline logic for chapters, characters, locations, and world synchronization. - Improve error handling across IPC handlers and repositories.
This commit is contained in:
14
lib/errors.ts
Normal file
14
lib/errors.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Clean error messages from Electron IPC prefix
|
||||
* Transforms: "Error invoking remote method 'channel': Error: Message"
|
||||
* Into: "Message"
|
||||
*/
|
||||
export function cleanErrorMessage(error: unknown): string {
|
||||
if (error instanceof Error) {
|
||||
return error.message.replace(/^Error invoking remote method '[^']+': Error: /, '');
|
||||
}
|
||||
if (typeof error === 'string') {
|
||||
return error.replace(/^Error invoking remote method '[^']+': Error: /, '');
|
||||
}
|
||||
return 'An unknown error occurred';
|
||||
}
|
||||
Reference in New Issue
Block a user