Structured Error Handling in the ABL Sarah Marshall QA Architect, OpenEdge Session 128.

Презентация:



Advertisements
Похожие презентации
Урок повторения по теме: «Сила». Задание 1 Задание 2.
Advertisements

© 2006 Cisco Systems, Inc. All rights reserved. HIPS v Administering Events and Generating Reports Managing Events.
1. Определить последовательность проезда перекрестка
1 When And How To Make Interfaces Work For You Advanced OO Techniques Alex Herbstritt Principal Software Engineer, Progress Software Session 102.
Масштаб 1 : 5000 Приложение 1 к решению Совета депутатов города Новосибирска от _____________ ______.
Типовые расчёты Растворы
Школьная форма Презентация для родительского собрания.
Ребусы Свириденковой Лизы Ученицы 6 класса «А». 10.
© 2002, Cisco Systems, Inc. All rights reserved. AWLF 3.0Module 7-1 © 2002, Cisco Systems, Inc. All rights reserved.
Разработал: Учитель химии, биологии высшей квалификационной категории Баженов Алексей Анатольевич.
Understanding Record and Table Locking In OpenEdge ® SQL Applications Jeff Owen Principle Software Engineer, OESQL Progress Software Session 132.
1 Анна Юфкина Специалист по бизнес-решениям

© 2006 Cisco Systems, Inc. All rights reserved.ISCW v Cisco IOS Threat Defense Features Configuring Cisco IOS IPS.
© 2006 Cisco Systems, Inc. All rights reserved. CVOICE v Configuring Voice Networks Configuring Dial Peers.
OpenEdge ® GUI for.NET Modernize your user interface with ABL Shelley Chase OpenEdge Architect Progress Software Corporation Session 113.
© 2006 Cisco Systems, Inc. All rights reserved. HIPS v Using CSA Analysis Generating Application Deployment Reports.
© 2009 Avaya Inc. All rights reserved.1 Chapter Three, Voic Pro Advanced Functions Module Four – Voic Campaigns.
© 2003, Cisco Systems, Inc. All rights reserved. CSVPN Lesson 17 Configure the Cisco Virtual Private Network 3000 Series Concentrator for LAN-to-LAN.
Масштаб 1 : 5000 Приложение 1 к решению Совета депутатов города Новосибирска от _____________ ______.
Транксрипт:

Structured Error Handling in the ABL Sarah Marshall QA Architect, OpenEdge Session 128

© 2009 Progress Software Corporation. All rights reserved. Traditional Error Handling 2 NO-ERROR ON ERROR UNDO, LEAVE RETURN ERROR

© 2009 Progress Software Corporation. All rights reserved. A Bit About Blocks

© 2009 Progress Software Corporation. All rights reserved. UNDO, ON ERROR RETRY NEXT LEAVE RETURN A Bit About Blocks 4 Outer Block Inner Block

© 2009 Progress Software Corporation. All rights reserved. UNDO, ON ERROR RETRY NEXT LEAVE RETURN A Bit About Blocks 5 Outer Block Inner Block E

© 2009 Progress Software Corporation. All rights reserved. UNDO, ON ERROR RETRY NEXT LEAVE RETURN A Bit About Blocks 6 Outer Block Inner Block E

© 2009 Progress Software Corporation. All rights reserved. CATCH err AS Progress.Lang.Error Structured Error Handling Model – 10.1C 7 CATCH blocks to handle all error types myError INHERITS Progress.Lang.AppError Ability to create user-defined application errors Facilities to propagate errors up the call stack UNDO, THROW

© 2009 Progress Software Corporation. All rights reserved. ON ERROR UNDO, RETRY NEXT LEAVE RETURN Catching Errors 8 Enclosing Block Associated Block E Catch

© 2009 Progress Software Corporation. All rights reserved. ON ERROR UNDO, RETRY NEXT LEAVE RETURN Catching Errors 9 Enclosing Block Associated Block E Catch

