Skip to content
This repository has been archived by the owner on Jul 19, 2018. It is now read-only.

TypeError: Cannot call method 'match' of undefined #73

Closed
peili opened this issue Nov 3, 2012 · 4 comments
Closed

TypeError: Cannot call method 'match' of undefined #73

peili opened this issue Nov 3, 2012 · 4 comments
Assignees

Comments

@peili
Copy link

peili commented Nov 3, 2012

I am getting the following error, once in a while.

Any idea?

/home/meeting/node_modules/ua-parser/js/index.js:15
var m = ua.match(regexp);
^
TypeError: Cannot call method 'match' of undefined
at Array.parser as 0
at Object.parse (/home/meeting/node_modules/ua-parser/js/index.js:53:31)
at IncomingMessage.app.get.callback (/home/meeting/app.js:294:21)
at IncomingMessage.EventEmitter.emit (events.js:115:20)
at IncomingMessage._emitEnd (http.js:366:10)
at HTTPParser.parserOnMessageComplete as onMessageComplete
at Socket.socketOnData as ondata
at TCP.onread (net.js:402:27)

@ghost ghost assigned tobie Nov 5, 2012
@tobie
Copy link
Owner

tobie commented Nov 5, 2012

Probably means your UA string… is not a string.

@tobie
Copy link
Owner

tobie commented Nov 8, 2012

Question here is should we throw a clearer error here, or should we silently convert all input to strings. /cc @shripadk

@peili
Copy link
Author

peili commented Nov 8, 2012

I personally would recommend to convert all input to strings. BOTS usually don't tell their user-agent. So if you convert all input to strings, i think it is more handable and userfriendly for implementing ua-parser in your own applications. Because you don't need to take care of those bots and extra check if user-agent is set.

@tobie
Copy link
Owner

tobie commented Nov 12, 2012

Fixed in #91 which I'd love your feedback on.

@tobie tobie closed this as completed Nov 12, 2012
skliffmueller pushed a commit to skliffmueller/ua-parser that referenced this issue Oct 22, 2015
 Fix a bug in one of the Android regexps.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants