mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-23 02:36:05 +00:00
Merge branch 'master' into feat/operation-logs
* master: (37 commits) 16.8.0 feat(i18n): add new translations fix: address code review issues from today's changes fix: address code review issues from today's changes fix(data-repair): change quickSetting to CUSTOM when startDate is missing fix(test): fix fetch spy setup in audio tests fix(android): sync time tracking from notification correctly on resume fix(database): prevent repeated error dialogs when disk is full fix(reminder): prevent dismissed reminders from reappearing fix(task-repeat): prevent race condition when saving repeat config fix(android): add error handling for native service calls fix(reminder): cancel native Android reminders immediately on task deletion fix(error-handler): use getErrorTxt to prevent [object Object] in error titles fix(planner): use task startDate for weekly repeat weekday calculation fix(focus-mode): use independent 1s timer for Pomodoro countdown feat(focus-mode): add Skip Break button to banner during active breaks feat(notes): add auto-save to fullscreen markdown editor fix(reflection-note): prevent trailing spaces from being deleted while typing fix(sync): add error handling for JSON parse failures in sync data fix(error-handling): prevent [object Object] from appearing in error messages ... # Conflicts: # src/app/core/persistence/database.service.ts # src/app/features/android/store/android-focus-mode.effects.ts # src/app/features/android/store/android-foreground-tracking.effects.ts # src/app/features/reminder/reminder.service.spec.ts # src/app/features/reminder/reminder.service.ts # src/app/features/tasks/dialog-view-task-reminders/dialog-view-task-reminders.component.ts # src/app/features/tasks/store/task-reminder.effects.spec.ts # src/app/features/tasks/store/task-reminder.effects.ts # src/app/features/work-context/store/work-context.effects.spec.ts # src/app/features/work-context/store/work-context.effects.ts # src/app/t.const.ts # src/assets/i18n/en.json
This commit is contained in:
commit
e6ea0d74f0
105 changed files with 7302 additions and 734 deletions
|
|
@ -56,20 +56,48 @@ function _handleError(
|
|||
}
|
||||
}
|
||||
|
||||
const OBJECT_OBJECT_STR = '[object Object]';
|
||||
|
||||
// eslint-disable-next-line prefer-arrow/prefer-arrow-functions
|
||||
function _getErrorStr(e: unknown): string {
|
||||
if (typeof e === 'string') {
|
||||
return e;
|
||||
}
|
||||
|
||||
if (e == null) {
|
||||
return 'Unknown error';
|
||||
}
|
||||
|
||||
// Check for message property first (standard Error and custom errors)
|
||||
if (typeof (e as any).message === 'string' && (e as any).message) {
|
||||
return (e as any).message;
|
||||
}
|
||||
|
||||
if (e instanceof Error) {
|
||||
return e.toString();
|
||||
}
|
||||
if (typeof e === 'object' && e !== null) {
|
||||
|
||||
// Check for name property
|
||||
if (typeof (e as any).name === 'string' && (e as any).name) {
|
||||
return (e as any).name;
|
||||
}
|
||||
|
||||
if (typeof e === 'object') {
|
||||
try {
|
||||
return JSON.stringify(e);
|
||||
} catch (err) {
|
||||
return String(e);
|
||||
const jsonStr = JSON.stringify(e);
|
||||
if (jsonStr && jsonStr !== '{}') {
|
||||
return jsonStr;
|
||||
}
|
||||
} catch {
|
||||
// Circular reference - fall through
|
||||
}
|
||||
|
||||
// Try toString but check for [object Object]
|
||||
const str = String(e);
|
||||
if (str && str !== OBJECT_OBJECT_STR) {
|
||||
return str;
|
||||
}
|
||||
}
|
||||
return String(e);
|
||||
|
||||
return 'Unknown error (unable to extract message)';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue