CraftSim

CraftSim

2M Downloads

Lua error from PriceAPIs.lua

b-morgan opened this issue ยท 4 comments

commented
1x Auctionator/Source/API/Internal.lua:2: Contact the maintainer of CraftSim to resolve this problem. Details: Usage Auctionator.API.v1.GetVendorPriceByItemLink(string, string)
[string "=[C]"]: in function `error'
[string "@Auctionator/Source/API/Internal.lua"]:2: in function `ComposeError'
[string "@Auctionator/Source/API/v1/GetVendorPrice.lua"]:18: in function `GetVendorPriceByItemLink'
[string "@CraftSim/Pricing/PriceAPIs.lua"]:214: in function `GetMinBuyoutByItemLink'
[string "@CraftSim/Pricing/PriceSource.lua"]:103: in function `GetMinBuyoutByItemLink'
[string "@CraftSim/Classes/PriceData.lua"]:201: in function `Update'
[string "@CraftSim/Classes/RecipeData.lua"]:264: in function `new'
[string "@CraftSim/Libs/classic.lua"]:64: in function `RecipeData'
[string "@CraftSim/Init/Init.lua"]:593: in function `TriggerModulesByRecipeType'
[string "@CraftSim/Init/Init.lua"]:85: in function <CraftSim/Init/Init.lua:83>
[string "@CraftSim/Libs/GUTIL/GUTIL.lua"]:606: in function `checkCondition'
[string "@CraftSim/Libs/GUTIL/GUTIL.lua"]:612: in function `WaitFor'
...
[string "@Blizzard_SharedXML/Shared/Scroll/ScrollUtil.lua"]:495: in function `SelectElementDataByPredicate'
[string "@Blizzard_ProfessionsTemplates/Blizzard_ProfessionsRecipeList.lua"]:159: in function `SelectRecipe'
[string "@Blizzard_Professions/Blizzard_ProfessionsCrafting.lua"]:887: in function `Init'
[string "@Blizzard_Professions/Blizzard_ProfessionsCrafting.lua"]:358: in function <...lizzard_Professions/Blizzard_ProfessionsCrafting.lua:357>
[string "=[C]"]: ?
[string "@Blizzard_SharedXMLBase/CallbackRegistry.lua"]:144: in function <...eBlizzard_SharedXMLBase/CallbackRegistry.lua:143>
[string "=[C]"]: ?
[string "@Blizzard_SharedXMLBase/CallbackRegistry.lua"]:147: in function `TriggerEvent'
[string "@Blizzard_Professions/Blizzard_ProfessionsFrame.lua"]:208: in function `SetProfessionInfo'
[string "@Blizzard_Professions/Blizzard_ProfessionsFrame.lua"]:139: in function <...s/Blizzard_Professions/Blizzard_ProfessionsFrame.lua:102>

Locals:
(*temporary) = "Contact the maintainer of CraftSim to resolve this problem. Details: Usage Auctionator.API.v1.GetVendorPriceByItemLink(string, string)"
commented

While it doesn't address the reason for bad inputs, the following changes in PriceAPIs.lua will eliminate the lua error(s).

function CraftSimAUCTIONATOR:GetMinBuyoutByItemID(itemID)
	if itemID then
		local vendorPrice = Auctionator.API.v1.GetVendorPriceByItemID(CraftSimAddonName, itemID)
		if vendorPrice then
			return vendorPrice
		else
			return Auctionator.API.v1.GetAuctionPriceByItemID(CraftSimAddonName, itemID)
		end
	end
    return 0
end

function CraftSimAUCTIONATOR:GetMinBuyoutByItemLink(itemLink)
	if itemLink then
		local vendorPrice = Auctionator.API.v1.GetVendorPriceByItemLink(CraftSimAddonName, itemLink)
		if vendorPrice then
			return vendorPrice
		else
			return Auctionator.API.v1.GetAuctionPriceByItemLink(CraftSimAddonName, itemLink)
		end
	end
    return 0
end