Kernel-Exceptions.deploy.js 6.1 KB

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