Skip to content

Errors

An action exception stops the action and its Flight unless the Bird’s error handling says otherwise. Choose an exception that helps the user understand who can fix the problem.

Category SDK exception Use it when
Configuration error PluginMisconfigurationException The user can correct inputs, credentials, permissions, or a provider setting
App not responding PluginApplicationException The provider is unavailable or rejects work for a temporary service reason
Unexpected App issue Other unhandled exceptions The App implementation needs investigation

Platform errors outside App invocation are separate from these categories.

This helper compiles with the Setup project. Call it from your provider client after receiving a response. It uses no external helper types.

using System.Net;
using Blackbird.Applications.Sdk.Common.Exceptions;
namespace Apps.ErrorExample;
public static class ContentErrors
{
public static void ValidateArticleId(string articleId)
{
if (string.IsNullOrWhiteSpace(articleId))
throw new PluginMisconfigurationException("Select an article before downloading content.");
}
public static void EnsureSuccess(HttpResponseMessage response)
{
if (response.IsSuccessStatusCode) return;
if (response.StatusCode is HttpStatusCode.Unauthorized or HttpStatusCode.Forbidden)
throw new PluginMisconfigurationException("Reconnect the CMS with permission to read this article.");
if (response.StatusCode == HttpStatusCode.NotFound)
throw new PluginMisconfigurationException("The article was not found. Select an existing article.");
if ((int)response.StatusCode >= 500 || (int)response.StatusCode == 429)
throw new PluginApplicationException("The CMS is temporarily unavailable. Try again later.");
throw new PluginMisconfigurationException(
$"The CMS rejected the request ({(int)response.StatusCode}). Check the selected article and inputs.");
}
}

In a production client, handle a provider’s rate-limit retry guidance before raising the final service error. Parse its documented validation errors into useful messages, while keeping tokens and sensitive content private.

Tell the user what to change: Choose a target language or Reconnect the CMS with read access is more useful than a raw exception. Keep unexpected exceptions visible to developers rather than converting every programming error into a configuration problem.

Validate optional values, empty collections, and response parsing. Test rejected credentials, missing content, a provider outage, and a malformed response. A timeout after a create or upload can happen after the provider accepted the write; verify the destination before repeating it. See Bird retry policies.