Skip to content

Commit

Permalink
fix(bowser): remove custom error due to the bug (#335)
Browse files Browse the repository at this point in the history
  • Loading branch information
lancedikson committed Jul 17, 2019
1 parent 6de4c21 commit 1515eca
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/bowser.js
Expand Up @@ -12,17 +12,6 @@ import {
PLATFORMS_MAP,
} from './constants.js';

/**
* @class
* @property name
*/
class BowserUAIsNotAStringError extends Error {
constructor(message) {
super(message);
this.name = 'BowserUAIsNotAStringError';
}
}

/**
* Bowser class.
* Keep it simple as much as it can be.
Expand All @@ -42,15 +31,15 @@ class Bowser {
* @param {Boolean} [skipParsing=false] Will make the Parser postpone parsing until you ask it
* explicitly. Same as `skipParsing` for {@link Parser}.
* @returns {Parser}
* @throws {BowserUAIsNotAStringError} when UA is not a String
* @throws {Error} when UA is not a String
*
* @example
* const parser = Bowser.getParser(window.navigator.userAgent);
* const result = parser.getResult();
*/
static getParser(UA, skipParsing = false) {
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);
}
Expand Down

0 comments on commit 1515eca

Please sign in to comment.