mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-13 06:30: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
|
||||
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
|
||||
const assortHasBuyRestrictions = this.itemHelper.hasBuyRestrictions(itemPurchased);
|
||||
if (assortHasBuyRestrictions)
|
||||
{
|
||||
// Will throw error if check fails
|
||||
this.checkPurchaseIsWithinTraderItemLimit(
|
||||
sessionID,
|
||||
buyRequestData.tid,
|
||||
|
@ -21,6 +21,11 @@ export class ConfigServer
|
||||
|
||||
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];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user