A developer can trigger an error in JavaScript that is displayed in a way consistent to the site's theme
Drupal needs a built-in way (from core or contrib) to output JavaScript-created messages in ways consistent with the current theme of a site.
User story
As a developer,
when I trigger an error in JavaScript (and there is no page load so no chance to use drupal_set_message()
)
I want to use a message-theming API so that the error message looks like any other error message generated on the site.
Background
In working on the Give module, i had to fall back to throwing error-related classes at the JS-generated HTML used to display the message so the odds are it will be styled like an error in any system.
Proposed solution
Find or build such a service, allowing light-weight calls from JavaScript to build just this piece of the page render output.
Remaining work
Research: Scour the web for solutions or discussion related to this in Drupal!