Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 13 additions & 26 deletions src/MCP/MCPToolMutation.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,20 @@ MCPToolMutation >> addSupplementalDetailsForMutationError: anError to: details [
methodNode := self methodNodeFromError: cause.
methodNode ifNotNil: [
self addSupplementalSelectorFromMethodNode: methodNode to: details ].
(PharoCompatibility compilationAstFromException: cause) ifNotNil: [
:ast | self addSupplementalSelectorFromMethodNode: ast to: details ].
(PharoCompatibility compilationAstFromException: anError) ifNotNil: [ :ast |
self addSupplementalSelectorFromMethodNode: ast to: details ].
anError == cause ifFalse: [
methodNode := self methodNodeFromError: anError.
methodNode ifNotNil: [
self addSupplementalSelectorFromMethodNode: methodNode to: details ].
(PharoCompatibility compilationAstFromException: anError)
ifNotNil: [ :ast |
self addSupplementalSelectorFromMethodNode: ast to: details ] ].
methodNode := self methodNodeFromError: anError.
methodNode ifNotNil: [
self addSupplementalSelectorFromMethodNode: methodNode to: details ] ].
position := self positionFromError: cause.
position ifNotNil: [ details at: #position put: position ].
undeclaredVariableNode := self undeclaredVariableNodeFrom: cause.
undeclaredVariableNode ifNotNil: [
variableName := self undeclaredVariableNameFor: cause.
variableName ifNotNil: [
details at: #variableName put: variableName ].
(self startPositionFromNode: undeclaredVariableNode) ifNotNil: [
:start | details at: #position put: start ] ]
variableName := self undeclaredVariableNameFor: cause.
variableName ifNotNil: [ details at: #variableName put: variableName ].
(self startPositionFromNode: undeclaredVariableNode) ifNotNil: [ :start |
details at: #position put: start ] ]
]

{ #category : 'private - errors' }
Expand Down Expand Up @@ -326,12 +322,6 @@ MCPToolMutation >> mutationActionForErrorFromParsedRequest: mutationRequest rawR
{ #category : 'private - errors' }
MCPToolMutation >> mutationFailureCauseFor: anError [

(PharoCompatibility
noticeFromException: anError
ifKindOfAnyNamed:
#( OCUndeclaredVariableNotice OCUndeclaredVariableWarning
OCSyntaxErrorNotice RBSyntaxErrorNotice SyntaxErrorNotification ))
ifNotNil: [ :notice | ^ notice ].
^ anError mcpMutationFailureNotice
]

Expand Down Expand Up @@ -621,19 +611,16 @@ MCPToolMutation >> undeclaredVariableNameFor: anError [
{ #category : 'private - errors' }
MCPToolMutation >> undeclaredVariableNodeFrom: anError [

anError mcpNoticeNode ifNotNil: [ :node | ^ node ].
^ PharoCompatibility undeclaredVariableNodeFromException: anError
]

{ #category : 'private - errors' }
MCPToolMutation >> undeclaredVariableNoticeFrom: anError [

(PharoCompatibility
noticeFromException: anError
ifKindOfAnyNamed:
#( OCUndeclaredVariableNotice OCUndeclaredVariableWarning ))
ifNotNil: [ :notice | ^ notice ].
(#( 'OCUndeclaredVariableNotice' 'OCUndeclaredVariableWarning' )
includes: anError class name asString) ifTrue: [ ^ anError ].
| notice |
notice := anError mcpMutationFailureNotice.
(self undeclaredVariableNodeFrom: notice) ifNotNil: [ ^ notice ].
^ nil
]

Expand Down
2 changes: 1 addition & 1 deletion src/MCP/OCCodeError.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ OCCodeError >> mcpMutationFailureNotice [
{ #category : '*MCP' }
OCCodeError >> mcpNoticeNode [

^ self node
^ PharoCompatibility undeclaredVariableNodeFromException: self
]
8 changes: 1 addition & 7 deletions src/MCP/OCUndeclaredVariableWarning.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,8 @@ OCUndeclaredVariableWarning >> mcpMethodNode [
^ self methodNode
]

{ #category : '*MCP' }
OCUndeclaredVariableWarning >> mcpMutationFailureNotice [

^ self notice ifNil: [ self ]
]

{ #category : '*MCP' }
OCUndeclaredVariableWarning >> mcpNoticeNode [

^ self node
^ PharoCompatibility undeclaredVariableNodeFromException: self
]
Loading