© 2009 Progress Software Corporation. All rights reserved. ON ERROR UNDO, RETRY NEXT LEAVE RETURN Catching Errors 10 Enclosing Block Associated Block Catch E

© 2009 Progress Software Corporation. All rights reserved. PROCEDURE ErrorBlock: FOR EACH Customer: FIND FIRST Order WHERE Order-Num = CATCH e AS Progress.Lang.SysError: MESSAGE e:GetMessage(1) VIEW-AS ALERT-BOX. DELETE OBJECT e. END CATCH. END. END PROCEDURE. Lets Look At The Code 11

© 2009 Progress Software Corporation. All rights reserved. Lets Look At The Code 12 PROCEDURE ErrorBlock: FOR EACH Customer: FIND FIRST Order WHERE Order-Num = CATCH e AS Progress.Lang.SysError: MESSAGE e:GetMessage(1) VIEW-AS ALERT-BOX. DELETE OBJECT e. END CATCH. END. END PROCEDURE.

© 2009 Progress Software Corporation. All rights reserved. Lets Look At The Code 13 PROCEDURE ErrorBlock: FOR EACH Customer: FIND FIRST Order WHERE Order-Num = CATCH e AS Progress.Lang.SysError: MESSAGE e:GetMessage(1) VIEW-AS ALERT-BOX. DELETE OBJECT e. END CATCH. END. END PROCEDURE.

© 2009 Progress Software Corporation. All rights reserved. Lets Look At The Code 14 PROCEDURE ErrorBlock: FOR EACH Customer: FIND FIRST Order WHERE Order-Num = CATCH e AS Progress.Lang.SysError: MESSAGE e:GetMessage(1) VIEW-AS ALERT-BOX. DELETE OBJECT e. END CATCH. END. END PROCEDURE.

© 2009 Progress Software Corporation. All rights reserved. Object Hierarchy 15 Progress.Lang.Object Progress.Lang.ProError Progress.Lang.AppError Progress.Lang.SysError Progress.Lang. SoapFaultError User-Defined Error Objects Progress.Lang. Error >

© 2009 Progress Software Corporation. All rights reserved. Object Hierarchy 16 Progress.Lang.Object Progress.Lang.ProError Progress.Lang.AppError Progress.Lang.SysError Progress.Lang. SoapFaultError User-Defined Error Objects Progress.Lang. Error >

© 2009 Progress Software Corporation. All rights reserved. Object Hierarchy 17 Progress.Lang.Object Progress.Lang.ProError Progress.Lang.AppError Progress.Lang.SysError Progress.Lang. SoapFaultError User-Defined Error Objects Progress.Lang. Error >

© 2009 Progress Software Corporation. All rights reserved. Object Hierarchy 18 Progress.Lang.Object Progress.Lang.ProError Progress.Lang.AppError Progress.Lang.SysError Progress.Lang. SoapFaultError User-Defined Error Objects Progress.Lang. Error >

© 2009 Progress Software Corporation. All rights reserved. Progress.Lang. Error > Object Hierarchy 19 Progress.Lang.Object Progress.Lang.ProError Progress.Lang.AppError Progress.Lang.SysError Progress.Lang. SoapFaultError User-Defined Error Objects

© 2009 Progress Software Corporation. All rights reserved. Error Objects 20 NumMessages, Severity, CallStack Properties available on ProError GetMessage(), GetMessageNum() Methods available on ProError AddMessage(), RemoveMessage() ReturnValue Additional Methods and Properties on AppError

© 2009 Progress Software Corporation. All rights reserved. ON ERROR UNDO, RETRY LEAVE NEXT RETURN Throwing Errors 21 Enclosing Block Associated Block E

© 2009 Progress Software Corporation. All rights reserved. ON ERROR UNDO, RETRY LEAVE NEXT RETURN Throwing Errors 22 THROW Enclosing Block Associated Block E

© 2009 Progress Software Corporation. All rights reserved. Enclosing Block Associated Block E ON ERROR UNDO, RETRY LEAVE NEXT RETURN Throwing Errors 23 THROW

