Sha256: c68c064bd2e7d2aae320b5640a9e6804ae7e3dc9387b3e73dc6c0a845a474469

Contents?: true

Size: 1.99 KB

Versions: 6

Compression:

Stored size: 1.99 KB

Contents

Smalltalk current createPackage: 'Kernel-Exceptions' properties: #{}!
Object subclass: #Error
	instanceVariableNames: 'messageText'
	package: 'Kernel-Exceptions'!

!Error methodsFor: 'accessing'!

context
	<return self.context>
!

jsStack
	<return self.stack>
!

messageText
	^messageText
!

messageText: aString
	messageText := aString
! !

!Error methodsFor: 'signaling'!

signal
	<self.context = smalltalk.getThisContext(); self.smalltalkError = true; throw(self)>
! !

!Error methodsFor: 'testing'!

isSmalltalkError
	<return self.smalltalkError === true>
! !

!Error class methodsFor: 'instance creation'!

signal: aString
	    ^self new
		messageText: aString;
		signal
! !

Error subclass: #MessageNotUnderstood
	instanceVariableNames: 'message receiver'
	package: 'Kernel-Exceptions'!

!MessageNotUnderstood methodsFor: 'accessing'!

message
	^message
!

message: aMessage
	message := aMessage
!

messageText
	^self receiver asString, ' does not understand #', self message selector
!

receiver
	^receiver
!

receiver: anObject
	receiver := anObject
! !

Object subclass: #ErrorHandler
	instanceVariableNames: ''
	package: 'Kernel-Exceptions'!

!ErrorHandler methodsFor: 'error handling'!

handleError: anError
	anError context ifNotNil: [self logErrorContext: anError context].
	self logError: anError
! !

!ErrorHandler methodsFor: 'private'!

log: aString
	console log: aString
!

logContext: aContext
	aContext home ifNotNil: [
		self logContext: aContext home].
	self log: aContext receiver asString, '>>', aContext selector
!

logError: anError
	self log: anError messageText
!

logErrorContext: aContext
	aContext ifNotNil: [
		aContext home ifNotNil: [
			self logContext: aContext home]]
! !

ErrorHandler class instanceVariableNames: 'current'!

!ErrorHandler class methodsFor: 'accessing'!

current
	^current ifNil: [current := self new]
!

setCurrent: anHandler
	current := anHandler
! !

!ErrorHandler class methodsFor: 'initialization'!

initialize
	self register
!

register
	ErrorHandler setCurrent: self new
! !

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
mdbe-0.1.0 public/amber/st/Kernel-Exceptions.st
maglev-database-explorer-0.0.5 public/amber/st/Kernel-Exceptions.st
maglev-database-explorer-0.0.4 public/amber/st/Kernel-Exceptions.st
maglev-database-explorer-0.0.3 public/amber/st/Kernel-Exceptions.st
maglev-database-explorer-0.0.2 public/amber/st/Kernel-Exceptions.st
maglev-database-explorer-0.0.1 public/amber/st/Kernel-Exceptions.st