소스 검색

Customize block now used with #error:.

No special-cased piggybacked Error instances in response field.
Herby Vojčík 7 년 전
부모
커밋
5dcc30311e
2개의 변경된 파일5개의 추가작업 그리고 9개의 파일을 삭제
  1. 4 2
      src/Znock/ZnockBase.class.st
  2. 1 7
      src/Znock/ZnockClient.class.st

+ 4 - 2
src/Znock/ZnockBase.class.st

@@ -43,7 +43,9 @@ ZnockBase >> doesNotUnderstand: aMessage [
 
 { #category : #public }
 ZnockBase >> error: aString [
-	self response: (Error new messageText: aString; yourself)
+	self response: self newCleanResponse.
+	builtClient customizeResponseBlock: [ :req :res | self error: aString ]
+
 ]
 
 { #category : #building }
@@ -146,7 +148,7 @@ ZnockBase >> response [
 
 { #category : #building }
 ZnockBase >> response: response [
-	self response ifNotNil: [ self error: 'Response already created' ].
+	self response ifNotNil: [ super error: 'Response already created' ].
 	builtClient response: response
 ]
 

+ 1 - 7
src/Znock/ZnockClient.class.st

@@ -23,12 +23,6 @@ ZnockClient >> fakeDelay: aDuration [
 		ifFalse: [ aDuration asDelay wait ]
 ]
 
-{ #category : #'private protocol' }
-ZnockClient >> fakeResponse: aZnResponse [
-	response := aZnResponse.
-	(response respondsTo: #signal) ifTrue: [ response signal ]
-]
-
 { #category : #'private protocol' }
 ZnockClient >> getConnectionAndExecute [
 	| expectation |
@@ -36,7 +30,7 @@ ZnockClient >> getConnectionAndExecute [
 	expectation ifNil: [ ^ super executeRequestResponse ].
 	expectation customizeResponseFromRequest: request.
 	expectation delay ifNotNil: [ :delay | self fakeDelay: delay ].
-	self fakeResponse: expectation response.
+	response := expectation response.
 	^ response contents
 ]