Topic
  • 3 replies
  • Latest Post - ‏2014-06-09T13:56:45Z by yn2000
jim.smith001
jim.smith001
8 Posts

Pinned topic TDI - Http Server Connector - Error handling

‏2014-06-07T06:56:37Z |

We are using TDI Http Server Connector as the web server for a very small web application.

After receiving the HTTP request, we connect to a DB as part of the data flow and send the HTTP response with the data received from the SQL query. This all works fine.

Now we want to add some generic error handling that if there is any exception within the data flow, we want to send a generic message saying the request could not successfully processed. Typically we do this in the default_on_error hooks for other connectors and it works fine.

However we see that none of the hooks of HTTP server connector are catching errors or exceptions, before sending the response.

Any ideas, how this can be achieved ? Please note that using hooks is our preferred approach than adding try - catch blocks in the old code. We want to void touching the old code as much as possible.

  • yn2000
    yn2000
    1086 Posts

    Re: TDI - Http Server Connector - Error handling

    ‏2014-06-08T13:56:13Z  

    If I read the requirement correctly, you want to catch error "within the data flow". It means that the request is a legitimate request. It means the data is already passed over the HTTP server connector. It means that you have to build your own error handling script, where from the system itself is not an error, but you submit legitimate HTTP response with http.status error or something.

    Rgds. YN.

  • jim.smith001
    jim.smith001
    8 Posts

    Re: TDI - Http Server Connector - Error handling

    ‏2014-06-09T09:11:31Z  
    • yn2000
    • ‏2014-06-08T13:56:13Z

    If I read the requirement correctly, you want to catch error "within the data flow". It means that the request is a legitimate request. It means the data is already passed over the HTTP server connector. It means that you have to build your own error handling script, where from the system itself is not an error, but you submit legitimate HTTP response with http.status error or something.

    Rgds. YN.

    Thanks yn2000 ..

    Yes, from HTTP server connector perspective it is a completely valid input. However the scenario I am referring to is some unexpected exception within the data flow.

    For example, we received the input parameters and now using JDBC connector as part of the data flow. There can be any exception, for example, network problem, DB error code or even null pointer exception etc. Within the Data Flow segment, we have several IF-ELSE TDI branches and script elements.

    So what we are looking for is a single hook where we can catch the error or exception, and then as you explained send an appropriate HTTP response. Somehow, though we have all hooks enabled, the AL just terminates upon a random exception.

     

  • yn2000
    yn2000
    1086 Posts

    Re: TDI - Http Server Connector - Error handling

    ‏2014-06-09T13:56:45Z  

    Thanks yn2000 ..

    Yes, from HTTP server connector perspective it is a completely valid input. However the scenario I am referring to is some unexpected exception within the data flow.

    For example, we received the input parameters and now using JDBC connector as part of the data flow. There can be any exception, for example, network problem, DB error code or even null pointer exception etc. Within the Data Flow segment, we have several IF-ELSE TDI branches and script elements.

    So what we are looking for is a single hook where we can catch the error or exception, and then as you explained send an appropriate HTTP response. Somehow, though we have all hooks enabled, the AL just terminates upon a random exception.

     

    In your situation, unfortunately, you need to use try - catch method to catch random (unknown) exceptions, because Hooks are for more structural (known) type of errors.

    Rgds. YN.