Kernel-Exceptions.deploy.js 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. smalltalk.addPackage('Kernel-Exceptions', {});
  2. smalltalk.addClass('Error', smalltalk.Object, ['messageText'], 'Kernel-Exceptions');
  3. smalltalk.addMethod(
  4. "_context",
  5. smalltalk.method({
  6. selector: "context",
  7. fn: function (){
  8. var self=this;
  9. return smalltalk.withContext(function($ctx) { return self.context;
  10. ;
  11. return self}, self, "context", [], smalltalk.Error)}
  12. }),
  13. smalltalk.Error);
  14. smalltalk.addMethod(
  15. "_isSmalltalkError",
  16. smalltalk.method({
  17. selector: "isSmalltalkError",
  18. fn: function (){
  19. var self=this;
  20. return smalltalk.withContext(function($ctx) { return self.smalltalkError === true;
  21. ;
  22. return self}, self, "isSmalltalkError", [], smalltalk.Error)}
  23. }),
  24. smalltalk.Error);
  25. smalltalk.addMethod(
  26. "_jsStack",
  27. smalltalk.method({
  28. selector: "jsStack",
  29. fn: function (){
  30. var self=this;
  31. return smalltalk.withContext(function($ctx) { return self.stack;
  32. ;
  33. return self}, self, "jsStack", [], smalltalk.Error)}
  34. }),
  35. smalltalk.Error);
  36. smalltalk.addMethod(
  37. "_messageText",
  38. smalltalk.method({
  39. selector: "messageText",
  40. fn: function (){
  41. var self=this;
  42. return smalltalk.withContext(function($ctx) { return self["@messageText"];
  43. }, self, "messageText", [], smalltalk.Error)}
  44. }),
  45. smalltalk.Error);
  46. smalltalk.addMethod(
  47. "_messageText_",
  48. smalltalk.method({
  49. selector: "messageText:",
  50. fn: function (aString){
  51. var self=this;
  52. return smalltalk.withContext(function($ctx) { self["@messageText"]=aString;
  53. return self}, self, "messageText:", [aString], smalltalk.Error)}
  54. }),
  55. smalltalk.Error);
  56. smalltalk.addMethod(
  57. "_signal",
  58. smalltalk.method({
  59. selector: "signal",
  60. fn: function (){
  61. var self=this;
  62. return smalltalk.withContext(function($ctx) { self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self);
  63. ;
  64. return self}, self, "signal", [], smalltalk.Error)}
  65. }),
  66. smalltalk.Error);
  67. smalltalk.addMethod(
  68. "_signal_",
  69. smalltalk.method({
  70. selector: "signal:",
  71. fn: function (aString){
  72. var self=this;
  73. return smalltalk.withContext(function($ctx) { _st(self)._messageText_(aString);
  74. _st(self)._signal();
  75. return self}, self, "signal:", [aString], smalltalk.Error)}
  76. }),
  77. smalltalk.Error);
  78. smalltalk.addMethod(
  79. "_signal",
  80. smalltalk.method({
  81. selector: "signal",
  82. fn: function (){
  83. var self=this;
  84. return smalltalk.withContext(function($ctx) { var $1;
  85. $1=_st(_st(self)._new())._signal();
  86. return $1;
  87. }, self, "signal", [], smalltalk.Error.klass)}
  88. }),
  89. smalltalk.Error.klass);
  90. smalltalk.addMethod(
  91. "_signal_",
  92. smalltalk.method({
  93. selector: "signal:",
  94. fn: function (aString){
  95. var self=this;
  96. return smalltalk.withContext(function($ctx) { var $1;
  97. $1=_st(_st(self)._new())._signal_(aString);
  98. return $1;
  99. }, self, "signal:", [aString], smalltalk.Error.klass)}
  100. }),
  101. smalltalk.Error.klass);
  102. smalltalk.addClass('MessageNotUnderstood', smalltalk.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  103. smalltalk.addMethod(
  104. "_message",
  105. smalltalk.method({
  106. selector: "message",
  107. fn: function (){
  108. var self=this;
  109. return smalltalk.withContext(function($ctx) { return self["@message"];
  110. }, self, "message", [], smalltalk.MessageNotUnderstood)}
  111. }),
  112. smalltalk.MessageNotUnderstood);
  113. smalltalk.addMethod(
  114. "_message_",
  115. smalltalk.method({
  116. selector: "message:",
  117. fn: function (aMessage){
  118. var self=this;
  119. return smalltalk.withContext(function($ctx) { self["@message"]=aMessage;
  120. return self}, self, "message:", [aMessage], smalltalk.MessageNotUnderstood)}
  121. }),
  122. smalltalk.MessageNotUnderstood);
  123. smalltalk.addMethod(
  124. "_messageText",
  125. smalltalk.method({
  126. selector: "messageText",
  127. fn: function (){
  128. var self=this;
  129. return smalltalk.withContext(function($ctx) { var $1;
  130. $1=_st(_st(_st(_st(self)._receiver())._asString()).__comma(" does not understand #")).__comma(_st(_st(self)._message())._selector());
  131. return $1;
  132. }, self, "messageText", [], smalltalk.MessageNotUnderstood)}
  133. }),
  134. smalltalk.MessageNotUnderstood);
  135. smalltalk.addMethod(
  136. "_receiver",
  137. smalltalk.method({
  138. selector: "receiver",
  139. fn: function (){
  140. var self=this;
  141. return smalltalk.withContext(function($ctx) { return self["@receiver"];
  142. }, self, "receiver", [], smalltalk.MessageNotUnderstood)}
  143. }),
  144. smalltalk.MessageNotUnderstood);
  145. smalltalk.addMethod(
  146. "_receiver_",
  147. smalltalk.method({
  148. selector: "receiver:",
  149. fn: function (anObject){
  150. var self=this;
  151. return smalltalk.withContext(function($ctx) { self["@receiver"]=anObject;
  152. return self}, self, "receiver:", [anObject], smalltalk.MessageNotUnderstood)}
  153. }),
  154. smalltalk.MessageNotUnderstood);
  155. smalltalk.addClass('NonBooleanReceiver', smalltalk.Error, ['object'], 'Kernel-Exceptions');
  156. smalltalk.addMethod(
  157. "_object",
  158. smalltalk.method({
  159. selector: "object",
  160. fn: function (){
  161. var self=this;
  162. return smalltalk.withContext(function($ctx) { return self["@object"];
  163. }, self, "object", [], smalltalk.NonBooleanReceiver)}
  164. }),
  165. smalltalk.NonBooleanReceiver);
  166. smalltalk.addMethod(
  167. "_object_",
  168. smalltalk.method({
  169. selector: "object:",
  170. fn: function (anObject){
  171. var self=this;
  172. return smalltalk.withContext(function($ctx) { self["@object"]=anObject;
  173. return self}, self, "object:", [anObject], smalltalk.NonBooleanReceiver)}
  174. }),
  175. smalltalk.NonBooleanReceiver);
  176. smalltalk.addClass('ErrorHandler', smalltalk.Object, [], 'Kernel-Exceptions');
  177. smalltalk.addMethod(
  178. "_handleError_",
  179. smalltalk.method({
  180. selector: "handleError:",
  181. fn: function (anError){
  182. var self=this;
  183. return smalltalk.withContext(function($ctx) { var $1;
  184. $1=_st(anError)._context();
  185. if(($receiver = $1) == nil || $receiver == undefined){
  186. $1;
  187. } else {
  188. _st(self)._logErrorContext_(_st(anError)._context());
  189. };
  190. _st(self)._logError_(anError);
  191. return self}, self, "handleError:", [anError], smalltalk.ErrorHandler)}
  192. }),
  193. smalltalk.ErrorHandler);
  194. smalltalk.addMethod(
  195. "_log_",
  196. smalltalk.method({
  197. selector: "log:",
  198. fn: function (aString){
  199. var self=this;
  200. return smalltalk.withContext(function($ctx) { _st(console)._log_(aString);
  201. return self}, self, "log:", [aString], smalltalk.ErrorHandler)}
  202. }),
  203. smalltalk.ErrorHandler);
  204. smalltalk.addMethod(
  205. "_logContext_",
  206. smalltalk.method({
  207. selector: "logContext:",
  208. fn: function (aContext){
  209. var self=this;
  210. return smalltalk.withContext(function($ctx) { var $1;
  211. $1=_st(aContext)._home();
  212. if(($receiver = $1) == nil || $receiver == undefined){
  213. $1;
  214. } else {
  215. _st(self)._logContext_(_st(aContext)._home());
  216. };
  217. _st(self)._log_(_st(_st(_st(_st(aContext)._receiver())._asString()).__comma(">>")).__comma(_st(aContext)._selector()));
  218. return self}, self, "logContext:", [aContext], smalltalk.ErrorHandler)}
  219. }),
  220. smalltalk.ErrorHandler);
  221. smalltalk.addMethod(
  222. "_logError_",
  223. smalltalk.method({
  224. selector: "logError:",
  225. fn: function (anError){
  226. var self=this;
  227. return smalltalk.withContext(function($ctx) { _st(self)._log_(_st(anError)._messageText());
  228. return self}, self, "logError:", [anError], smalltalk.ErrorHandler)}
  229. }),
  230. smalltalk.ErrorHandler);
  231. smalltalk.addMethod(
  232. "_logErrorContext_",
  233. smalltalk.method({
  234. selector: "logErrorContext:",
  235. fn: function (aContext){
  236. var self=this;
  237. return smalltalk.withContext(function($ctx) { var $1;
  238. if(($receiver = aContext) == nil || $receiver == undefined){
  239. aContext;
  240. } else {
  241. $1=_st(aContext)._home();
  242. if(($receiver = $1) == nil || $receiver == undefined){
  243. $1;
  244. } else {
  245. _st(self)._logContext_(_st(aContext)._home());
  246. };
  247. };
  248. return self}, self, "logErrorContext:", [aContext], smalltalk.ErrorHandler)}
  249. }),
  250. smalltalk.ErrorHandler);
  251. smalltalk.ErrorHandler.klass.iVarNames = ['current'];
  252. smalltalk.addMethod(
  253. "_current",
  254. smalltalk.method({
  255. selector: "current",
  256. fn: function (){
  257. var self=this;
  258. return smalltalk.withContext(function($ctx) { var $1;
  259. if(($receiver = self["@current"]) == nil || $receiver == undefined){
  260. self["@current"]=_st(self)._new();
  261. $1=self["@current"];
  262. } else {
  263. $1=self["@current"];
  264. };
  265. return $1;
  266. }, self, "current", [], smalltalk.ErrorHandler.klass)}
  267. }),
  268. smalltalk.ErrorHandler.klass);
  269. smalltalk.addMethod(
  270. "_initialize",
  271. smalltalk.method({
  272. selector: "initialize",
  273. fn: function (){
  274. var self=this;
  275. return smalltalk.withContext(function($ctx) { _st(self)._register();
  276. return self}, self, "initialize", [], smalltalk.ErrorHandler.klass)}
  277. }),
  278. smalltalk.ErrorHandler.klass);
  279. smalltalk.addMethod(
  280. "_register",
  281. smalltalk.method({
  282. selector: "register",
  283. fn: function (){
  284. var self=this;
  285. return smalltalk.withContext(function($ctx) { _st((smalltalk.ErrorHandler || ErrorHandler))._setCurrent_(_st(self)._new());
  286. return self}, self, "register", [], smalltalk.ErrorHandler.klass)}
  287. }),
  288. smalltalk.ErrorHandler.klass);
  289. smalltalk.addMethod(
  290. "_setCurrent_",
  291. smalltalk.method({
  292. selector: "setCurrent:",
  293. fn: function (anHandler){
  294. var self=this;
  295. return smalltalk.withContext(function($ctx) { self["@current"]=anHandler;
  296. return self}, self, "setCurrent:", [anHandler], smalltalk.ErrorHandler.klass)}
  297. }),
  298. smalltalk.ErrorHandler.klass);