Skip to content

Commit

Permalink
Change warning message for empty api response
Browse files Browse the repository at this point in the history
  • Loading branch information
SoftwareArchitector committed Jan 23, 2025
1 parent 5d6f4cb commit 89ae060
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions frontend/data/locale/en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1572,6 +1572,7 @@ Restream.Actions.BroadcastLoadingTitle="Loading broadcast information..."
Restream.Actions.BroadcastLoadingText="Loading broadcast information for %1, please wait..."
Restream.Actions.BroadcastLoadingFailureTitle="Failed to load broadcast information"
Restream.Actions.BroadcastLoadingFailureText="Failed to load broadcast information for %1\n\n%2: %3"
Restream.Actions.BroadcastLoadingEmptyText="Failed to access Restream setup.\nPlease select a broadcast to enable streaming."

# MultitrackVideo
ConfigDownload.WarningMessageTitle="Warning"
Expand Down
12 changes: 5 additions & 7 deletions frontend/oauth/RestreamAuth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,11 @@ try {
throw ErrorInfo(error, json["error_description"].string_value());

auto items = json.array_items();
if (!items.size())
throw ErrorInfo("Failed to get upcoming events info from remote", "Event list is empty");
if (!items.size()) {
OBSMessageBox::warning(OBSBasic::Get(), QTStr("Restream.Actions.BroadcastLoadingFailureTitle"),
QTStr("Restream.Actions.BroadcastLoadingEmptyText"));
return QVector<RestreamEventDescription>();
}

for (auto item : items) {
RestreamEventDescription event;
Expand All @@ -110,11 +113,8 @@ try {
QString title = QTStr("Restream.Actions.BroadcastLoadingFailureTitle");
QString text = QTStr("Restream.Actions.BroadcastLoadingFailureText")
.arg(service(), info.message.c_str(), info.error.c_str());

QMessageBox::warning(OBSBasic::Get(), title, text);

blog(LOG_WARNING, "%s: %s: %s", __FUNCTION__, info.message.c_str(), info.error.c_str());

return QVector<RestreamEventDescription>();
}

Expand Down Expand Up @@ -169,9 +169,7 @@ try {
QString title = QTStr("Restream.Actions.BroadcastLoadingFailureTitle");
QString text = QTStr("Restream.Actions.BroadcastLoadingFailureText")
.arg(service(), info.message.c_str(), info.error.c_str());

QMessageBox::warning(OBSBasic::Get(), title, text);

blog(LOG_WARNING, "%s: %s: %s", __FUNCTION__, info.message.c_str(), info.error.c_str());
return "";
}
Expand Down

0 comments on commit 89ae060

Please sign in to comment.