Skip to content

Commit

Permalink
feat(core): add unsupported browser exception (#3389)
Browse files Browse the repository at this point in the history
  • Loading branch information
imhoffd authored Aug 6, 2020
1 parent 62da1e4 commit c51e8f8
Showing 1 changed file with 22 additions and 0 deletions.
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

0 comments on commit c51e8f8

Please sign in to comment.