Skip to content

Commit 3600278

Browse files
committed
Improve error message
1 parent be26e53 commit 3600278

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

ScreenManager.lua

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ local ScreenManager = {
2626
_URL = 'https://github.com/rm-code/screenmanager/',
2727
}
2828

29+
-- ------------------------------------------------
30+
-- Constants
31+
-- ------------------------------------------------
32+
33+
local ERROR_MSG = [[
34+
"%s" is not a valid screen!
35+
36+
You will have to add a new one to your screen list or use one of the existing screens:
37+
38+
%s]]
39+
2940
-- ------------------------------------------------
3041
-- Local Variables
3142
-- ------------------------------------------------
@@ -95,7 +106,7 @@ local function validateScreen( screen )
95106

96107
str = str:sub( 1, -3 ) .. "}"
97108

98-
error('"' .. tostring( screen ) .. '" is not a valid screen. You will have to add a new one to your screen list or use one of the existing screens: ' .. str, 3)
109+
error( string.format( ERROR_MSG, tostring( screen ), str ), 3 )
99110
end
100111
end
101112

0 commit comments

Comments
 (0)