© 2009 Progress Software Corporation. All rights reserved. Enclosing Block Associated Block ON ERROR UNDO, RETRY LEAVE NEXT RETURN Throwing Errors 24 E THROW

© 2009 Progress Software Corporation. All rights reserved. Throwing Errors 25 ROUTINE-LEVEL ON ERROR UNDO, THROW Overrides default ON ERROR of routine level blocks UNDO, THROW Explicitly throws (or re-throws) an error

© 2009 Progress Software Corporation. All rights reserved. Lets Look At The Code 26 PROCEDURE ErrorBlock: FOR EACH Customer ON ERROR UNDO, LEAVE: FIND FIRST Order WHERE Order-Num = 1001 NO-ERROR. IF ERROR-STATUS:ERROR THEN MESSAGE ERROR-STATUS:GET-MESSAGE(1). END. END PROCEDURE.

© 2009 Progress Software Corporation. All rights reserved. PROCEDURE ErrorBlock: FOR EACH Customer ON ERROR UNDO, LEAVE: FIND FIRST Order WHERE Order-Num = 1001 NO-ERROR. IF ERROR-STATUS:ERROR THEN MESSAGE ERROR-STATUS:GET-MESSAGE(1). END. END PROCEDURE. Lets Look At The Code 27

© 2009 Progress Software Corporation. All rights reserved. Lets Look At The Code 28 ROUTINE-LEVEL ON ERROR UNDO, THROW. PROCEDURE ErrorBlock: FOR EACH Customer ON ERROR UNDO, THROW: FIND FIRST Order WHERE Order-Num = END. END PROCEDURE.

© 2009 Progress Software Corporation. All rights reserved. Lets Look At The Code 29 ROUTINE-LEVEL ON ERROR UNDO, THROW. PROCEDURE ErrorBlock: FOR EACH Customer ON ERROR UNDO, THROW: FIND FIRST Order WHERE Order-Num = END. END PROCEDURE.

© 2009 Progress Software Corporation. All rights reserved. Lets Look At The Code 30 ROUTINE-LEVEL ON ERROR UNDO, THROW. PROCEDURE ErrorBlock: FOR EACH Customer ON ERROR UNDO, THROW: FIND FIRST Order WHERE Order-Num = END. END PROCEDURE.

© 2009 Progress Software Corporation. All rights reserved. RETURN ERROR Returning Errors 31 Enclosing Block Associated Block E

© 2009 Progress Software Corporation. All rights reserved. Returning Errors 32 Caller Enclosing Block Associated Block E

© 2009 Progress Software Corporation. All rights reserved. Returning Errors 33 Caller Enclosing Block Associated Block E

© 2009 Progress Software Corporation. All rights reserved. Returning Errors 34 Caller Enclosing Block Associated Block E

© 2009 Progress Software Corporation. All rights reserved. Returning Errors 35 RETURN ERROR [error string] Return a Progress.Lang.AppError with error string RETURN ERROR Returns error of type error-object with

© 2009 Progress Software Corporation. All rights reserved. Returning Errors 36 RETURN ERROR [error string] Return a Progress.Lang.AppError with error string RETURN ERROR Returns error of type error-object with Cannot return an error object from the AppServer

© 2009 Progress Software Corporation. All rights reserved. PROCEDURE ErrorBlock: FOR EACH Customer: FIND FIRST Order WHERE Order-Num = 1001 NO-ERROR. IF ERROR-STATUS:ERROR THEN RETURN ERROR NEW OrdNotFoundError(1001). END. END PROCEDURE. Lets Look At The Code 37

© 2009 Progress Software Corporation. All rights reserved. PROCEDURE ErrorBlock: FOR EACH Customer: FIND FIRST Order WHERE Order-Num = 1001 NO-ERROR. IF ERROR-STATUS:ERROR THEN RETURN ERROR NEW OrdNotFoundError(1001). END. END PROCEDURE. Lets Look At The Code 38

