davidchambers / tutor

JavaScript interface for the Gatherer card database
https://gatherer.wizards.com/
Do What The F*ck You Want To Public License
149 stars 18 forks source link

fetch_set fails on unhinged #39

Closed tstrimple closed 11 years ago

tstrimple commented 11 years ago

fetch_set fails on unhinged due to the regex breaking when trying to match non-standard power / toughness on cards like assquatch.

http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=74251

Notice the power and toughness listed as (3{1/2}/3{1/2})

nicknovitski commented 11 years ago

The parser doesn't break on fractional power and toughness; there are tests for it and everything. The problem might instead be that the card text for assquatch has actual unicode ½ symbols in it.

What exact error do you get?

tstrimple commented 11 years ago

The regex is returning null.

/Users/tstrimple/Downloads/tutor-master 2/parser.coffee:320 _ref = regex.exec(text).slice(1), types = _ref[0], subtypes = _ref[1], p ^ TypeError: Cannot call method 'slice' of null at Object.list_view_attrs.types (/Users/tstrimple/Downloads/tutor-master 2/parser.coffee:320:31) at Object.exports.set (/Users/tstrimple/Downloads/tutor-master 2/parser.coffee:457:22) at Request.exports.fetch_set [as _callback] (/Users/tstrimple/Downloads/tutor-master 2/gatherer.coffee:188:21) at Request.init.self.callback (/Users/tstrimple/Downloads/tutor-master 2/node_modules/request/main.js:120:22) at Request.EventEmitter.emit (events.js:99:17) at Request.<anonymous> (/Users/tstrimple/Downloads/tutor-master 2/node_modules/request/main.js:555:16) at Request.EventEmitter.emit (events.js:96:17) at IncomingMessage.Request.start.self.req.self.httpModule.request.buffer (/Users/tstrimple/Downloads/tutor-master 2/node_modules/request/main.js:517:14) at IncomingMessage.EventEmitter.emit (events.js:126:20) at IncomingMessage._emitEnd (http.js:366:10)

I get it consistently at this URL.

http://localhost:3000/set/Unhinged