Login
Register
Menu
Home
Forum
JassDoc
Types
Functions
Variables
Help
Chat
Media
Search
Search posts
WC3 JASS.com
"The Jass Vault" plus vJASS and Zinc
WC3 Modding Information Center
Forum
Warcraft (WC3) Modding
Warcraft III Resources
Warcraft III Spells and Systems
Codes & Snippets
ErrorMessage
Warcraft III:
Maps
Models
Skins
Icons
Spells / Systems
Tools
Tutorials
Snippets
JASS vJASS Spells and Systems
Tutorials
Chat @Discord
vJASS & Zinc Documentation
For the latest documentation about how it works vJASS and Zinc language layers for Warcraft III, please follow these links:
Jasshelper documentation
-
Zinc documentation
-
WC3 Optimizer documentation
ErrorMessage
Codes & Snippets
Started by
moyack
Views
1726
Replies
0
Users
1
1
Pages:
1
Go Down
0 Members and 1 Guest are viewing this topic.
nestharus
Newbie - level 2
Posts:
23
WC3 Models: 0
WC3 Tutorials: 0
WC3 Tools: 0
WC3 Maps: 0
WC3 Skins: 0
WC3 Icons: 0
WC3 Spells: 0
Reputation:
20
User
ErrorMessage
on:
March 21, 2012, 03:44:14 AM
Category:
String handling, Variables
Language:
vJASS
Code: jass
library
ErrorMessage
/* v1.0.1.4
*************************************************************************************
*
* Issue Compliant Error Messages
*
************************************************************************************
*
* debug function ThrowError takes boolean expression, string libraryName, string functionName, string objectName, integer objectInstance, string description returns nothing
* - In the event of an error the game will be permanently paused
*
* debug function ThrowWarning takes boolean expression, string libraryName, string functionName, string objectName, integer objectInstance, string description returns nothing
*
************************************************************************************/
static
if
DEBUG_MODE
then
private
struct
Fields
extends
array
static
constant
string
COLOR_RED =
"|cffff0000"
static
constant
string
COLOR_YELLOW =
"|cffffff00"
static
string
lastError =
null
endstruct
private
function
Pause
takes
nothing
returns
nothing
call
PauseGame
(
true
)
endfunction
private
function
ThrowMessage
takes
string
libraryName,
string
functionName,
string
objectName,
integer
objectInstance,
string
description,
string
errorType,
string
color
returns
nothing
local
string
str
local
string
color_braces =
"|cff66FF99"
local
string
orange =
"|cffff6600"
set
str =
"->
\n
-> "
+ color_braces +
"{|r "
+
"Library"
+ color_braces +
"("
+ orange + libraryName + color_braces +
")"
if
(objectName !=
null
)
then
if
(objectInstance > 0)
then
set
str = str +
"|r.Object"
+ color_braces +
"("
+ orange + objectName + color_braces +
" (|rinstance = "
+ orange +
I2S
(objectInstance) + color_braces +
") )"
+
"|r."
+
"Method"
+ color_braces +
"("
+ orange + functionName + color_braces +
")"
else
set
str = str +
"|r.Object"
+ color_braces +
"("
+ orange + objectName + color_braces +
")|r."
+
"Method"
+ color_braces +
"("
+ orange + functionName + color_braces +
")"
endif
else
set
str = str +
"|r."
+
"Function"
+ color_braces +
"("
+ orange + functionName + color_braces +
")"
endif
set
str = str + color_braces +
" }|r "
+
"has thrown an exception of type "
+ color_braces +
"("
+ color + errorType + color_braces +
")|r."
set
Fields.lastError = str +
"
\n
->
\n
"
+
"-> "
+ color + description +
"|r
\n
->"
endfunction
function
ThrowError
takes
boolean
expression,
string
libraryName,
string
functionName,
string
objectName,
integer
objectInstance,
string
description
returns
nothing
if
(Fields.lastError !=
null
)
then
set
objectInstance = 1/0
endif
if
(expression)
then
call
ThrowMessage(libraryName, functionName, objectName, objectInstance, description,
"Error"
, Fields.COLOR_RED)
call
DisplayTimedTextToPlayer
(
GetLocalPlayer
(),0,0,60000,Fields.lastError)
call
TimerStart
(
CreateTimer
(), 0,
true
,
function
Pause)
set
objectInstance = 1/0
endif
endfunction
function
ThrowWarning
takes
boolean
expression,
string
libraryName,
string
functionName,
string
objectName,
integer
objectInstance,
string
description
returns
nothing
if
(Fields.lastError !=
null
)
then
set
objectInstance = 1/0
endif
if
(expression)
then
call
ThrowMessage(libraryName, functionName, objectName, objectInstance, description,
"Warning"
, Fields.COLOR_YELLOW)
call
DisplayTimedTextToPlayer
(
GetLocalPlayer
(),0,0,60000,Fields.lastError)
set
Fields.lastError =
null
endif
endfunction
endif
endlibrary
«
Last Edit: December 19, 2017, 12:54:32 AM by moyack
»
Print
Pages:
1
Go Up
« previous
next »
WC3 Modding Information Center
Forum
Warcraft (WC3) Modding
Warcraft III Resources
Warcraft III Spells and Systems
Codes & Snippets
ErrorMessage
PortaMx-SEF 1.54
|
PortaMx © 2008-2015
,
PortaMx corp.
Search
Username
Password
Always stay logged in
Forgot your password?