- 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.
15 lines
523 B
TypeScript
15 lines
523 B
TypeScript
/**
|
|
* 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';
|
|
}
|