Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions src/notifications.ts → src/notifications.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Dialog, Notification, showErrorMessage } from '@jupyterlab/apputils';
import { TranslationBundle } from '@jupyterlab/translation';
import * as React from 'react';

/**
* Build notification options to display in a dialog the detailed error.
Expand All @@ -18,9 +19,20 @@ export function showError(
{
label: trans.__('Show'),
callback: () => {
showErrorMessage(trans.__('Error'), error, [
Dialog.warnButton({ label: trans.__('Dismiss') })
]);
showErrorMessage(
trans.__('Error'),
{
// Render error in a <pre> element to preserve line breaks and
// use a monospace font so e.g. pre-commit errors are readable.
// Ref: https://github.com/jupyterlab/jupyterlab-git/issues/1407
message: (
<pre style={{ whiteSpace: 'pre-wrap', fontSize: '7pt' }}>
{error.message || error.stack || String(error)}
</pre>
)
},
[Dialog.warnButton({ label: trans.__('Dismiss') })]
);
},
displayType: 'warn'
} as Notification.IAction
Expand Down
Loading