Kaynağa Gözat

Error: set default messageText to the name of the error class

Manfred Kroehnert 11 yıl önce
ebeveyn
işleme
1539da9430

+ 11 - 0
js/Kernel-Exceptions.deploy.js

@@ -12,6 +12,17 @@ return self}
 }),
 smalltalk.Error);
 
+smalltalk.addMethod(
+"_initialize",
+smalltalk.method({
+selector: "initialize",
+fn: function (){
+var self=this;
+smalltalk.send(self,"_messageText_",[smalltalk.send("Errorclass: ","__comma",[smalltalk.send(smalltalk.send(self,"_class",[]),"_name",[])])]);
+return self}
+}),
+smalltalk.Error);
+
 smalltalk.addMethod(
 "_isSmalltalkError",
 smalltalk.method({

+ 16 - 0
js/Kernel-Exceptions.js

@@ -17,6 +17,22 @@ referencedClasses: []
 }),
 smalltalk.Error);
 
+smalltalk.addMethod(
+"_initialize",
+smalltalk.method({
+selector: "initialize",
+category: 'initialization',
+fn: function (){
+var self=this;
+smalltalk.send(self,"_messageText_",[smalltalk.send("Errorclass: ","__comma",[smalltalk.send(smalltalk.send(self,"_class",[]),"_name",[])])]);
+return self},
+args: [],
+source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
+messageSends: ["messageText:", ",", "name", "class"],
+referencedClasses: []
+}),
+smalltalk.Error);
+
 smalltalk.addMethod(
 "_isSmalltalkError",
 smalltalk.method({

+ 6 - 0
st/Kernel-Exceptions.st

@@ -21,6 +21,12 @@ messageText: aString
 	messageText := aString
 ! !
 
+!Error methodsFor: 'initialization'!
+
+initialize
+	self messageText: 'Errorclass: ', (self class name).
+! !
+
 !Error methodsFor: 'signaling'!
 
 signal