Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0ab99a6

Browse filesBrowse files
committed
Improve stack traces for existing error() calls
1 parent 9a10fac commit 0ab99a6
Copy full SHA for 0ab99a6

File tree

Expand file treeCollapse file tree

3 files changed

+9
-9
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+9
-9
lines changed

‎garrysmod/lua/includes/extensions/string.lua

Copy file name to clipboardExpand all lines: garrysmod/lua/includes/extensions/string.lua
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,9 +357,9 @@ end
357357
function string.Comma( number, str )
358358

359359
if ( str ~= nil and not isstring( str ) ) then
360-
error( "bad argument #2 to 'string.Comma' (string expected, got " .. type( str ) .. ")" )
360+
error( "bad argument #2 to 'string.Comma' (string expected, got " .. type( str ) .. ")", 2 )
361361
elseif ( str ~= nil and string.match( str, "%d" ) ~= nil ) then
362-
error( "bad argument #2 to 'string.Comma' (non-numerical values expected, got " .. str .. ")" )
362+
error( "bad argument #2 to 'string.Comma' (non-numerical values expected, got " .. str .. ")", 2 )
363363
end
364364

365365
local replace = str == nil and "%1,%2" or "%1" .. str .. "%2"

‎garrysmod/lua/includes/extensions/table.lua

Copy file name to clipboardExpand all lines: garrysmod/lua/includes/extensions/table.lua
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -783,12 +783,12 @@ end
783783
if ( !table.move ) then
784784
function table.move( sourceTbl, from, to, dest, destTbl )
785785

786-
if ( !istable( sourceTbl ) ) then error( "bad argument #1 to 'move' (table expected, got " .. type( sourceTbl ) .. ")" ) end
787-
if ( !isnumber( from ) ) then error( "bad argument #2 to 'move' (number expected, got " .. type( from ) .. ")" ) end
788-
if ( !isnumber( to ) ) then error( "bad argument #3 to 'move' (number expected, got " .. type( to ) .. ")" ) end
789-
if ( !isnumber( dest ) ) then error( "bad argument #4 to 'move' (number expected, got " .. type( dest ) .. ")" ) end
786+
if ( !istable( sourceTbl ) ) then error( "bad argument #1 to 'move' (table expected, got " .. type( sourceTbl ) .. ")", 2 ) end
787+
if ( !isnumber( from ) ) then error( "bad argument #2 to 'move' (number expected, got " .. type( from ) .. ")", 2 ) end
788+
if ( !isnumber( to ) ) then error( "bad argument #3 to 'move' (number expected, got " .. type( to ) .. ")", 2 ) end
789+
if ( !isnumber( dest ) ) then error( "bad argument #4 to 'move' (number expected, got " .. type( dest ) .. ")", 2 ) end
790790
if ( destTbl != nil ) then
791-
if ( !istable( destTbl ) ) then error( "bad argument #5 to 'move' (table expected, got " .. type( destTbl ) .. ")" ) end
791+
if ( !istable( destTbl ) ) then error( "bad argument #5 to 'move' (table expected, got " .. type( destTbl ) .. ")", 2 ) end
792792
else
793793
destTbl = sourceTbl
794794
end

‎garrysmod/lua/includes/extensions/util.lua

Copy file name to clipboardExpand all lines: garrysmod/lua/includes/extensions/util.lua
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -400,9 +400,9 @@ local suffix = ( { "osx64", "osx", "linux64", "linux", "win64", "win32" } )[
400400
local fmt = "lua/bin/gm" .. ( ( CLIENT and !MENU_DLL ) and "cl" or "sv" ) .. "_%s_%s.dll"
401401
function util.IsBinaryModuleInstalled( name )
402402
if ( !isstring( name ) ) then
403-
error( "bad argument #1 to 'IsBinaryModuleInstalled' (string expected, got " .. type( name ) .. ")" )
403+
error( "bad argument #1 to 'IsBinaryModuleInstalled' (string expected, got " .. type( name ) .. ")", 2 )
404404
elseif ( #name == 0 ) then
405-
error( "bad argument #1 to 'IsBinaryModuleInstalled' (string cannot be empty)" )
405+
error( "bad argument #1 to 'IsBinaryModuleInstalled' (string cannot be empty)", 2 )
406406
end
407407

408408
if ( file.Exists( string.format( fmt, name, suffix ), "MOD" ) ) then

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.