-
-
Notifications
You must be signed in to change notification settings - Fork 3
Closed as not planned
Description
Hi, for anyone interested, here a minimal port to Windows:
// index.js
import koffi from 'koffi';
const lib = koffi.load('user32.dll');
const MessageBoxW = lib.func('__stdcall', 'MessageBoxW', 'int', ['void *', 'str16', 'str16', 'uint']);
const MB_OK = 0x0;
const MB_ICONERROR = 0x10;
export default function errorDialog(error, title) {
error = error.stack || error;
title = title || '';
MessageBoxW(null, error, title, MB_OK | MB_ICONERROR);
}
Usage:
// demo.mjs
import errorDialog from 'error-dialog';
const error = new Error('Expected more unicorns!');
errorDialog(error, '🦄');
Metadata
Metadata
Assignees
Labels
No labels
