// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
import { Dialog, showDialog } from '@jupyterlab/apputils';
import { nullTranslator } from '@jupyterlab/translation';
import * as React from 'react';
/**
 * Show a dialog box reporting an error during installation of an extension.
 *
 * @param name The name of the extension
 * @param errorMessage Any error message giving details about the failure.
 */
export function reportInstallError(name, errorMessage, translator) {
    translator = translator || nullTranslator;
    const trans = translator.load('jupyterlab');
    const entries = [];
    entries.push(React.createElement("p", null, trans.__('An error occurred installing <code>%1</code>.', name)));
    if (errorMessage) {
        entries.push(React.createElement("p", null,
            React.createElement("span", { className: "jp-extensionmanager-dialog-subheader" }, trans.__('Error message:'))), React.createElement("pre", null, errorMessage.trim()));
    }
    const body = React.createElement("div", { className: "jp-extensionmanager-dialog" }, entries);
    void showDialog({
        title: trans.__('Extension Installation Error'),
        body,
        buttons: [Dialog.warnButton({ label: trans.__('OK') })]
    });
}
//# sourceMappingURL=dialog.js.map