diff options
| author | michael <michael@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2010-08-20 08:58:13 +0000 |
|---|---|---|
| committer | michael <michael@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2010-08-20 08:58:13 +0000 |
| commit | 0bb5ae0b1cb1db39121db3256d6b18abbdb801a4 (patch) | |
| tree | f9bff91a60c7d26632721c7dec4309059c2e6eec /packages/fcl-web/src/webdata/extjsjson.pp | |
| parent | c33599a44bcf8823dc4df90236f2c4f6efe0e53c (diff) | |
| download | fpc-0bb5ae0b1cb1db39121db3256d6b18abbdb801a4.tar.gz | |
* Error event implemented
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@15861 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/fcl-web/src/webdata/extjsjson.pp')
| -rw-r--r-- | packages/fcl-web/src/webdata/extjsjson.pp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/packages/fcl-web/src/webdata/extjsjson.pp b/packages/fcl-web/src/webdata/extjsjson.pp index 4525d74037..22daedb7c3 100644 --- a/packages/fcl-web/src/webdata/extjsjson.pp +++ b/packages/fcl-web/src/webdata/extjsjson.pp @@ -26,12 +26,15 @@ type { TExtJSJSONDataFormatter } TJSONObjectEvent = Procedure(Sender : TObject; AObject : TJSONObject) of Object; + TJSONExceptionObjectEvent = Procedure(Sender : TObject; E : Exception; AResponse : TJSONObject) of Object; + TExtJSJSONDataFormatter = Class(TExtJSDataFormatter) private FAfterDataToJSON: TJSONObjectEvent; FAfterRowToJSON: TJSONObjectEvent; FBeforeDataToJSON: TJSONObjectEvent; FBeforeRowToJSON: TJSONObjectEvent; + FOnErrorResponse: TJSONExceptionObjectEvent; FOnMetaDataToJSON: TJSONObjectEvent; procedure SendSuccess(ResponseContent: TStream; AddIDValue : Boolean = False); protected @@ -61,6 +64,8 @@ type Property AfterDataToJSON : TJSONObjectEvent Read FAfterDataToJSON Write FAfterDataToJSON; // Called just before response object will be streamed (response passed to handler). Property BeforeDataToJSON : TJSONObjectEvent Read FBeforeDataToJSON Write FBeforeDataToJSON; + // Called when an exception is caught and formatted. + Property OnErrorResponse : TJSONExceptionObjectEvent Read FOnErrorResponse Write FOnErrorResponse; end; implementation @@ -343,6 +348,8 @@ begin If Length(L)>0 then ResponseContent.WriteBuffer(L[1],Length(L)); Resp.Add(RowsProperty,TJSONArray.Create()); + If Assigned(FOnErrorResponse) then + FOnErrorResponse(Self,E,Resp); finally Resp.Free; end; |
