Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: address review: add error handling to writing style save

Adam Eivy871bee8af2f8
diff --git a/client/src/components/digital-twin/tabs/EnrichTab.jsx b/client/src/components/digital-twin/tabs/EnrichTab.jsx
index 7fec423bcf..66f8bccd30 100644
--- a/client/src/components/digital-twin/tabs/EnrichTab.jsx
+++ b/client/src/components/digital-twin/tabs/EnrichTab.jsx
@@ -114,22 +114,26 @@ export default function EnrichTab({ onRefresh }) {
}
setSavingWritingStyle(true);
- await api.createSoulDocument({
- filename: 'WRITING_STYLE.md',
- title: 'Writing Style',
- category: 'core',
- content: writingAnalysis.suggestedContent
- }).catch(async () => {
- // Document might exist, try to update by fetching ID
- const docs = await api.getDigitalTwinDocuments();
- const existing = docs.find(d => d.filename === 'WRITING_STYLE.md');
- if (existing) {
- return api.updateSoulDocument(existing.id, {
- content: writingAnalysis.suggestedContent
- });
- }
- });
- toast.success('Writing style saved');
+ try {
+ await api.createSoulDocument({
+ filename: 'WRITING_STYLE.md',
+ title: 'Writing Style',
+ category: 'core',
+ content: writingAnalysis.suggestedContent
+ }).catch(async () => {
+ // Document might exist, try to update by fetching ID
+ const docs = await api.getDigitalTwinDocuments();
+ const existing = docs.find(d => d.filename === 'WRITING_STYLE.md');
+ if (existing) {
+ return api.updateSoulDocument(existing.id, {
+ content: writingAnalysis.suggestedContent
+ });
+ }
+ });
+ toast.success('Writing style saved');
+ } catch (err) {
+ toast.error(`Failed to save writing style: ${err.message}`);
+ }
setSavingWritingStyle(false);
onRefresh();
};