Ver código fonte

Class comments on Kernel-Exceptions classes

Nicolas Petton 11 anos atrás
pai
commit
4c96627dd2
2 arquivos alterados com 24 adições e 0 exclusões
  1. 4 0
      js/Kernel-Exceptions.js
  2. 20 0
      st/Kernel-Exceptions.st

+ 4 - 0
js/Kernel-Exceptions.js

@@ -1,5 +1,6 @@
 smalltalk.addPackage('Kernel-Exceptions', {});
 smalltalk.addClass('Error', smalltalk.Object, ['messageText'], 'Kernel-Exceptions');
+smalltalk.Error.comment="From the ANSI standard:\x0a\x0aThis protocol describes the behavior of instances of class `Error`. \x0aThese are used to represent error conditions that prevent the normal continuation of processing. \x0aActual error exceptions used by an application may be subclasses of this class.\x0aAs `Error` is explicitly specified  to be subclassable, conforming implementations must implement its behavior in a non-fragile manner."
 smalltalk.addMethod(
 "_context",
 smalltalk.method({
@@ -170,6 +171,7 @@ smalltalk.Error.klass);
 
 
 smalltalk.addClass('MessageNotUnderstood', smalltalk.Error, ['message', 'receiver'], 'Kernel-Exceptions');
+smalltalk.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`."
 smalltalk.addMethod(
 "_message",
 smalltalk.method({
@@ -259,6 +261,7 @@ smalltalk.MessageNotUnderstood);
 
 
 smalltalk.addClass('NonBooleanReceiver', smalltalk.Error, ['object'], 'Kernel-Exceptions');
+smalltalk.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver."
 smalltalk.addMethod(
 "_object",
 smalltalk.method({
@@ -296,6 +299,7 @@ smalltalk.NonBooleanReceiver);
 
 
 smalltalk.addClass('ErrorHandler', smalltalk.Object, [], 'Kernel-Exceptions');
+smalltalk.ErrorHandler.comment="ErrorHandler is used to manage Smalltalk errors. \x0aSee `boot.js` `handleError()` function.\x0a\x0aSubclasses of `ErrorHandler` can register themselves as the current handler with\x0a`ErrorHandler class >> register`.\x0a\x0aSubclasses may override `#handleError:` to perform an action on the thrown exception.\x0aThe default behavior is to log the error and the context stack to the JavaScript console."
 smalltalk.addMethod(
 "_handleError_",
 smalltalk.method({

+ 20 - 0
st/Kernel-Exceptions.st

@@ -2,6 +2,13 @@ Smalltalk current createPackage: 'Kernel-Exceptions' properties: #{}!
 Object subclass: #Error
 	instanceVariableNames: 'messageText'
 	package: 'Kernel-Exceptions'!
+!Error commentStamp!
+From the ANSI standard:
+
+This protocol describes the behavior of instances of class `Error`. 
+These are used to represent error conditions that prevent the normal continuation of processing. 
+Actual error exceptions used by an application may be subclasses of this class.
+As `Error` is explicitly specified  to be subclassable, conforming implementations must implement its behavior in a non-fragile manner.!
 
 !Error methodsFor: 'accessing'!
 
@@ -58,6 +65,8 @@ signal: aString
 Error subclass: #MessageNotUnderstood
 	instanceVariableNames: 'message receiver'
 	package: 'Kernel-Exceptions'!
+!MessageNotUnderstood commentStamp!
+This exception is provided to support `Object>>doesNotUnderstand:`.!
 
 !MessageNotUnderstood methodsFor: 'accessing'!
 
@@ -84,6 +93,8 @@ receiver: anObject
 Error subclass: #NonBooleanReceiver
 	instanceVariableNames: 'object'
 	package: 'Kernel-Exceptions'!
+!NonBooleanReceiver commentStamp!
+NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.!
 
 !NonBooleanReceiver methodsFor: 'accessing'!
 
@@ -98,6 +109,15 @@ object: anObject
 Object subclass: #ErrorHandler
 	instanceVariableNames: ''
 	package: 'Kernel-Exceptions'!
+!ErrorHandler commentStamp!
+ErrorHandler is used to manage Smalltalk errors. 
+See `boot.js` `handleError()` function.
+
+Subclasses of `ErrorHandler` can register themselves as the current handler with
+`ErrorHandler class >> register`.
+
+Subclasses may override `#handleError:` to perform an action on the thrown exception.
+The default behavior is to log the error and the context stack to the JavaScript console.!
 
 !ErrorHandler methodsFor: 'error handling'!