Kernel-Exceptions.deploy.js 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. smalltalk.addPackage('Kernel-Exceptions', {});
  2. smalltalk.addClass('Error', smalltalk.Object, ['messageText'], 'Kernel-Exceptions');
  3. smalltalk.addMethod(
  4. '_messageText',
  5. smalltalk.method({
  6. selector: 'messageText',
  7. fn: function (){
  8. var self=this;
  9. return self['@messageText'];
  10. return self;}
  11. }),
  12. smalltalk.Error);
  13. smalltalk.addMethod(
  14. '_messageText_',
  15. smalltalk.method({
  16. selector: 'messageText:',
  17. fn: function (aString){
  18. var self=this;
  19. self['@messageText']=aString;
  20. return self;}
  21. }),
  22. smalltalk.Error);
  23. smalltalk.addMethod(
  24. '_signal',
  25. smalltalk.method({
  26. selector: 'signal',
  27. fn: function (){
  28. var self=this;
  29. self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self);
  30. return self;}
  31. }),
  32. smalltalk.Error);
  33. smalltalk.addMethod(
  34. '_context',
  35. smalltalk.method({
  36. selector: 'context',
  37. fn: function (){
  38. var self=this;
  39. return self.context;
  40. return self;}
  41. }),
  42. smalltalk.Error);
  43. smalltalk.addMethod(
  44. '_jsStack',
  45. smalltalk.method({
  46. selector: 'jsStack',
  47. fn: function (){
  48. var self=this;
  49. return self.stack;
  50. return self;}
  51. }),
  52. smalltalk.Error);
  53. smalltalk.addMethod(
  54. '_isSmalltalkError',
  55. smalltalk.method({
  56. selector: 'isSmalltalkError',
  57. fn: function (){
  58. var self=this;
  59. return self.smalltalkError === true;
  60. return self;}
  61. }),
  62. smalltalk.Error);
  63. smalltalk.addMethod(
  64. '_signal_',
  65. smalltalk.method({
  66. selector: 'signal:',
  67. fn: function (aString){
  68. var self=this;
  69. return (function($rec){smalltalk.send($rec, "_messageText_", [aString]);return smalltalk.send($rec, "_signal", []);})(smalltalk.send(self, "_new", []));
  70. return self;}
  71. }),
  72. smalltalk.Error.klass);
  73. smalltalk.addClass('MessageNotUnderstood', smalltalk.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  74. smalltalk.addMethod(
  75. '_message',
  76. smalltalk.method({
  77. selector: 'message',
  78. fn: function (){
  79. var self=this;
  80. return self['@message'];
  81. return self;}
  82. }),
  83. smalltalk.MessageNotUnderstood);
  84. smalltalk.addMethod(
  85. '_message_',
  86. smalltalk.method({
  87. selector: 'message:',
  88. fn: function (aMessage){
  89. var self=this;
  90. self['@message']=aMessage;
  91. return self;}
  92. }),
  93. smalltalk.MessageNotUnderstood);
  94. smalltalk.addMethod(
  95. '_receiver',
  96. smalltalk.method({
  97. selector: 'receiver',
  98. fn: function (){
  99. var self=this;
  100. return self['@receiver'];
  101. return self;}
  102. }),
  103. smalltalk.MessageNotUnderstood);
  104. smalltalk.addMethod(
  105. '_receiver_',
  106. smalltalk.method({
  107. selector: 'receiver:',
  108. fn: function (anObject){
  109. var self=this;
  110. self['@receiver']=anObject;
  111. return self;}
  112. }),
  113. smalltalk.MessageNotUnderstood);
  114. smalltalk.addMethod(
  115. '_messageText',
  116. smalltalk.method({
  117. selector: 'messageText',
  118. fn: function (){
  119. var self=this;
  120. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_receiver", []), "_asString", []), "__comma", [unescape("%20does%20not%20understand%20%23")]), "__comma", [smalltalk.send(smalltalk.send(self, "_message", []), "_selector", [])]);
  121. return self;}
  122. }),
  123. smalltalk.MessageNotUnderstood);
  124. smalltalk.addClass('ErrorHandler', smalltalk.Object, [], 'Kernel-Exceptions');
  125. smalltalk.addMethod(
  126. '_handleError_',
  127. smalltalk.method({
  128. selector: 'handleError:',
  129. fn: function (anError){
  130. var self=this;
  131. (($receiver = smalltalk.send(anError, "_context", [])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(self, "_logErrorContext_", [smalltalk.send(anError, "_context", [])]);})() : nil;
  132. smalltalk.send(self, "_logError_", [anError]);
  133. return self;}
  134. }),
  135. smalltalk.ErrorHandler);
  136. smalltalk.addMethod(
  137. '_logContext_',
  138. smalltalk.method({
  139. selector: 'logContext:',
  140. fn: function (aContext){
  141. var self=this;
  142. (($receiver = smalltalk.send(aContext, "_home", [])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(self, "_logContext_", [smalltalk.send(aContext, "_home", [])]);})() : nil;
  143. smalltalk.send(self, "_log_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aContext, "_receiver", []), "_asString", []), "__comma", [unescape("%3E%3E")]), "__comma", [smalltalk.send(aContext, "_selector", [])])]);
  144. return self;}
  145. }),
  146. smalltalk.ErrorHandler);
  147. smalltalk.addMethod(
  148. '_logErrorContext_',
  149. smalltalk.method({
  150. selector: 'logErrorContext:',
  151. fn: function (aContext){
  152. var self=this;
  153. (($receiver = aContext) != nil && $receiver != undefined) ? (function(){return (($receiver = smalltalk.send(aContext, "_home", [])) != nil && $receiver != undefined) ? (function(){return smalltalk.send(self, "_logContext_", [smalltalk.send(aContext, "_home", [])]);})() : nil;})() : nil;
  154. return self;}
  155. }),
  156. smalltalk.ErrorHandler);
  157. smalltalk.addMethod(
  158. '_logError_',
  159. smalltalk.method({
  160. selector: 'logError:',
  161. fn: function (anError){
  162. var self=this;
  163. smalltalk.send(self, "_log_", [smalltalk.send(anError, "_messageText", [])]);
  164. return self;}
  165. }),
  166. smalltalk.ErrorHandler);
  167. smalltalk.addMethod(
  168. '_log_',
  169. smalltalk.method({
  170. selector: 'log:',
  171. fn: function (aString){
  172. var self=this;
  173. smalltalk.send((typeof console == 'undefined' ? nil : console), "_log_", [aString]);
  174. return self;}
  175. }),
  176. smalltalk.ErrorHandler);
  177. smalltalk.ErrorHandler.klass.iVarNames = ['current'];
  178. smalltalk.addMethod(
  179. '_current',
  180. smalltalk.method({
  181. selector: 'current',
  182. fn: function (){
  183. var self=this;
  184. return (($receiver = self['@current']) == nil || $receiver == undefined) ? (function(){return self['@current']=smalltalk.send(self, "_new", []);})() : $receiver;
  185. return self;}
  186. }),
  187. smalltalk.ErrorHandler.klass);
  188. smalltalk.addMethod(
  189. '_initialize',
  190. smalltalk.method({
  191. selector: 'initialize',
  192. fn: function (){
  193. var self=this;
  194. smalltalk.send(self, "_register", []);
  195. return self;}
  196. }),
  197. smalltalk.ErrorHandler.klass);
  198. smalltalk.addMethod(
  199. '_register',
  200. smalltalk.method({
  201. selector: 'register',
  202. fn: function (){
  203. var self=this;
  204. smalltalk.send((smalltalk.ErrorHandler || ErrorHandler), "_setCurrent_", [smalltalk.send(self, "_new", [])]);
  205. return self;}
  206. }),
  207. smalltalk.ErrorHandler.klass);
  208. smalltalk.addMethod(
  209. '_setCurrent_',
  210. smalltalk.method({
  211. selector: 'setCurrent:',
  212. fn: function (anHandler){
  213. var self=this;
  214. self['@current']=anHandler;
  215. return self;}
  216. }),
  217. smalltalk.ErrorHandler.klass);