© 2009 Progress Software Corporation. All rights reserved. /* MAIN.P */ RUN ErrorBlock IN hPersProc. CATCH e AS Progress.Lang.AppError: MESSAGE e:GetMessage(1) VIEW-AS ALERT-BOX. DELETE e. END CATCH. PROCEDURE ErrorBlock: FOR EACH Customer: FIND FIRST Order WHERE Order-Num = 1001 NO-ERROR. IF ERROR-STATUS:ERROR THEN RETURN ERROR NEW OrdNotFoundError(1001). END. END PROCEDURE. Lets Look At The Code 39

© 2009 Progress Software Corporation. All rights reserved. /* MAIN.P */ RUN ErrorBlock IN hPersProc. CATCH e AS Progress.Lang.AppError: MESSAGE e:GetMessage(1) VIEW-AS ALERT-BOX. DELETE e. END CATCH. PROCEDURE ErrorBlock: FOR EACH Customer: FIND FIRST Order WHERE Order-Num = 1001 NO-ERROR. IF ERROR-STATUS:ERROR THEN RETURN ERROR NEW OrdNotFoundError(1001). END. END PROCEDURE. Lets Look At The Code 40

© 2009 Progress Software Corporation. All rights reserved. A Few Words About NO-ERROR NO-ERROR Continues to suppress errors at the statement level

© 2009 Progress Software Corporation. All rights reserved. A Few Words About NO-ERROR NO-ERROR Continues to suppress errors at the statement level NO-ERROR Can handle errors raised via UNDO, THROW

© 2009 Progress Software Corporation. All rights reserved. A Few Words About NO-ERROR NO-ERROR Continues to suppress errors at the statement level NO-ERROR Can handle errors raised via UNDO, THROW NO-ERROR Converts information from error objects to ERROR-STATUS

© 2009 Progress Software Corporation. All rights reserved. What That Means Is… 44 NO-ERROR ON ERROR, UNDO CATCH RETURN ERROR UNDO, THROW ERROR condition

© 2009 Progress Software Corporation. All rights reserved. What That Means Is… 45 NO-ERROR ON ERROR, UNDO CATCH RETURN ERROR UNDO, THROW ERROR condition Generate any error

© 2009 Progress Software Corporation. All rights reserved. What That Means Is… 46 NO-ERROR ON ERROR, UNDO CATCH RETURN ERROR UNDO, THROW ERROR condition Generate any error Handle any error

© 2009 Progress Software Corporation. All rights reserved. And FINALLY… 47 Enclosing Block Associated Block

© 2009 Progress Software Corporation. All rights reserved. And FINALLY… 48 Enclosing Block Catch Associated Block

© 2009 Progress Software Corporation. All rights reserved. And FINALLY… 49 Always executes on success or failure Enclosing Block Catch Finally Associated Block

© 2009 Progress Software Corporation. All rights reserved. Lets Look At The Code 50 PROCEDURE ErrorBlock: FOR EACH Customer: FIND FIRST Order WHERE Order-Num = CATCH e AS Progress.Lang.SysError: MESSAGE e:GetMessage(1) VIEW-AS ALERT-BOX. DELETE OBJECT e. END CATCH. FINALLY: /* clean up code */ END FINALLY. END. END PROCEDURE.

© 2009 Progress Software Corporation. All rights reserved. Lets Look At The Code 51 PROCEDURE ErrorBlock: FOR EACH Customer: FIND FIRST Order WHERE Order-Num = CATCH e AS Progress.Lang.SysError: MESSAGE e:GetMessage(1) VIEW-AS ALERT-BOX. DELETE OBJECT e. END CATCH. FINALLY: /* clean up code */ END FINALLY. END. END PROCEDURE.

© 2009 Progress Software Corporation. All rights reserved. In Summary Uniform model for handling error conditions More flexibility for application specific errors Traditional and structured error handling models co-exist

Structured Error Handling in the ABL Sarah Marshall QA Architect, OpenEdge Session 128