mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
fix(bowser): remove custom error due to the bug (#335)
This commit is contained in:
parent
6de4c21220
commit
1515ecaa22
@ -12,17 +12,6 @@ import {
|
|||||||
PLATFORMS_MAP,
|
PLATFORMS_MAP,
|
||||||
} from './constants.js';
|
} from './constants.js';
|
||||||
|
|
||||||
/**
|
|
||||||
* @class
|
|
||||||
* @property name
|
|
||||||
*/
|
|
||||||
class BowserUAIsNotAStringError extends Error {
|
|
||||||
constructor(message) {
|
|
||||||
super(message);
|
|
||||||
this.name = 'BowserUAIsNotAStringError';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bowser class.
|
* Bowser class.
|
||||||
* Keep it simple as much as it can be.
|
* Keep it simple as much as it can be.
|
||||||
@ -42,7 +31,7 @@ class Bowser {
|
|||||||
* @param {Boolean} [skipParsing=false] Will make the Parser postpone parsing until you ask it
|
* @param {Boolean} [skipParsing=false] Will make the Parser postpone parsing until you ask it
|
||||||
* explicitly. Same as `skipParsing` for {@link Parser}.
|
* explicitly. Same as `skipParsing` for {@link Parser}.
|
||||||
* @returns {Parser}
|
* @returns {Parser}
|
||||||
* @throws {BowserUAIsNotAStringError} when UA is not a String
|
* @throws {Error} when UA is not a String
|
||||||
*
|
*
|
||||||
* @example
|
* @example
|
||||||
* const parser = Bowser.getParser(window.navigator.userAgent);
|
* const parser = Bowser.getParser(window.navigator.userAgent);
|
||||||
@ -50,7 +39,7 @@ class Bowser {
|
|||||||
*/
|
*/
|
||||||
static getParser(UA, skipParsing = false) {
|
static getParser(UA, skipParsing = false) {
|
||||||
if (typeof UA !== 'string') {
|
if (typeof UA !== 'string') {
|
||||||
throw new BowserUAIsNotAStringError('UserAgent should be a string');
|
throw new Error('UserAgent should be a string');
|
||||||
}
|
}
|
||||||
return new Parser(UA, skipParsing);
|
return new Parser(UA, skipParsing);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user