1
0

Kernel-Exceptions.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  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. category: 'accessing',
  8. fn: function (){
  9. var self=this;
  10. return self.context;
  11. ;
  12. return self},
  13. args: [],
  14. source: "context\x0a\x09<return self.context>",
  15. messageSends: [],
  16. referencedClasses: []
  17. }),
  18. smalltalk.Error);
  19. smalltalk.addMethod(
  20. "_isSmalltalkError",
  21. smalltalk.method({
  22. selector: "isSmalltalkError",
  23. category: 'testing',
  24. fn: function (){
  25. var self=this;
  26. return self.smalltalkError === true;
  27. ;
  28. return self},
  29. args: [],
  30. source: "isSmalltalkError\x0a\x09<return self.smalltalkError === true>",
  31. messageSends: [],
  32. referencedClasses: []
  33. }),
  34. smalltalk.Error);
  35. smalltalk.addMethod(
  36. "_jsStack",
  37. smalltalk.method({
  38. selector: "jsStack",
  39. category: 'accessing',
  40. fn: function (){
  41. var self=this;
  42. return self.stack;
  43. ;
  44. return self},
  45. args: [],
  46. source: "jsStack\x0a\x09<return self.stack>",
  47. messageSends: [],
  48. referencedClasses: []
  49. }),
  50. smalltalk.Error);
  51. smalltalk.addMethod(
  52. "_messageText",
  53. smalltalk.method({
  54. selector: "messageText",
  55. category: 'accessing',
  56. fn: function (){
  57. var self=this;
  58. return self["@messageText"];
  59. },
  60. args: [],
  61. source: "messageText\x0a\x09^messageText",
  62. messageSends: [],
  63. referencedClasses: []
  64. }),
  65. smalltalk.Error);
  66. smalltalk.addMethod(
  67. "_messageText_",
  68. smalltalk.method({
  69. selector: "messageText:",
  70. category: 'accessing',
  71. fn: function (aString){
  72. var self=this;
  73. self["@messageText"]=aString;
  74. return self},
  75. args: ["aString"],
  76. source: "messageText: aString\x0a\x09messageText := aString",
  77. messageSends: [],
  78. referencedClasses: []
  79. }),
  80. smalltalk.Error);
  81. smalltalk.addMethod(
  82. "_signal",
  83. smalltalk.method({
  84. selector: "signal",
  85. category: 'signaling',
  86. fn: function (){
  87. var self=this;
  88. self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self);
  89. ;
  90. return self},
  91. args: [],
  92. source: "signal\x0a\x09<self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self)>",
  93. messageSends: [],
  94. referencedClasses: []
  95. }),
  96. smalltalk.Error);
  97. smalltalk.addMethod(
  98. "_signal_",
  99. smalltalk.method({
  100. selector: "signal:",
  101. category: 'signaling',
  102. fn: function (aString){
  103. var self=this;
  104. smalltalk.send(self,"_messageText_",[aString]);
  105. smalltalk.send(self,"_signal",[]);
  106. return self},
  107. args: ["aString"],
  108. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  109. messageSends: ["messageText:", "signal"],
  110. referencedClasses: []
  111. }),
  112. smalltalk.Error);
  113. smalltalk.addMethod(
  114. "_signal",
  115. smalltalk.method({
  116. selector: "signal",
  117. category: 'instance creation',
  118. fn: function (){
  119. var self=this;
  120. var $1;
  121. $1=smalltalk.send(smalltalk.send(self,"_new",[]),"_signal",[]);
  122. return $1;
  123. },
  124. args: [],
  125. source: "signal\x0a\x09^self new signal",
  126. messageSends: ["signal", "new"],
  127. referencedClasses: []
  128. }),
  129. smalltalk.Error.klass);
  130. smalltalk.addMethod(
  131. "_signal_",
  132. smalltalk.method({
  133. selector: "signal:",
  134. category: 'instance creation',
  135. fn: function (aString){
  136. var self=this;
  137. var $1;
  138. $1=smalltalk.send(smalltalk.send(self,"_new",[]),"_signal_",[aString]);
  139. return $1;
  140. },
  141. args: ["aString"],
  142. source: "signal: aString\x0a\x09 ^self new\x0a\x09\x09signal: aString",
  143. messageSends: ["signal:", "new"],
  144. referencedClasses: []
  145. }),
  146. smalltalk.Error.klass);
  147. smalltalk.addClass('MessageNotUnderstood', smalltalk.Error, ['message', 'receiver'], 'Kernel-Exceptions');
  148. smalltalk.addMethod(
  149. "_message",
  150. smalltalk.method({
  151. selector: "message",
  152. category: 'accessing',
  153. fn: function (){
  154. var self=this;
  155. return self["@message"];
  156. },
  157. args: [],
  158. source: "message\x0a\x09^message",
  159. messageSends: [],
  160. referencedClasses: []
  161. }),
  162. smalltalk.MessageNotUnderstood);
  163. smalltalk.addMethod(
  164. "_message_",
  165. smalltalk.method({
  166. selector: "message:",
  167. category: 'accessing',
  168. fn: function (aMessage){
  169. var self=this;
  170. self["@message"]=aMessage;
  171. return self},
  172. args: ["aMessage"],
  173. source: "message: aMessage\x0a\x09message := aMessage",
  174. messageSends: [],
  175. referencedClasses: []
  176. }),
  177. smalltalk.MessageNotUnderstood);
  178. smalltalk.addMethod(
  179. "_messageText",
  180. smalltalk.method({
  181. selector: "messageText",
  182. category: 'accessing',
  183. fn: function (){
  184. var self=this;
  185. var $1;
  186. $1=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self,"_receiver",[]),"_asString",[]),"__comma",[" does not understand #"]),"__comma",[smalltalk.send(smalltalk.send(self,"_message",[]),"_selector",[])]);
  187. return $1;
  188. },
  189. args: [],
  190. source: "messageText\x0a\x09^self receiver asString, ' does not understand #', self message selector",
  191. messageSends: [",", "selector", "message", "asString", "receiver"],
  192. referencedClasses: []
  193. }),
  194. smalltalk.MessageNotUnderstood);
  195. smalltalk.addMethod(
  196. "_receiver",
  197. smalltalk.method({
  198. selector: "receiver",
  199. category: 'accessing',
  200. fn: function (){
  201. var self=this;
  202. return self["@receiver"];
  203. },
  204. args: [],
  205. source: "receiver\x0a\x09^receiver",
  206. messageSends: [],
  207. referencedClasses: []
  208. }),
  209. smalltalk.MessageNotUnderstood);
  210. smalltalk.addMethod(
  211. "_receiver_",
  212. smalltalk.method({
  213. selector: "receiver:",
  214. category: 'accessing',
  215. fn: function (anObject){
  216. var self=this;
  217. self["@receiver"]=anObject;
  218. return self},
  219. args: ["anObject"],
  220. source: "receiver: anObject\x0a\x09receiver := anObject",
  221. messageSends: [],
  222. referencedClasses: []
  223. }),
  224. smalltalk.MessageNotUnderstood);
  225. smalltalk.addClass('NonBooleanReceiver', smalltalk.Error, ['object'], 'Kernel-Exceptions');
  226. smalltalk.addMethod(
  227. "_object",
  228. smalltalk.method({
  229. selector: "object",
  230. category: 'accessing',
  231. fn: function (){
  232. var self=this;
  233. return self["@object"];
  234. },
  235. args: [],
  236. source: "object\x0a\x09^ object",
  237. messageSends: [],
  238. referencedClasses: []
  239. }),
  240. smalltalk.NonBooleanReceiver);
  241. smalltalk.addMethod(
  242. "_object_",
  243. smalltalk.method({
  244. selector: "object:",
  245. category: 'accessing',
  246. fn: function (anObject){
  247. var self=this;
  248. self["@object"]=anObject;
  249. return self},
  250. args: ["anObject"],
  251. source: "object: anObject\x0a\x09object := anObject",
  252. messageSends: [],
  253. referencedClasses: []
  254. }),
  255. smalltalk.NonBooleanReceiver);
  256. smalltalk.addClass('ErrorHandler', smalltalk.Object, [], 'Kernel-Exceptions');
  257. smalltalk.addMethod(
  258. "_handleError_",
  259. smalltalk.method({
  260. selector: "handleError:",
  261. category: 'error handling',
  262. fn: function (anError){
  263. var self=this;
  264. var $1;
  265. $1=smalltalk.send(anError,"_context",[]);
  266. if(($receiver = $1) == nil || $receiver == undefined){
  267. $1;
  268. } else {
  269. smalltalk.send(self,"_logErrorContext_",[smalltalk.send(anError,"_context",[])]);
  270. };
  271. smalltalk.send(self,"_logError_",[anError]);
  272. return self},
  273. args: ["anError"],
  274. source: "handleError: anError\x0a\x09anError context ifNotNil: [self logErrorContext: anError context].\x0a\x09self logError: anError",
  275. messageSends: ["ifNotNil:", "logErrorContext:", "context", "logError:"],
  276. referencedClasses: []
  277. }),
  278. smalltalk.ErrorHandler);
  279. smalltalk.addMethod(
  280. "_log_",
  281. smalltalk.method({
  282. selector: "log:",
  283. category: 'private',
  284. fn: function (aString){
  285. var self=this;
  286. smalltalk.send(console,"_log_",[aString]);
  287. return self},
  288. args: ["aString"],
  289. source: "log: aString\x0a\x09console log: aString",
  290. messageSends: ["log:"],
  291. referencedClasses: []
  292. }),
  293. smalltalk.ErrorHandler);
  294. smalltalk.addMethod(
  295. "_logContext_",
  296. smalltalk.method({
  297. selector: "logContext:",
  298. category: 'private',
  299. fn: function (aContext){
  300. var self=this;
  301. var $1;
  302. $1=smalltalk.send(aContext,"_home",[]);
  303. if(($receiver = $1) == nil || $receiver == undefined){
  304. $1;
  305. } else {
  306. smalltalk.send(self,"_logContext_",[smalltalk.send(aContext,"_home",[])]);
  307. };
  308. smalltalk.send(self,"_log_",[smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aContext,"_receiver",[]),"_asString",[]),"__comma",[">>"]),"__comma",[smalltalk.send(aContext,"_selector",[])])]);
  309. return self},
  310. args: ["aContext"],
  311. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home].\x0a\x09self log: aContext receiver asString, '>>', aContext selector",
  312. messageSends: ["ifNotNil:", "logContext:", "home", "log:", ",", "selector", "asString", "receiver"],
  313. referencedClasses: []
  314. }),
  315. smalltalk.ErrorHandler);
  316. smalltalk.addMethod(
  317. "_logError_",
  318. smalltalk.method({
  319. selector: "logError:",
  320. category: 'private',
  321. fn: function (anError){
  322. var self=this;
  323. smalltalk.send(self,"_log_",[smalltalk.send(anError,"_messageText",[])]);
  324. return self},
  325. args: ["anError"],
  326. source: "logError: anError\x0a\x09self log: anError messageText",
  327. messageSends: ["log:", "messageText"],
  328. referencedClasses: []
  329. }),
  330. smalltalk.ErrorHandler);
  331. smalltalk.addMethod(
  332. "_logErrorContext_",
  333. smalltalk.method({
  334. selector: "logErrorContext:",
  335. category: 'private',
  336. fn: function (aContext){
  337. var self=this;
  338. var $1;
  339. if(($receiver = aContext) == nil || $receiver == undefined){
  340. aContext;
  341. } else {
  342. $1=smalltalk.send(aContext,"_home",[]);
  343. if(($receiver = $1) == nil || $receiver == undefined){
  344. $1;
  345. } else {
  346. smalltalk.send(self,"_logContext_",[smalltalk.send(aContext,"_home",[])]);
  347. };
  348. };
  349. return self},
  350. args: ["aContext"],
  351. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home]]",
  352. messageSends: ["ifNotNil:", "logContext:", "home"],
  353. referencedClasses: []
  354. }),
  355. smalltalk.ErrorHandler);
  356. smalltalk.ErrorHandler.klass.iVarNames = ['current'];
  357. smalltalk.addMethod(
  358. "_current",
  359. smalltalk.method({
  360. selector: "current",
  361. category: 'accessing',
  362. fn: function (){
  363. var self=this;
  364. var $1;
  365. if(($receiver = self["@current"]) == nil || $receiver == undefined){
  366. self["@current"]=smalltalk.send(self,"_new",[]);
  367. $1=self["@current"];
  368. } else {
  369. $1=self["@current"];
  370. };
  371. return $1;
  372. },
  373. args: [],
  374. source: "current\x0a\x09^current ifNil: [current := self new]",
  375. messageSends: ["ifNil:", "new"],
  376. referencedClasses: []
  377. }),
  378. smalltalk.ErrorHandler.klass);
  379. smalltalk.addMethod(
  380. "_initialize",
  381. smalltalk.method({
  382. selector: "initialize",
  383. category: 'initialization',
  384. fn: function (){
  385. var self=this;
  386. smalltalk.send(self,"_register",[]);
  387. return self},
  388. args: [],
  389. source: "initialize\x0a\x09self register",
  390. messageSends: ["register"],
  391. referencedClasses: []
  392. }),
  393. smalltalk.ErrorHandler.klass);
  394. smalltalk.addMethod(
  395. "_register",
  396. smalltalk.method({
  397. selector: "register",
  398. category: 'initialization',
  399. fn: function (){
  400. var self=this;
  401. smalltalk.send((smalltalk.ErrorHandler || ErrorHandler),"_setCurrent_",[smalltalk.send(self,"_new",[])]);
  402. return self},
  403. args: [],
  404. source: "register\x0a\x09ErrorHandler setCurrent: self new",
  405. messageSends: ["setCurrent:", "new"],
  406. referencedClasses: ["ErrorHandler"]
  407. }),
  408. smalltalk.ErrorHandler.klass);
  409. smalltalk.addMethod(
  410. "_setCurrent_",
  411. smalltalk.method({
  412. selector: "setCurrent:",
  413. category: 'accessing',
  414. fn: function (anHandler){
  415. var self=this;
  416. self["@current"]=anHandler;
  417. return self},
  418. args: ["anHandler"],
  419. source: "setCurrent: anHandler\x0a\x09current := anHandler",
  420. messageSends: [],
  421. referencedClasses: []
  422. }),
  423. smalltalk.ErrorHandler.klass);