forked from olcxjas-softworks/LarpixClient
Update gitignore (sorry)
This commit is contained in:
parent
a8f8c4d7ad
commit
cca8b02fea
6604 changed files with 1219661 additions and 4 deletions
78
electron/node_modules/electron-unhandled/index.d.ts
generated
vendored
Normal file
78
electron/node_modules/electron-unhandled/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
declare namespace unhandled {
|
||||
/**
|
||||
__Note:__ Options can only be specified in the `main` process.
|
||||
*/
|
||||
interface UnhandledOptions {
|
||||
/**
|
||||
Custom logger that receives the error.
|
||||
|
||||
Can be useful if you for example integrate with Sentry.
|
||||
|
||||
@default console.error
|
||||
*/
|
||||
readonly logger?: (error: Error) => void;
|
||||
|
||||
/**
|
||||
Present an error dialog to the user.
|
||||
|
||||
Default: [Only in production](https://github.com/sindresorhus/electron-is-dev).
|
||||
*/
|
||||
readonly showDialog?: boolean;
|
||||
|
||||
/**
|
||||
When specified, the error dialog will include a `Report…` button, which when clicked, executes the given function with the error as the first argument.
|
||||
|
||||
@default undefined
|
||||
|
||||
@example
|
||||
```
|
||||
import unhandled = require('electron-unhandled');
|
||||
import {openNewGitHubIssue, debugInfo} = require('electron-util');
|
||||
|
||||
unhandled({
|
||||
reportButton: error => {
|
||||
openNewGitHubIssue({
|
||||
user: 'sindresorhus',
|
||||
repo: 'electron-unhandled',
|
||||
body: `\`\`\`\n${error.stack}\n\`\`\`\n\n---\n\n${debugInfo()}`
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Example of how the GitHub issue will look like: https://github.com/sindresorhus/electron-unhandled/issues/new?body=%60%60%60%0AError%3A+Test%0A++++at+%2FUsers%2Fsindresorhus%2Fdev%2Foss%2Felectron-unhandled%2Fexample.js%3A27%3A21%0A%60%60%60%0A%0A---%0A%0AExample+1.1.0%0AElectron+3.0.8%0Adarwin+18.2.0%0ALocale%3A+en-US
|
||||
```
|
||||
*/
|
||||
readonly reportButton?: (error: Error) => void;
|
||||
}
|
||||
|
||||
interface LogErrorOptions {
|
||||
/**
|
||||
The title of the error dialog.
|
||||
|
||||
@default `${appName} encountered an error`
|
||||
*/
|
||||
readonly title?: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare const unhandled: {
|
||||
/**
|
||||
Catch unhandled errors and promise rejections in your [Electron](https://electronjs.org) app.
|
||||
|
||||
You probably want to call this both in the `main` process and any `renderer` processes to catch all possible errors.
|
||||
|
||||
__Note:__ At minimum, this function must be called in the `main` process.
|
||||
*/
|
||||
(options?: unhandled.UnhandledOptions): void;
|
||||
|
||||
/**
|
||||
Log an error. This does the same as with caught unhandled errors.
|
||||
|
||||
It will use the same options specified in the `unhandled()` call or the defaults.
|
||||
|
||||
@param error - Error to log.
|
||||
*/
|
||||
logError(error: Error, options?: unhandled.LogErrorOptions): void;
|
||||
};
|
||||
|
||||
export = unhandled;
|
||||
145
electron/node_modules/electron-unhandled/index.js
generated
vendored
Normal file
145
electron/node_modules/electron-unhandled/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
'use strict';
|
||||
const {app, dialog, clipboard} = require('electron');
|
||||
const cleanStack = require('clean-stack');
|
||||
const ensureError = require('ensure-error');
|
||||
const debounce = require('lodash.debounce');
|
||||
const {serializeError} = require('serialize-error');
|
||||
|
||||
let appName;
|
||||
|
||||
let invokeErrorHandler;
|
||||
|
||||
const ERROR_HANDLER_CHANNEL = 'electron-unhandled.ERROR';
|
||||
|
||||
if (process.type === 'renderer') {
|
||||
const {ipcRenderer} = require('electron');
|
||||
// Default to 'App' because I don't think we can populate `appName` reliably here without remote or adding more IPC logic
|
||||
invokeErrorHandler = async (title = 'App encountered an error', error) => {
|
||||
try {
|
||||
await ipcRenderer.invoke(ERROR_HANDLER_CHANNEL, title, error);
|
||||
return;
|
||||
} catch (invokeError) { // eslint-disable-line unicorn/catch-error-name
|
||||
if (invokeError.message === 'An object could not be cloned.') {
|
||||
// 1. If serialization failed, force the passed arg to an error format
|
||||
error = ensureError(error);
|
||||
|
||||
// 2. Then attempt serialization on each property, defaulting to undefined otherwise
|
||||
const serialized = serializeError(error);
|
||||
// 3. Invoke the error handler again with only the serialized error properties
|
||||
ipcRenderer.invoke(ERROR_HANDLER_CHANNEL, title, serialized);
|
||||
}
|
||||
}
|
||||
};
|
||||
} else {
|
||||
appName = 'name' in app ? app.name : app.getName();
|
||||
const {ipcMain} = require('electron');
|
||||
ipcMain.handle(ERROR_HANDLER_CHANNEL, async (evt, title, error) => {
|
||||
handleError(title, error);
|
||||
});
|
||||
}
|
||||
|
||||
let installed = false;
|
||||
|
||||
let options = {
|
||||
logger: console.error,
|
||||
showDialog: process.type !== 'renderer' && !require('electron-is-dev')
|
||||
};
|
||||
|
||||
// NOTE: The ES6 default for title will only be used if the error is invoked from the main process directly. When invoked via the renderer, it will use the ES6 default from invokeErrorHandler
|
||||
const handleError = (title = `${appName} encountered an error`, error) => {
|
||||
error = ensureError(error);
|
||||
|
||||
try {
|
||||
options.logger(error);
|
||||
} catch (loggerError) { // eslint-disable-line unicorn/catch-error-name
|
||||
dialog.showErrorBox('The `logger` option function in electron-unhandled threw an error', ensureError(loggerError).stack);
|
||||
return;
|
||||
}
|
||||
|
||||
if (options.showDialog) {
|
||||
const stack = cleanStack(error.stack);
|
||||
|
||||
if (app.isReady()) {
|
||||
const buttons = [
|
||||
'OK',
|
||||
process.platform === 'darwin' ? 'Copy Error' : 'Copy error'
|
||||
];
|
||||
|
||||
if (options.reportButton) {
|
||||
buttons.push('Report…');
|
||||
}
|
||||
|
||||
// Intentionally not using the `title` option as it's not shown on macOS
|
||||
const buttonIndex = dialog.showMessageBoxSync({
|
||||
type: 'error',
|
||||
buttons,
|
||||
defaultId: 0,
|
||||
noLink: true,
|
||||
message: title,
|
||||
detail: cleanStack(error.stack, {pretty: true})
|
||||
});
|
||||
|
||||
if (buttonIndex === 1) {
|
||||
clipboard.writeText(`${title}\n${stack}`);
|
||||
}
|
||||
|
||||
if (buttonIndex === 2) {
|
||||
options.reportButton(error);
|
||||
}
|
||||
} else {
|
||||
dialog.showErrorBox(title, stack);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = inputOptions => {
|
||||
if (installed) {
|
||||
return;
|
||||
}
|
||||
|
||||
installed = true;
|
||||
|
||||
options = {
|
||||
...options,
|
||||
...inputOptions
|
||||
};
|
||||
|
||||
if (process.type === 'renderer') {
|
||||
// Debounced because some packages, for example React, because of their error boundry feature, throws many identical uncaught errors
|
||||
const errorHandler = debounce(error => {
|
||||
invokeErrorHandler('Unhandled Error', error);
|
||||
}, 200);
|
||||
window.addEventListener('error', event => {
|
||||
event.preventDefault();
|
||||
errorHandler(event.error || event);
|
||||
});
|
||||
|
||||
const rejectionHandler = debounce(reason => {
|
||||
invokeErrorHandler('Unhandled Promise Rejection', reason);
|
||||
}, 200);
|
||||
window.addEventListener('unhandledrejection', event => {
|
||||
event.preventDefault();
|
||||
rejectionHandler(event.reason);
|
||||
});
|
||||
} else {
|
||||
process.on('uncaughtException', error => {
|
||||
handleError('Unhandled Error', error);
|
||||
});
|
||||
|
||||
process.on('unhandledRejection', error => {
|
||||
handleError('Unhandled Promise Rejection', error);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.logError = (error, options) => {
|
||||
options = {
|
||||
...options
|
||||
};
|
||||
|
||||
if (typeof invokeErrorHandler === 'function') {
|
||||
invokeErrorHandler(options.title, error);
|
||||
} else {
|
||||
handleError(options.title, error);
|
||||
}
|
||||
};
|
||||
9
electron/node_modules/electron-unhandled/license
generated
vendored
Normal file
9
electron/node_modules/electron-unhandled/license
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
59
electron/node_modules/electron-unhandled/package.json
generated
vendored
Normal file
59
electron/node_modules/electron-unhandled/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
{
|
||||
"name": "electron-unhandled",
|
||||
"version": "4.0.1",
|
||||
"description": "Catch unhandled errors and promise rejections in your Electron app",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/electron-unhandled",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "electron example.js",
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"electron",
|
||||
"unhandled",
|
||||
"error",
|
||||
"exception",
|
||||
"promise",
|
||||
"rejection",
|
||||
"uncaught",
|
||||
"handler",
|
||||
"stack",
|
||||
"report",
|
||||
"log",
|
||||
"logger",
|
||||
"debug",
|
||||
"debugging"
|
||||
],
|
||||
"dependencies": {
|
||||
"clean-stack": "^2.1.0",
|
||||
"electron-is-dev": "^2.0.0",
|
||||
"ensure-error": "^2.0.0",
|
||||
"lodash.debounce": "^4.0.8",
|
||||
"serialize-error": "^8.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^2.2.0",
|
||||
"electron": "^7.0.0",
|
||||
"electron-util": "^0.12.1",
|
||||
"execa": "^2.0.3",
|
||||
"tsd": "^0.7.3",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"xo": {
|
||||
"nodeVersion": ">=12",
|
||||
"envs": [
|
||||
"node",
|
||||
"browser"
|
||||
]
|
||||
}
|
||||
}
|
||||
107
electron/node_modules/electron-unhandled/readme.md
generated
vendored
Normal file
107
electron/node_modules/electron-unhandled/readme.md
generated
vendored
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
# electron-unhandled
|
||||
|
||||
> Catch unhandled errors and promise rejections in your [Electron](https://electronjs.org) app
|
||||
|
||||
You can use this module directly in both the main and renderer process.
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
npm install electron-unhandled
|
||||
```
|
||||
|
||||
*Requires Electron 14 or later.*
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const unhandled = require('electron-unhandled');
|
||||
|
||||
unhandled();
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### unhandled(options?)
|
||||
|
||||
You probably want to call this both in the `main` process and any `renderer` processes to catch all possible errors.
|
||||
|
||||
**Note:** At minimum, this function must be called in the `main` process.
|
||||
|
||||
### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
Note: Options can only be specified in the `main` process.
|
||||
|
||||
#### logger
|
||||
|
||||
Type: `Function`\
|
||||
Default: `console.error`
|
||||
|
||||
Custom logger that receives the error.
|
||||
|
||||
Can be useful if you for example integrate with Sentry.
|
||||
|
||||
#### showDialog
|
||||
|
||||
Type: `boolean`\
|
||||
Default: [Only in production](https://github.com/sindresorhus/electron-is-dev)
|
||||
|
||||
Present an error dialog to the user.
|
||||
|
||||
<img src="screenshot.png" width="532">
|
||||
|
||||
#### reportButton
|
||||
|
||||
Type: `Function`\
|
||||
Default: `undefined`
|
||||
|
||||
When specified, the error dialog will include a `Report…` button, which when clicked, executes the given function with the error as the first argument.
|
||||
|
||||
```js
|
||||
const unhandled = require('electron-unhandled');
|
||||
const {openNewGitHubIssue, debugInfo} = require('electron-util');
|
||||
|
||||
unhandled({
|
||||
reportButton: error => {
|
||||
openNewGitHubIssue({
|
||||
user: 'sindresorhus',
|
||||
repo: 'electron-unhandled',
|
||||
body: `\`\`\`\n${error.stack}\n\`\`\`\n\n---\n\n${debugInfo()}`
|
||||
});
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
[Example of how the GitHub issue will look like.](https://github.com/sindresorhus/electron-unhandled/issues/new?body=%60%60%60%0AError%3A+Test%0A++++at+%2FUsers%2Fsindresorhus%2Fdev%2Foss%2Felectron-unhandled%2Fexample.js%3A27%3A21%0A%60%60%60%0A%0A---%0A%0AExample+1.1.0%0AElectron+3.0.8%0Adarwin+18.2.0%0ALocale%3A+en-US)
|
||||
|
||||
### unhandled.logError(error, [options])
|
||||
|
||||
Log an error. This does the same as with caught unhandled errors.
|
||||
|
||||
It will use the same options specified in the `unhandled()` call or the defaults.
|
||||
|
||||
#### error
|
||||
|
||||
Type: `Error`
|
||||
|
||||
Error to log.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### title
|
||||
|
||||
Type: `string`\
|
||||
Default: `${appName} encountered an error`
|
||||
|
||||
The title of the error dialog.
|
||||
|
||||
## Related
|
||||
|
||||
- [electron-store](https://github.com/sindresorhus/electron-store) - Save and load data like user preferences, app state, cache, etc
|
||||
- [electron-debug](https://github.com/sindresorhus/electron-debug) - Adds useful debug features to your Electron app
|
||||
- [electron-context-menu](https://github.com/sindresorhus/electron-context-menu) - Context menu for your Electron app
|
||||
- [electron-dl](https://github.com/sindresorhus/electron-dl) - Simplified file downloads for your Electron app
|
||||
Loading…
Add table
Add a link
Reference in a new issue