Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsupported Browser Exception proposal #3389

Merged
merged 2 commits into from
Aug 6, 2020
Merged
Changes from 1 commit
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
22 changes: 22 additions & 0 deletions core/src/plugins.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
import { Capacitor, Plugins } from './global';
import { WebPlugin } from './web';

export enum ExceptionCodes {
UNSUPPORTED_BROWSER = 'UNSUPPORTED_BROWSER',
}

export class Exception extends Error {
readonly code: ExceptionCodes;
}

/**
* Feature unavailable for the current browser (or all browsers).
*
* This error is thrown when the requested API is not supported in the browser.
*
* This can happen particularly for the web platform when implementation is
* uncertain due to the plethora of browsers available to end users.
*
* Error code: `UNSUPPORTED_BROWSER`
*/
export class UnsupportedBrowserException extends Exception {
code = ExceptionCodes.UNSUPPORTED_BROWSER;
}

const PLUGIN_REGISTRY = new (class {
protected readonly plugins: {
[plugin: string]: RegisteredPlugin<unknown>;
Expand Down