Skip to content

Commit 2ee4e3e

Browse files
committed
Add an error reporting path
Assisted-By: Claude Opus 4.7
1 parent 2743967 commit 2ee4e3e

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

src/ui/six-sines-editor.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,6 +1348,11 @@ void SixSinesEditor::initializeBaseSkin()
13481348

13491349
if (auto manrope = typefaceFromResources("Manrope/static/Manrope-Regular.ttf"))
13501350
style()->replaceFontsWithTypeface(manrope);
1351+
else
1352+
reportError("Font Load Failed",
1353+
"Unable to load Manrope-Regular from the embedded font resources. "
1354+
"Six Sines will fall back to the system default font, which has "
1355+
"different metrics and may render at the wrong size.");
13511356
style()->adjustFontHeight(2.0f);
13521357
style()->setFontExtraKerningFactor(0.03f);
13531358

@@ -1381,6 +1386,19 @@ juce::Typeface::Ptr SixSinesEditor::typefaceFromResources(const std::string &rel
13811386
}
13821387
}
13831388

1389+
void SixSinesEditor::reportError(const std::string &title, const std::string &msg)
1390+
{
1391+
SXSNLOG("[ERROR] " << title << ": " << msg);
1392+
juce::MessageManager::callAsync(
1393+
[w = juce::Component::SafePointer(this), title, msg]()
1394+
{
1395+
if (!w)
1396+
return;
1397+
auto prompt = sst::jucegui::screens::AlertOrPrompt::Alert(title, msg);
1398+
w->displayModalOverlay(std::move(prompt));
1399+
});
1400+
}
1401+
13841402
void SixSinesEditor::setZoomFactor(float zf)
13851403
{
13861404
// SCLOG("Setting zoom factor to " << zf);

src/ui/six-sines-editor.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,11 @@ struct SixSinesEditor : jcmp::WindowPanel, sst::jucegui::screens::ScreenHolder<S
169169
// typeface ownership outlived the JUCE shutdown sequence.
170170
juce::Typeface::Ptr typefaceFromResources(const std::string &relPath);
171171

172+
// Show a modal alert overlay with the given title and message. Display is
173+
// deferred via the message manager so it is safe to call during editor
174+
// construction (when bounds aren't yet set).
175+
void reportError(const std::string &title, const std::string &msg);
176+
172177
private:
173178
std::unordered_map<std::string, juce::Typeface::Ptr> typefaceCache;
174179

0 commit comments

Comments
 (0)