Skip to content
This repository has been archived by the owner on Jan 20, 2021. It is now read-only.

Commit

Permalink
Improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Phanx committed May 20, 2017
1 parent 6bac373 commit 19002ab
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions LibRealmInfo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,18 @@ end

------------------------------------------------------------------------

local validRegions = { US = true, EU = true, CN = true, TW = true } -- missing KR data :(
local validRegions = { US = true, EU = true, CN = true, KR = true, TW = true }

function lib:GetRealmInfo(name, region)
debug("GetRealmInfo", name, region)
if type(name) == "number" or strmatch(name, "^%d+$") then
local isString = type(name) == "string"
if isString then
name = strtrim(name)
end
if type(name) == "number" or isString and strmatch(name, "^%d+$") then
return self:GetRealmInfoByID(name)
end
name = type(name) == "string" and strtrim(name) or ""
assert(strlen(name) > 0, "Usage: GetRealmInfo(name[, region])")
assert(isString and strlen(name) > 0, "Usage: GetRealmInfo(name[, region])")

if not region or not validRegions[region] then
region = self:GetCurrentRegion()
Expand Down Expand Up @@ -800,7 +803,7 @@ realmData = {
[2116] = "줄진,PVP,koKR,징벌의 전장,KR",
[2107] = "하이잘,PVP,koKR,격노의 전장,KR",
[293] = "헬스크림,PVP,koKR,격노의 전장,KR",
}}
--}}
--{{ China
[925] = "万色星辰,PVE,zhCN,Battle Group 9,CN",
[922] = "世界之树,PVE,zhCN,Battle Group 9,CN",
Expand Down

0 comments on commit 19002ab

Please sign in to comment.