throw exception when metadata is bad
This commit is contained in:
parent
1968e8ac10
commit
82a02fd81a
5
index.js
5
index.js
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue