1

使用 Scriptella ETL,我最近开始了解 onerror 标签。它工作正常,但我想制作一个通用代码,每当发生任何错误时将代码和消息插入数据库。

我这样使用它:

 <onerror codes="42604,42617,42000,1366" >
        INSERT INTO demo_travel.test_log(Time_Now, ErrorName) values (    sysdate(),'eeuhue');
  </onerror>

哪个有效,但我想要这样的东西:

 <onerror  >
        INSERT INTO demo_travel.test_log(Time_Now, ErrorName,ErrorMSG) values (    sysdate(),Error.code, error.msg);
  </onerror>
4

1 回答 1

1

Unfortunately there is no easy way to achieve that. onerror was based on the assumption that a developer knows an error he is dealing with. But I do agree this has to be improved. The problem was partially addressed in a Feature request: Allow different connection-id in onerror element.

So for 1.1 or earlier versions, this is not possible. For a current development snapshot of 1.2, this information can be inferred from the "error" variable as explained in the ticket. I've also created a subticket to expose additional properties of the error.

于 2013-07-04T14:23:01.453 回答