fix(bowser): remove custom error due to the bug (#335)

pull/340/head
Denis Demchenko 5 years ago
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…
Cancel
Save