throw exception when metadata is bad

This commit is contained in:
Feross Aboukhadijeh 2014-05-11 14:23:19 -07:00
parent 1968e8ac10
commit 82a02fd81a
1 changed files with 2 additions and 3 deletions

View File

@ -36,10 +36,9 @@ module.exports = function (metadata) {
// if buffer fails to decode or there is no info key, then metadata is corrupt // if buffer fails to decode or there is no info key, then metadata is corrupt
info = bncode.encode(bncode.decode(metadata).info) info = bncode.encode(bncode.decode(metadata).info)
} catch (err) { } catch (err) {
// TODO: throw or disregard invalid metadata? throw new Error('`ut_metadata` constructed with corrupt/invalid metadata')
//throw new Error('ut_metadata constructed with invalid metadata')
} }
if (info) if (info)
this._gotMetadata(info) this._gotMetadata(info)
} }