mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-13 08:50:43 -05:00
Added Error throwing when calling getConfig()
and a config cannot be found
This commit is contained in:
parent
96acf623de
commit
b645e6f51b
@ -142,12 +142,13 @@ export class TradeHelper
|
|||||||
{
|
{
|
||||||
// Update assort/flea item values
|
// Update assort/flea item values
|
||||||
const traderAssorts = this.traderHelper.getTraderAssortsByTraderId(buyRequestData.tid).items;
|
const traderAssorts = this.traderHelper.getTraderAssortsByTraderId(buyRequestData.tid).items;
|
||||||
const itemPurchased = traderAssorts.find((x) => x._id === buyRequestData.item_id);
|
const itemPurchased = traderAssorts.find((item) => item._id === buyRequestData.item_id);
|
||||||
|
|
||||||
// Ensure purchase does not exceed trader item limit
|
// Ensure purchase does not exceed trader item limit
|
||||||
const assortHasBuyRestrictions = this.itemHelper.hasBuyRestrictions(itemPurchased);
|
const assortHasBuyRestrictions = this.itemHelper.hasBuyRestrictions(itemPurchased);
|
||||||
if (assortHasBuyRestrictions)
|
if (assortHasBuyRestrictions)
|
||||||
{
|
{
|
||||||
|
// Will throw error if check fails
|
||||||
this.checkPurchaseIsWithinTraderItemLimit(
|
this.checkPurchaseIsWithinTraderItemLimit(
|
||||||
sessionID,
|
sessionID,
|
||||||
buyRequestData.tid,
|
buyRequestData.tid,
|
||||||
|
@ -21,6 +21,11 @@ export class ConfigServer
|
|||||||
|
|
||||||
public getConfig<T>(configType: ConfigTypes): T
|
public getConfig<T>(configType: ConfigTypes): T
|
||||||
{
|
{
|
||||||
|
if (!this.configs[configType])
|
||||||
|
{
|
||||||
|
throw new Error(`Config: ${configType} is undefined. Ensure you have not broken it via editing`);
|
||||||
|
}
|
||||||
|
|
||||||
return this.configs[configType];
|
return this.configs[configType];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user