Skip to content

Commit

Permalink
Update GitShortCode with better error message
Browse files Browse the repository at this point in the history
  • Loading branch information
StevenTCramer committed Dec 13, 2024
1 parent 23669cb commit 4748046
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
7 changes: 6 additions & 1 deletion Source/TheFreezeTeam.com/Shortcodes/GitShortCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,12 @@ public async Task<string> GetContent(string owner, string repo, string pathFileN
}
else
{
return "#Oops, a parameter is invalid.";
string errorMessage =
$"#Error: GitHub API request failed with status {(int)response.StatusCode} ({response.StatusCode}). " +
$"Parameters provided: Owner='{owner}', Repo='{repo}', PathFileName='{pathFileName}'" +
(string.IsNullOrEmpty(regionName) ? "" : $", RegionName='{regionName}'");

return errorMessage;
}
}
}
Expand Down
8 changes: 6 additions & 2 deletions Source/TimeWarp.Statiq/Shortcodes/GitShortCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,15 @@ public async Task<string> GetContent(string owner, string repo, string pathFileN
{
return textContent;
}

}
else
{
return "#Oops, a parameter is invalid.";
string errorMessage =
$"#Error: GitHub API request failed with status {(int)response.StatusCode} ({response.StatusCode}). " +
$"Parameters provided: Owner='{owner}', Repo='{repo}', PathFileName='{pathFileName}'" +
(string.IsNullOrEmpty(regionName) ? "" : $", RegionName='{regionName}'");

return errorMessage;
}
}
}
Expand Down

0 comments on commit 4748046

Please sign in to comment.