aboutsummaryrefslogtreecommitdiff
path: root/featureClass/class.js
diff options
context:
space:
mode:
authorSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-01-23 22:21:23 +0800
committerSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-01-23 22:21:23 +0800
commitfe3449248bb556779fc1ef8ee216efeda43e8592 (patch)
treec96fe6a66e8f9ea7a519e1027572b3d8ae53e331 /featureClass/class.js
parenta0158cef8a59537145286ad96fd3daafc5238cf8 (diff)
downloadSoopyV2-fe3449248bb556779fc1ef8ee216efeda43e8592.tar.gz
SoopyV2-fe3449248bb556779fc1ef8ee216efeda43e8592.tar.bz2
SoopyV2-fe3449248bb556779fc1ef8ee216efeda43e8592.zip
add error handling to registering forge event, and other fixes and cleanups
Diffstat (limited to 'featureClass/class.js')
-rw-r--r--featureClass/class.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/featureClass/class.js b/featureClass/class.js
index c796b28..13ddf81 100644
--- a/featureClass/class.js
+++ b/featureClass/class.js
@@ -72,10 +72,16 @@ class Feature {
delete this.soopyEvents[event.id]
}
- registerForge(event, func){
- let theEvent = this.FeatureManager.registerForge(event, func, this)
+ registerForge(event, func, messageIfError){
+ let theEvent
+ try{
+ theEvent = this.FeatureManager.registerForge(event, func, this)
this.forgeEvents[theEvent.id] = theEvent
+ }catch(e){
+ if(!messageIfError) messageIfError = "An error occured while registering the event " + event.toString() + ", this may cause " + this.constructor.name + " to not work properly."
+ ChatLib.chat(this.FeatureManager.messagePrefix + messageIfError)
+ }
return theEvent
}