123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331 |
- smalltalk.addPackage('Kernel-Exceptions', {});
- smalltalk.addClass('Error', smalltalk.Object, ['messageText'], 'Kernel-Exceptions');
- smalltalk.addMethod(
- "_context",
- smalltalk.method({
- selector: "context",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx) { return self.context;
- ;
- return self}, self, "context", [], smalltalk.Error)}
- }),
- smalltalk.Error);
- smalltalk.addMethod(
- "_isSmalltalkError",
- smalltalk.method({
- selector: "isSmalltalkError",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx) { return self.smalltalkError === true;
- ;
- return self}, self, "isSmalltalkError", [], smalltalk.Error)}
- }),
- smalltalk.Error);
- smalltalk.addMethod(
- "_jsStack",
- smalltalk.method({
- selector: "jsStack",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx) { return self.stack;
- ;
- return self}, self, "jsStack", [], smalltalk.Error)}
- }),
- smalltalk.Error);
- smalltalk.addMethod(
- "_messageText",
- smalltalk.method({
- selector: "messageText",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx) { return self["@messageText"];
- }, self, "messageText", [], smalltalk.Error)}
- }),
- smalltalk.Error);
- smalltalk.addMethod(
- "_messageText_",
- smalltalk.method({
- selector: "messageText:",
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx) { self["@messageText"]=aString;
- return self}, self, "messageText:", [aString], smalltalk.Error)}
- }),
- smalltalk.Error);
- smalltalk.addMethod(
- "_signal",
- smalltalk.method({
- selector: "signal",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx) { self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self);
- ;
- return self}, self, "signal", [], smalltalk.Error)}
- }),
- smalltalk.Error);
- smalltalk.addMethod(
- "_signal_",
- smalltalk.method({
- selector: "signal:",
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx) { _st(self)._messageText_(aString);
- _st(self)._signal();
- return self}, self, "signal:", [aString], smalltalk.Error)}
- }),
- smalltalk.Error);
- smalltalk.addMethod(
- "_signal",
- smalltalk.method({
- selector: "signal",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx) { var $1;
- $1=_st(_st(self)._new())._signal();
- return $1;
- }, self, "signal", [], smalltalk.Error.klass)}
- }),
- smalltalk.Error.klass);
- smalltalk.addMethod(
- "_signal_",
- smalltalk.method({
- selector: "signal:",
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx) { var $1;
- $1=_st(_st(self)._new())._signal_(aString);
- return $1;
- }, self, "signal:", [aString], smalltalk.Error.klass)}
- }),
- smalltalk.Error.klass);
- smalltalk.addClass('MessageNotUnderstood', smalltalk.Error, ['message', 'receiver'], 'Kernel-Exceptions');
- smalltalk.addMethod(
- "_message",
- smalltalk.method({
- selector: "message",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx) { return self["@message"];
- }, self, "message", [], smalltalk.MessageNotUnderstood)}
- }),
- smalltalk.MessageNotUnderstood);
- smalltalk.addMethod(
- "_message_",
- smalltalk.method({
- selector: "message:",
- fn: function (aMessage){
- var self=this;
- return smalltalk.withContext(function($ctx) { self["@message"]=aMessage;
- return self}, self, "message:", [aMessage], smalltalk.MessageNotUnderstood)}
- }),
- smalltalk.MessageNotUnderstood);
- smalltalk.addMethod(
- "_messageText",
- smalltalk.method({
- selector: "messageText",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx) { var $1;
- $1=_st(_st(_st(_st(self)._receiver())._asString()).__comma(" does not understand #")).__comma(_st(_st(self)._message())._selector());
- return $1;
- }, self, "messageText", [], smalltalk.MessageNotUnderstood)}
- }),
- smalltalk.MessageNotUnderstood);
- smalltalk.addMethod(
- "_receiver",
- smalltalk.method({
- selector: "receiver",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx) { return self["@receiver"];
- }, self, "receiver", [], smalltalk.MessageNotUnderstood)}
- }),
- smalltalk.MessageNotUnderstood);
- smalltalk.addMethod(
- "_receiver_",
- smalltalk.method({
- selector: "receiver:",
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx) { self["@receiver"]=anObject;
- return self}, self, "receiver:", [anObject], smalltalk.MessageNotUnderstood)}
- }),
- smalltalk.MessageNotUnderstood);
- smalltalk.addClass('NonBooleanReceiver', smalltalk.Error, ['object'], 'Kernel-Exceptions');
- smalltalk.addMethod(
- "_object",
- smalltalk.method({
- selector: "object",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx) { return self["@object"];
- }, self, "object", [], smalltalk.NonBooleanReceiver)}
- }),
- smalltalk.NonBooleanReceiver);
- smalltalk.addMethod(
- "_object_",
- smalltalk.method({
- selector: "object:",
- fn: function (anObject){
- var self=this;
- return smalltalk.withContext(function($ctx) { self["@object"]=anObject;
- return self}, self, "object:", [anObject], smalltalk.NonBooleanReceiver)}
- }),
- smalltalk.NonBooleanReceiver);
- smalltalk.addClass('ErrorHandler', smalltalk.Object, [], 'Kernel-Exceptions');
- smalltalk.addMethod(
- "_handleError_",
- smalltalk.method({
- selector: "handleError:",
- fn: function (anError){
- var self=this;
- return smalltalk.withContext(function($ctx) { var $1;
- $1=_st(anError)._context();
- if(($receiver = $1) == nil || $receiver == undefined){
- $1;
- } else {
- _st(self)._logErrorContext_(_st(anError)._context());
- };
- _st(self)._logError_(anError);
- return self}, self, "handleError:", [anError], smalltalk.ErrorHandler)}
- }),
- smalltalk.ErrorHandler);
- smalltalk.addMethod(
- "_log_",
- smalltalk.method({
- selector: "log:",
- fn: function (aString){
- var self=this;
- return smalltalk.withContext(function($ctx) { _st(console)._log_(aString);
- return self}, self, "log:", [aString], smalltalk.ErrorHandler)}
- }),
- smalltalk.ErrorHandler);
- smalltalk.addMethod(
- "_logContext_",
- smalltalk.method({
- selector: "logContext:",
- fn: function (aContext){
- var self=this;
- return smalltalk.withContext(function($ctx) { var $1;
- $1=_st(aContext)._home();
- if(($receiver = $1) == nil || $receiver == undefined){
- $1;
- } else {
- _st(self)._logContext_(_st(aContext)._home());
- };
- _st(self)._log_(_st(_st(_st(_st(aContext)._receiver())._asString()).__comma(">>")).__comma(_st(aContext)._selector()));
- return self}, self, "logContext:", [aContext], smalltalk.ErrorHandler)}
- }),
- smalltalk.ErrorHandler);
- smalltalk.addMethod(
- "_logError_",
- smalltalk.method({
- selector: "logError:",
- fn: function (anError){
- var self=this;
- return smalltalk.withContext(function($ctx) { _st(self)._log_(_st(anError)._messageText());
- return self}, self, "logError:", [anError], smalltalk.ErrorHandler)}
- }),
- smalltalk.ErrorHandler);
- smalltalk.addMethod(
- "_logErrorContext_",
- smalltalk.method({
- selector: "logErrorContext:",
- fn: function (aContext){
- var self=this;
- return smalltalk.withContext(function($ctx) { var $1;
- if(($receiver = aContext) == nil || $receiver == undefined){
- aContext;
- } else {
- $1=_st(aContext)._home();
- if(($receiver = $1) == nil || $receiver == undefined){
- $1;
- } else {
- _st(self)._logContext_(_st(aContext)._home());
- };
- };
- return self}, self, "logErrorContext:", [aContext], smalltalk.ErrorHandler)}
- }),
- smalltalk.ErrorHandler);
- smalltalk.ErrorHandler.klass.iVarNames = ['current'];
- smalltalk.addMethod(
- "_current",
- smalltalk.method({
- selector: "current",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx) { var $1;
- if(($receiver = self["@current"]) == nil || $receiver == undefined){
- self["@current"]=_st(self)._new();
- $1=self["@current"];
- } else {
- $1=self["@current"];
- };
- return $1;
- }, self, "current", [], smalltalk.ErrorHandler.klass)}
- }),
- smalltalk.ErrorHandler.klass);
- smalltalk.addMethod(
- "_initialize",
- smalltalk.method({
- selector: "initialize",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx) { _st(self)._register();
- return self}, self, "initialize", [], smalltalk.ErrorHandler.klass)}
- }),
- smalltalk.ErrorHandler.klass);
- smalltalk.addMethod(
- "_register",
- smalltalk.method({
- selector: "register",
- fn: function (){
- var self=this;
- return smalltalk.withContext(function($ctx) { _st((smalltalk.ErrorHandler || ErrorHandler))._setCurrent_(_st(self)._new());
- return self}, self, "register", [], smalltalk.ErrorHandler.klass)}
- }),
- smalltalk.ErrorHandler.klass);
- smalltalk.addMethod(
- "_setCurrent_",
- smalltalk.method({
- selector: "setCurrent:",
- fn: function (anHandler){
- var self=this;
- return smalltalk.withContext(function($ctx) { self["@current"]=anHandler;
- return self}, self, "setCurrent:", [anHandler], smalltalk.ErrorHandler.klass)}
- }),
- smalltalk.ErrorHandler.klass);
|